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