box2d: 2.3.1 -> 2.4.1

This commit is contained in:
Peter Hoeg 2024-04-04 10:09:57 +02:00
parent 517c226905
commit 620f5a440b
2 changed files with 53 additions and 16 deletions

View File

@ -1,37 +1,72 @@
{ lib, stdenv, fetchFromGitHub, cmake, libGLU, libGL, freeglut, libX11, xorgproto
, libXi, pkg-config }:
{ lib
, stdenv
, fetchFromGitHub
, cmake
, libGLU
, libGL
, freeglut
, libX11
, libXcursor
, libXinerama
, libXrandr
, xorgproto
, libXi
, pkg-config
, Carbon
, Cocoa
, Kernel
, OpenGL
, settingsFile ? "include/box2d/b2_settings.h"
}:
stdenv.mkDerivation rec {
let
inherit (lib) cmakeBool optionals;
in
stdenv.mkDerivation (finalAttrs: {
pname = "box2d";
version = "2.3.1";
version = "2.4.1";
src = fetchFromGitHub {
owner = "erincatto";
repo = "box2d";
rev = "v${version}";
sha256 = "sha256-Z2J17YMzQNZqABIa5eyJDT7BWfXveymzs+DWsrklPIs=";
rev = "v${finalAttrs.version}";
hash = "sha256-cL8L+WSTcswj+Bwy8kSOwuEqLyWEM6xa/j/94aBiSck=";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ libGLU libGL freeglut libX11 xorgproto libXi ];
buildInputs = [
libGLU
libGL
freeglut
libX11
libXcursor
libXinerama
libXrandr
xorgproto
libXi
] ++ optionals stdenv.isDarwin [
Carbon Cocoa Kernel OpenGL
];
cmakeFlags = [
"-DBOX2D_INSTALL=ON"
"-DBOX2D_BUILD_SHARED=ON"
"-DBOX2D_BUILD_EXAMPLES=OFF"
(cmakeBool "BOX2D_BUILD_UNIT_TESTS" finalAttrs.doCheck)
];
prePatch = ''
cd Box2D
substituteInPlace Box2D/Common/b2Settings.h \
--replace 'b2_maxPolygonVertices 8' 'b2_maxPolygonVertices 15'
substituteInPlace ${settingsFile} \
--replace-fail 'b2_maxPolygonVertices 8' 'b2_maxPolygonVertices 15'
'';
# tests are broken on 2.4.1 and 2.3.x doesn't have tests: https://github.com/erincatto/box2d/issues/677
doCheck = lib.versionAtLeast finalAttrs.version "2.4.2";
meta = with lib; {
description = "2D physics engine";
homepage = "https://box2d.org/";
maintainers = [ maintainers.raskin ];
maintainers = with maintainers; [ raskin ];
platforms = platforms.unix;
license = licenses.zlib;
};
}
})

View File

@ -20382,7 +20382,9 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) CoreServices Security;
};
box2d = callPackage ../development/libraries/box2d { };
box2d = callPackage ../development/libraries/box2d {
inherit (darwin.apple_sdk.frameworks) Carbon Cocoa Kernel OpenGL;
};
boxfort = callPackage ../development/libraries/boxfort { };