1{ stdenv, fetchurl, unzip, cmake, libGLU_combined, freeglut, libX11, xproto, inputproto
2, libXi, pkgconfig }:
3
4stdenv.mkDerivation rec {
5 name = "box2d-${version}";
6 version = "2.3.0";
7
8 src = fetchurl {
9 url = "https://github.com/erincatto/Box2D/archive/v${version}.tar.gz";
10 sha256 = "1dmbswh4x2n5l3c9h0k72m0z4rdpzfy1xl8m8p3rf5rwkvk3bkg2";
11 };
12
13 sourceRoot = "Box2D-${version}/Box2D";
14
15 nativeBuildInputs = [ pkgconfig ];
16 buildInputs = [
17 unzip cmake libGLU_combined freeglut libX11 xproto inputproto libXi
18 ];
19
20 cmakeFlags = [ "-DBOX2D_INSTALL=ON" "-DBOX2D_BUILD_SHARED=ON" ];
21
22 prePatch = ''
23 substituteInPlace Box2D/Common/b2Settings.h \
24 --replace 'b2_maxPolygonVertices 8' 'b2_maxPolygonVertices 15'
25 '';
26
27 meta = with stdenv.lib; {
28 description = "2D physics engine";
29 homepage = http://box2d.org/;
30 maintainers = [ maintainers.raskin ];
31 platforms = platforms.linux;
32 license = licenses.zlib;
33 };
34}