1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 libGLU,
7 libGL,
8 libglut,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "bullet";
13 version = "3.25";
14
15 src = fetchFromGitHub {
16 owner = "bulletphysics";
17 repo = "bullet3";
18 rev = version;
19 sha256 = "sha256-AGP05GoxLjHqlnW63/KkZe+TjO3IKcgBi+Qb/osQuCM=";
20 };
21
22 nativeBuildInputs = [ cmake ];
23 buildInputs = [
24 libGLU
25 libGL
26 libglut
27 ];
28
29 postPatch = ''
30 substituteInPlace examples/ThirdPartyLibs/Gwen/CMakeLists.txt \
31 --replace "-DGLEW_STATIC" "-DGLEW_STATIC -Wno-narrowing"
32 '';
33
34 cmakeFlags =
35 [
36 "-DBUILD_SHARED_LIBS=ON"
37 "-DBUILD_CPU_DEMOS=OFF"
38 "-DINSTALL_EXTRA_LIBS=ON"
39 ]
40 ++ lib.optionals stdenv.hostPlatform.isDarwin [
41 "-DBUILD_BULLET2_DEMOS=OFF"
42 "-DBUILD_UNIT_TESTS=OFF"
43 "-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF"
44 ];
45
46 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=argument-outside-range -Wno-error=c++11-narrowing";
47
48 meta = with lib; {
49 description = "Professional free 3D Game Multiphysics Library";
50 longDescription = ''
51 Bullet 3D Game Multiphysics Library provides state of the art collision
52 detection, soft body and rigid body dynamics.
53 '';
54 homepage = "http://bulletphysics.org";
55 license = licenses.zlib;
56 maintainers = with maintainers; [ aforemny ];
57 platforms = platforms.unix;
58 };
59}