1{ stdenv, requireFile, cmake, libGLU_combined, libX11, libXi }:
2
3let
4 sourceInfo = rec {
5 version="1.1.0";
6 name="liquidfun-${version}";
7 url="https://github.com/google/liquidfun/releases/download/v${version}/${name}";
8 hash="5011a000eacd6202a47317c489e44aa753a833fb562d970e7b8c0da9de01df86";
9 };
10in
11stdenv.mkDerivation rec {
12 src = requireFile {
13 url = sourceInfo.url;
14 sha256 = sourceInfo.hash;
15 name = sourceInfo.name + ".tar.gz";
16 };
17
18 inherit (sourceInfo) name version;
19 buildInputs = [ cmake libGLU_combined libX11 libXi ];
20
21 sourceRoot = "liquidfun/Box2D/";
22
23 preConfigurePhases = "preConfigure";
24
25 preConfigure = ''
26 sed -i Box2D/Common/b2Settings.h -e 's@b2_maxPolygonVertices .*@b2_maxPolygonVertices 15@'
27 substituteInPlace Box2D/CMakeLists.txt --replace "Common/b2GrowableStack.h" "Common/b2GrowableStack.h Common/b2GrowableBuffer.h"
28 '';
29
30 configurePhase = ''
31 mkdir Build
32 cd Build;
33 cmake -DBOX2D_INSTALL=ON -DBOX2D_BUILD_SHARED=ON -DCMAKE_INSTALL_PREFIX=$out ..
34 '';
35
36 meta = {
37 description = "2D physics engine based on Box2D";
38 maintainers = with stdenv.lib.maintainers;
39 [
40 qknight
41 ];
42 platforms = stdenv.lib.platforms.linux;
43 hydraPlatforms = [];
44 license = stdenv.lib.licenses.bsd2;
45 homepage = https://google.github.io/liquidfun/;
46 };
47}
48