2021-02-06 00:14:31 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchsvn
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, makeWrapper
|
|
|
|
, SDL2
|
|
|
|
, glew
|
|
|
|
, openal
|
2021-05-16 20:24:34 +00:00
|
|
|
, OpenAL
|
2021-02-06 00:14:31 +00:00
|
|
|
, libvorbis
|
|
|
|
, libogg
|
|
|
|
, curl
|
|
|
|
, freetype
|
|
|
|
, libjpeg
|
|
|
|
, libpng
|
|
|
|
, harfbuzz
|
|
|
|
, mcpp
|
|
|
|
, wiiuse
|
|
|
|
, angelscript
|
2021-10-07 06:30:10 +00:00
|
|
|
, libopenglrecorder
|
|
|
|
, sqlite
|
2021-05-16 20:24:34 +00:00
|
|
|
, Cocoa
|
|
|
|
, IOKit
|
2023-07-18 15:45:57 +00:00
|
|
|
, IOBluetooth
|
2021-10-07 06:30:10 +00:00
|
|
|
, libsamplerate
|
2022-11-11 22:08:22 +00:00
|
|
|
, shaderc
|
2020-06-24 16:54:22 +00:00
|
|
|
}:
|
2017-01-21 06:15:00 +00:00
|
|
|
let
|
2020-05-04 20:56:39 +00:00
|
|
|
assets = fetchsvn {
|
2021-02-06 00:14:31 +00:00
|
|
|
url = "https://svn.code.sf.net/p/supertuxkart/code/stk-assets";
|
2021-10-07 06:30:10 +00:00
|
|
|
rev = "18464";
|
|
|
|
sha256 = "1a84j3psl4cxzkn5ynakpjill7i2f9ki2p729bpmbrvg8fki95aa";
|
2021-02-06 00:14:31 +00:00
|
|
|
name = "stk-assets";
|
2020-05-04 20:56:39 +00:00
|
|
|
};
|
2017-01-21 06:15:00 +00:00
|
|
|
|
2020-06-24 16:54:22 +00:00
|
|
|
# List of bundled libraries in stk-code/lib to keep
|
|
|
|
# Those are the libraries that cannot be replaced
|
|
|
|
# with system packages.
|
|
|
|
bundledLibraries = [
|
|
|
|
# Bullet 2.87 is incompatible (bullet 2.79 needed whereas 2.87 is packaged)
|
|
|
|
# The api changed in a lot of classes, too much work to adapt
|
|
|
|
"bullet"
|
|
|
|
# Upstream Libenet doesn't yet support IPv6,
|
|
|
|
# So we will use the bundled libenet which
|
|
|
|
# has been fixed to support it.
|
|
|
|
"enet"
|
|
|
|
# Internal library of STK, nothing to do about it
|
2021-10-07 06:30:10 +00:00
|
|
|
"graphics_engine"
|
|
|
|
# Internal library of STK, nothing to do about it
|
2020-06-24 16:54:22 +00:00
|
|
|
"graphics_utils"
|
2022-11-11 22:08:22 +00:00
|
|
|
# Internal library.
|
|
|
|
"simd_wrapper"
|
2020-06-24 16:54:22 +00:00
|
|
|
# This irrlicht is bundled with cmake
|
|
|
|
# whereas upstream irrlicht still uses
|
|
|
|
# archaic Makefiles, too complicated to switch to.
|
|
|
|
"irrlicht"
|
|
|
|
# Not packaged to this date
|
|
|
|
"libsquish"
|
2020-12-14 19:21:47 +00:00
|
|
|
# Not packaged to this date
|
|
|
|
"sheenbidi"
|
2021-10-07 06:30:10 +00:00
|
|
|
# Not packaged to this date
|
|
|
|
"tinygettext"
|
|
|
|
# Not packaged to this date (needed on Darwin)
|
|
|
|
"mojoal"
|
|
|
|
];
|
2021-02-06 00:14:31 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-06-24 16:54:22 +00:00
|
|
|
|
2019-04-21 16:56:28 +00:00
|
|
|
pname = "supertuxkart";
|
2022-11-11 22:08:22 +00:00
|
|
|
version = "1.4";
|
2018-01-19 15:05:41 +00:00
|
|
|
|
2020-06-24 16:54:22 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-02-06 00:14:31 +00:00
|
|
|
owner = "supertuxkart";
|
|
|
|
repo = "stk-code";
|
|
|
|
rev = version;
|
2022-11-11 22:08:22 +00:00
|
|
|
hash = "sha256-gqdaVvgNfCN40ZO/9y8+vTeIJPSq6udKxYZ/MAi4ZMM=";
|
2020-06-24 16:54:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-05-16 20:24:34 +00:00
|
|
|
# Deletes all bundled libs in stk-code/lib except those
|
|
|
|
# That couldn't be replaced with system packages
|
2020-06-24 16:54:22 +00:00
|
|
|
find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {}
|
2021-05-16 20:24:34 +00:00
|
|
|
|
|
|
|
# Allow building with system-installed wiiuse on Darwin
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace 'NOT (APPLE OR HAIKU)) AND USE_SYSTEM_WIIUSE' 'NOT (HAIKU)) AND USE_SYSTEM_WIIUSE'
|
2020-06-24 16:54:22 +00:00
|
|
|
'';
|
2017-01-21 06:15:00 +00:00
|
|
|
|
2021-10-07 06:30:10 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
makeWrapper
|
|
|
|
];
|
2018-01-19 15:05:41 +00:00
|
|
|
|
2008-10-12 14:28:51 +00:00
|
|
|
buildInputs = [
|
2022-11-11 22:08:22 +00:00
|
|
|
shaderc
|
2021-02-06 00:14:31 +00:00
|
|
|
SDL2
|
|
|
|
glew
|
|
|
|
libvorbis
|
|
|
|
libogg
|
|
|
|
freetype
|
|
|
|
curl
|
|
|
|
libjpeg
|
|
|
|
libpng
|
|
|
|
harfbuzz
|
|
|
|
mcpp
|
|
|
|
wiiuse
|
2021-10-07 06:30:10 +00:00
|
|
|
angelscript
|
|
|
|
sqlite
|
2021-05-07 19:04:07 +00:00
|
|
|
]
|
2021-10-07 06:30:10 +00:00
|
|
|
++ lib.optional (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) libopenglrecorder
|
2021-05-16 20:24:34 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isLinux openal
|
2023-07-18 15:45:57 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenAL IOKit Cocoa IOBluetooth libsamplerate ];
|
2019-03-06 20:22:55 +00:00
|
|
|
|
2018-01-19 15:05:41 +00:00
|
|
|
cmakeFlags = [
|
2021-10-07 06:30:10 +00:00
|
|
|
"-DBUILD_RECORDER=${if (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) then "ON" else "OFF"}"
|
|
|
|
"-DUSE_SYSTEM_ANGELSCRIPT=ON"
|
2020-05-04 20:56:39 +00:00
|
|
|
"-DCHECK_ASSETS=OFF"
|
2020-06-24 16:54:22 +00:00
|
|
|
"-DUSE_SYSTEM_WIIUSE=ON"
|
2020-12-14 19:21:47 +00:00
|
|
|
"-DOpenGL_GL_PREFERENCE=GLVND"
|
2018-01-19 15:05:41 +00:00
|
|
|
];
|
|
|
|
|
2024-01-09 20:57:56 +00:00
|
|
|
CXXFLAGS = [
|
|
|
|
# GCC 13: error: 'snprintf' was not declared in this scope
|
|
|
|
"-include cstdio"
|
|
|
|
# GCC 13: error: 'runtime_error' is not a member of 'std'
|
|
|
|
"-include stdexcept"
|
|
|
|
];
|
|
|
|
|
2021-05-16 20:24:34 +00:00
|
|
|
# Extract binary from built app bundle
|
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
mkdir $out/bin
|
|
|
|
mv $out/{supertuxkart.app/Contents/MacOS,bin}/supertuxkart
|
|
|
|
rm -rf $out/supertuxkart.app
|
|
|
|
'';
|
|
|
|
|
2020-05-04 20:56:39 +00:00
|
|
|
# Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
|
|
|
|
preFixup = ''
|
2021-05-16 20:24:34 +00:00
|
|
|
wrapProgram $out/bin/supertuxkart \
|
|
|
|
--set-default SUPERTUXKART_ASSETS_DIR "${assets}" \
|
|
|
|
--set-default SUPERTUXKART_DATADIR "$out/share/supertuxkart" \
|
2020-05-04 20:56:39 +00:00
|
|
|
'';
|
|
|
|
|
2020-06-24 16:54:22 +00:00
|
|
|
meta = with lib; {
|
2015-04-30 15:05:14 +00:00
|
|
|
description = "Free 3D kart racing game";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "supertuxkart";
|
2008-10-12 14:28:51 +00:00
|
|
|
longDescription = ''
|
|
|
|
SuperTuxKart is a Free 3D kart racing game, with many tracks,
|
|
|
|
characters and items for you to try, similar in spirit to Mario
|
|
|
|
Kart.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://supertuxkart.net/";
|
2017-01-21 06:15:00 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2019-12-05 07:29:48 +00:00
|
|
|
maintainers = with maintainers; [ pyrolagus peterhoeg ];
|
2021-05-16 20:24:34 +00:00
|
|
|
platforms = with platforms; unix;
|
2021-02-10 14:42:02 +00:00
|
|
|
changelog = "https://github.com/supertuxkart/stk-code/blob/${version}/CHANGELOG.md";
|
2008-10-12 14:28:51 +00:00
|
|
|
};
|
|
|
|
}
|