diff options
Diffstat (limited to 'pkgs/games/cataclysm-dda/default.nix')
-rw-r--r-- | pkgs/games/cataclysm-dda/default.nix | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix index b46114ec62b..550d557e57e 100644 --- a/pkgs/games/cataclysm-dda/default.nix +++ b/pkgs/games/cataclysm-dda/default.nix @@ -1,5 +1,5 @@ { fetchFromGitHub, stdenv, makeWrapper, pkgconfig, ncurses, lua, SDL2, SDL2_image, SDL2_ttf, -SDL2_mixer, freetype, gettext }: +SDL2_mixer, freetype, gettext, Cocoa, libicns }: stdenv.mkDerivation rec { version = "0.C"; @@ -12,9 +12,13 @@ stdenv.mkDerivation rec { sha256 = "03sdzsk4qdq99qckq0axbsvg1apn6xizscd8pwp5w6kq2fyj5xkv"; }; - nativeBuildInputs = [ makeWrapper pkgconfig ]; + nativeBuildInputs = [ makeWrapper pkgconfig ] + ++ stdenv.lib.optionals stdenv.isDarwin [ libicns ]; - buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]; + buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ] + ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ]; + + patches = [ ./patches/fix_locale_dir.patch ]; postPatch = '' patchShebangs . @@ -26,11 +30,32 @@ stdenv.mkDerivation rec { -i src/{crafting,skill,weather_data,melee,vehicle,overmap,iuse_actor}.cpp ''; - makeFlags = "PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1"; + makeFlags = [ + "PREFIX=$(out) LUA=1 TILES=1 SOUND=1 RELEASE=1 USE_HOME_DIR=1" + ] ++ stdenv.lib.optionals stdenv.isDarwin [ + "NATIVE=osx CLANG=1" + "OSX_MIN=10.6" # SDL for macOS only supports deploying on 10.6 and above + ]; + + postBuild = stdenv.lib.optionalString stdenv.isDarwin '' + # iconutil on macOS is not available in nixpkgs + png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/* + ''; postInstall = '' wrapProgram $out/bin/cataclysm-tiles \ --add-flags "--datadir $out/share/" + '' + stdenv.lib.optionalString stdenv.isDarwin '' + app=$out/Applications/Cataclysm.app + install -D -m 444 data/osx/Info.plist -t $app/Contents + install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources + mkdir $app/Contents/MacOS + launcher=$app/Contents/MacOS/Cataclysm.sh + cat << SCRIPT > $launcher + #!/bin/sh + $out/bin/cataclysm-tiles + SCRIPT + chmod 555 $launcher ''; # Disable, possible problems with hydra @@ -64,6 +89,6 @@ stdenv.mkDerivation rec { homepage = http://en.cataclysmdda.com/; license = licenses.cc-by-sa-30; maintainers = [ maintainers.skeidel ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } |