superTuxKart: Make Darwin-compatible

This commit is contained in:
OPNA2608 2021-05-16 22:24:34 +02:00
parent 7f56f38051
commit f2a29c1ee9
2 changed files with 26 additions and 11 deletions

View file

@ -9,18 +9,19 @@
, SDL2 , SDL2
, glew , glew
, openal , openal
, OpenAL
, libvorbis , libvorbis
, libogg , libogg
, curl , curl
, freetype , freetype
, bluez
, libjpeg , libjpeg
, libpng , libpng
, enet
, harfbuzz , harfbuzz
, mcpp , mcpp
, wiiuse , wiiuse
, angelscript , angelscript
, Cocoa
, IOKit
}: }:
let let
dir = "stk-code"; dir = "stk-code";
@ -82,10 +83,14 @@ stdenv.mkDerivation rec {
}) })
]; ];
# Deletes all bundled libs in stk-code/lib except those
# That couldn't be replaced with system packages
postPatch = '' postPatch = ''
# Deletes all bundled libs in stk-code/lib except those
# That couldn't be replaced with system packages
find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {} find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {}
# 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'
''; '';
nativeBuildInputs = [ cmake pkg-config makeWrapper ]; nativeBuildInputs = [ cmake pkg-config makeWrapper ];
@ -93,20 +98,19 @@ stdenv.mkDerivation rec {
buildInputs = [ buildInputs = [
SDL2 SDL2
glew glew
openal
libvorbis libvorbis
libogg libogg
freetype freetype
curl curl
bluez
libjpeg libjpeg
libpng libpng
enet
harfbuzz harfbuzz
mcpp mcpp
wiiuse wiiuse
] ]
++ lib.optional (!stdenv.hostPlatform.isAarch64) angelscript; ++ lib.optional (!stdenv.hostPlatform.isAarch64) angelscript
++ lib.optional stdenv.hostPlatform.isLinux openal
++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenAL IOKit Cocoa ];
cmakeFlags = [ cmakeFlags = [
"-DBUILD_RECORDER=OFF" # libopenglrecorder is not in nixpkgs "-DBUILD_RECORDER=OFF" # libopenglrecorder is not in nixpkgs
@ -117,9 +121,18 @@ stdenv.mkDerivation rec {
"-DOpenGL_GL_PREFERENCE=GLVND" "-DOpenGL_GL_PREFERENCE=GLVND"
]; ];
# 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
'';
# Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds # Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
preFixup = '' preFixup = ''
wrapProgram $out/bin/supertuxkart --set-default SUPERTUXKART_ASSETS_DIR "${assets}" wrapProgram $out/bin/supertuxkart \
--set-default SUPERTUXKART_ASSETS_DIR "${assets}" \
--set-default SUPERTUXKART_DATADIR "$out/share/supertuxkart" \
''; '';
meta = with lib; { meta = with lib; {
@ -132,7 +145,7 @@ stdenv.mkDerivation rec {
homepage = "https://supertuxkart.net/"; homepage = "https://supertuxkart.net/";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ pyrolagus peterhoeg ]; maintainers = with maintainers; [ pyrolagus peterhoeg ];
platforms = with platforms; linux; platforms = with platforms; unix;
changelog = "https://github.com/supertuxkart/stk-code/blob/${version}/CHANGELOG.md"; changelog = "https://github.com/supertuxkart/stk-code/blob/${version}/CHANGELOG.md";
}; };
} }

View file

@ -28502,7 +28502,9 @@ in
superTux = callPackage ../games/supertux { }; superTux = callPackage ../games/supertux { };
superTuxKart = callPackage ../games/super-tux-kart { }; superTuxKart = callPackage ../games/super-tux-kart {
inherit (darwin.apple_sdk.frameworks) Cocoa IOKit OpenAL;
};
synthv1 = libsForQt5.callPackage ../applications/audio/synthv1 { }; synthv1 = libsForQt5.callPackage ../applications/audio/synthv1 { };