32 url = "https://svn.code.sf.net/p/supertuxkart/code/stk-assets";
34 sha256 = "1a84j3psl4cxzkn5ynakpjill7i2f9ki2p729bpmbrvg8fki95aa";
38 # List of bundled libraries in stk-code/lib to keep
39 # Those are the libraries that cannot be replaced
40 # with system packages.
42 # Bullet 2.87 is incompatible (bullet 2.79 needed whereas 2.87 is packaged)
43 # The api changed in a lot of classes, too much work to adapt
45 # Upstream Libenet doesn't yet support IPv6,
46 # So we will use the bundled libenet which
47 # has been fixed to support it.
49 # Internal library of STK, nothing to do about it
51 # Internal library of STK, nothing to do about it
55 # This irrlicht is bundled with cmake
56 # whereas upstream irrlicht still uses
57 # archaic Makefiles, too complicated to switch to.
59 # Not packaged to this date
61 # Not packaged to this date
63 # Not packaged to this date
65 # Not packaged to this date (needed on Darwin)
69 stdenv.mkDerivation rec {
71 pname = "supertuxkart";
74 src = fetchFromGitHub {
75 owner = "supertuxkart";
78 hash = "sha256-gqdaVvgNfCN40ZO/9y8+vTeIJPSq6udKxYZ/MAi4ZMM=";
82 # Deletes all bundled libs in stk-code/lib except those
83 # That couldn't be replaced with system packages
84 find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {}
86 # Allow building with system-installed wiiuse on Darwin
87 substituteInPlace CMakeLists.txt \
88 --replace 'NOT (APPLE OR HAIKU)) AND USE_SYSTEM_WIIUSE' 'NOT (HAIKU)) AND USE_SYSTEM_WIIUSE'
113 ++ lib.optional (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) libopenglrecorder
114 ++ lib.optional stdenv.hostPlatform.isLinux openal
115 ++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenAL IOKit Cocoa IOBluetooth libsamplerate ];
118 "-DBUILD_RECORDER=${if (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) then "ON" else "OFF"}"
119 "-DUSE_SYSTEM_ANGELSCRIPT=ON"
121 "-DUSE_SYSTEM_WIIUSE=ON"
122 "-DOpenGL_GL_PREFERENCE=GLVND"
126 # GCC 13: error: 'snprintf' was not declared in this scope
128 # GCC 13: error: 'runtime_error' is not a member of 'std'
132 # Extract binary from built app bundle
133 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
135 mv $out/{supertuxkart.app/Contents/MacOS,bin}/supertuxkart
136 rm -rf $out/supertuxkart.app
139 # Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
141 wrapProgram $out/bin/supertuxkart \
142 --set-default SUPERTUXKART_ASSETS_DIR "${assets}" \
143 --set-default SUPERTUXKART_DATADIR "$out/share/supertuxkart" \
147 description = "Free 3D kart racing game";
148 mainProgram = "supertuxkart";
150 SuperTuxKart is a Free 3D kart racing game, with many tracks,
151 characters and items for you to try, similar in spirit to Mario
154 homepage = "https://supertuxkart.net/";
155 license = licenses.gpl2Plus;
156 maintainers = with maintainers; [ pyrolagus peterhoeg ];
157 platforms = with platforms; unix;
158 changelog = "https://github.com/supertuxkart/stk-code/blob/${version}/CHANGELOG.md";