diff options
author | Peter Hoeg <peter@hoeg.com> | 2024-04-04 10:09:57 +0200 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2024-04-09 03:58:31 -0700 |
commit | 620f5a440b33f8f3155a61f68cb1f17e06d9c30c (patch) | |
tree | 3d3e8b588185995faba2c87d6cbb567b419d1a3d /pkgs/development/libraries/box2d | |
parent | 517c2269055091d0665b8a733d161d40982c09b4 (diff) |
box2d: 2.3.1 -> 2.4.1
Diffstat (limited to 'pkgs/development/libraries/box2d')
-rw-r--r-- | pkgs/development/libraries/box2d/default.nix | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/pkgs/development/libraries/box2d/default.nix b/pkgs/development/libraries/box2d/default.nix index 84e2dbc05644a..c2611a8b8dffb 100644 --- a/pkgs/development/libraries/box2d/default.nix +++ b/pkgs/development/libraries/box2d/default.nix @@ -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; }; -} +}) |