30 url = "https://svn.code.sf.net/p/supertuxkart/code/stk-assets";
32 sha256 = "1a84j3psl4cxzkn5ynakpjill7i2f9ki2p729bpmbrvg8fki95aa";
36 # List of bundled libraries in stk-code/lib to keep
37 # Those are the libraries that cannot be replaced
38 # with system packages.
40 # Bullet 2.87 is incompatible (bullet 2.79 needed whereas 2.87 is packaged)
41 # The api changed in a lot of classes, too much work to adapt
43 # Upstream Libenet doesn't yet support IPv6,
44 # So we will use the bundled libenet which
45 # has been fixed to support it.
47 # Internal library of STK, nothing to do about it
49 # Internal library of STK, nothing to do about it
51 # This irrlicht is bundled with cmake
52 # whereas upstream irrlicht still uses
53 # archaic Makefiles, too complicated to switch to.
55 # Not packaged to this date
57 # Not packaged to this date
59 # Not packaged to this date
61 # Not packaged to this date (needed on Darwin)
65 stdenv.mkDerivation rec {
67 pname = "supertuxkart";
70 src = fetchFromGitHub {
71 owner = "supertuxkart";
74 sha256 = "1llyxkdc4m9gnjxqaxlpwvv3ayvpw2bfjzfkkrljaxhznq811g0l";
78 # Deletes all bundled libs in stk-code/lib except those
79 # That couldn't be replaced with system packages
80 find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {}
82 # Allow building with system-installed wiiuse on Darwin
83 substituteInPlace CMakeLists.txt \
84 --replace 'NOT (APPLE OR HAIKU)) AND USE_SYSTEM_WIIUSE' 'NOT (HAIKU)) AND USE_SYSTEM_WIIUSE'
108 ++ lib.optional (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) libopenglrecorder
109 ++ lib.optional stdenv.hostPlatform.isLinux openal
110 ++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenAL IOKit Cocoa libsamplerate ];
113 "-DBUILD_RECORDER=${if (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) then "ON" else "OFF"}"
114 "-DUSE_SYSTEM_ANGELSCRIPT=ON"
116 "-DUSE_SYSTEM_WIIUSE=ON"
117 "-DOpenGL_GL_PREFERENCE=GLVND"
120 # Extract binary from built app bundle
121 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
123 mv $out/{supertuxkart.app/Contents/MacOS,bin}/supertuxkart
124 rm -rf $out/supertuxkart.app
127 # Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
129 wrapProgram $out/bin/supertuxkart \
130 --set-default SUPERTUXKART_ASSETS_DIR "${assets}" \
131 --set-default SUPERTUXKART_DATADIR "$out/share/supertuxkart" \
135 description = "A Free 3D kart racing game";
137 SuperTuxKart is a Free 3D kart racing game, with many tracks,
138 characters and items for you to try, similar in spirit to Mario
141 homepage = "https://supertuxkart.net/";
142 license = licenses.gpl2Plus;
143 maintainers = with maintainers; [ pyrolagus peterhoeg ];
144 platforms = with platforms; unix;
145 changelog = "https://github.com/supertuxkart/stk-code/blob/${version}/CHANGELOG.md";