nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchurl, unzip, cmake, libGLU, libGL, freeglut, libX11, xorgproto
2, libXi, pkgconfig }:
3
4stdenv.mkDerivation rec {
5 pname = "box2d";
6 version = "2.3.1";
7
8 src = fetchurl {
9 url = "https://github.com/erincatto/Box2D/archive/v${version}.tar.gz";
10 sha256 = "0llpcifl8zbjbpxdwz87drd01m3lwnv82xb4av6kca1xn4w2gmkm";
11 };
12
13 sourceRoot = "Box2D-${version}/Box2D";
14
15 nativeBuildInputs = [ pkgconfig ];
16 buildInputs = [
17 unzip cmake libGLU libGL freeglut libX11 xorgproto libXi
18 ];
19
20 cmakeFlags = [
21 "-DBOX2D_INSTALL=ON"
22 "-DBOX2D_BUILD_SHARED=ON"
23 "-DBOX2D_BUILD_EXAMPLES=OFF"
24 ];
25
26 prePatch = ''
27 substituteInPlace Box2D/Common/b2Settings.h \
28 --replace 'b2_maxPolygonVertices 8' 'b2_maxPolygonVertices 15'
29 '';
30
31 meta = with stdenv.lib; {
32 description = "2D physics engine";
33 homepage = "https://box2d.org/";
34 maintainers = [ maintainers.raskin ];
35 platforms = platforms.linux;
36 license = licenses.zlib;
37 };
38}