3
0
Fork 0
forked from mirrors/nixpkgs

cataclysm-dda{,-git}: create app launcher on Darwin

This commit is contained in:
Mitsuhiro Nakamura 2018-01-22 12:19:27 +09:00
parent 728a13271e
commit 7287a9e91d
2 changed files with 30 additions and 2 deletions

View file

@ -1,5 +1,5 @@
{ fetchFromGitHub, stdenv, makeWrapper, pkgconfig, ncurses, lua, SDL2, SDL2_image, SDL2_ttf,
SDL2_mixer, freetype, gettext, Cocoa }:
SDL2_mixer, freetype, gettext, Cocoa, libicns }:
stdenv.mkDerivation rec {
version = "0.C";
@ -12,7 +12,8 @@ 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 ]
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
@ -34,9 +35,25 @@ stdenv.mkDerivation rec {
"OSX_MIN=10.6" # SDL for macOS only supports deploying on 10.6 and above
];
postBuild = ''
# 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

View file

@ -36,6 +36,17 @@ stdenv.mkDerivation rec {
postInstall = ''
wrapProgram $out/bin/cataclysm-tiles \
--add-flags "--datadir $out/share/cataclysm-dda/"
'' + 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
'';
# https://hydra.nixos.org/build/65193254