summary refs log tree commit diff
path: root/pkgs/development/libraries/box2d/default.nix
blob: 64b18f389accc03c7b416b33c5c4a0a3f03a0f8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ stdenv, fetchurl, unzip, cmake, libGLU, libGL, freeglut, libX11, xorgproto
, libXi, pkgconfig }:

stdenv.mkDerivation rec {
  pname = "box2d";
  version = "2.3.1";

  src = fetchurl {
    url = "https://github.com/erincatto/Box2D/archive/v${version}.tar.gz";
    sha256 = "0llpcifl8zbjbpxdwz87drd01m3lwnv82xb4av6kca1xn4w2gmkm";
  };

  sourceRoot = "Box2D-${version}/Box2D";

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [
    unzip cmake libGLU libGL freeglut libX11 xorgproto libXi
  ];

  cmakeFlags = [
    "-DBOX2D_INSTALL=ON"
    "-DBOX2D_BUILD_SHARED=ON"
    "-DBOX2D_BUILD_EXAMPLES=OFF"
  ];

  prePatch = ''
    substituteInPlace Box2D/Common/b2Settings.h \
      --replace 'b2_maxPolygonVertices	8' 'b2_maxPolygonVertices	15'
  '';

  meta = with stdenv.lib; {
    description = "2D physics engine";
    homepage = https://box2d.org/;
    maintainers = [ maintainers.raskin ];
    platforms = platforms.linux;
    license = licenses.zlib;
  };
}