cataclysm-dda{,-git}: clean up

This commit is contained in:
Mitsuhiro Nakamura 2020-04-09 16:11:51 +09:00
parent 90c265275f
commit de56294e57
3 changed files with 103 additions and 105 deletions

View File

@ -1,6 +1,6 @@
{ stdenv, pkgconfig, gettext, ncurses, CoreFoundation
{ stdenv, runtimeShell, pkgconfig, gettext, ncurses, CoreFoundation
, tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa
, debug, runtimeShell
, debug
}:
let
@ -12,7 +12,28 @@ let
tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ]
++ optionals stdenv.isDarwin [ Cocoa ];
common = stdenv.mkDerivation {
installXDGAppLauncher = ''
launcher="$out/share/applications/cataclysm-dda.desktop"
install -D -m 444 data/xdg/*cataclysm-dda.desktop -T "$launcher"
sed -i "$launcher" -e "s,\(Exec=\)\(cataclysm-tiles\),\1$out/bin/\2,"
install -D -m 444 data/xdg/cataclysm-dda.svg -t $out/share/icons/hicolor/scalable/apps
'';
installMacOSAppLauncher = ''
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 << EOF > $launcher
#!${runtimeShell}
$out/bin/cataclysm-tiles
EOF
chmod 555 $launcher
'';
in
stdenv.mkDerivation {
pname = "cataclysm-dda";
nativeBuildInputs = [ pkgconfig ];
@ -40,8 +61,8 @@ let
postInstall = optionalString tiles
( if !stdenv.isDarwin
then utils.installXDGAppLauncher
else utils.installMacOSAppLauncher
then installXDGAppLauncher
else installMacOSAppLauncher
);
dontStrip = debug;
@ -86,29 +107,4 @@ let
maintainers = with maintainers; [ mnacamura ];
platforms = platforms.unix;
};
};
utils = {
installXDGAppLauncher = ''
launcher="$out/share/applications/cataclysm-dda.desktop"
install -D -m 444 data/xdg/*cataclysm-dda.desktop -T "$launcher"
sed -i "$launcher" -e "s,\(Exec=\)\(cataclysm-tiles\),\1$out/bin/\2,"
install -D -m 444 data/xdg/cataclysm-dda.svg -t $out/share/icons/hicolor/scalable/apps
'';
installMacOSAppLauncher = ''
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 << EOF > $launcher
#!${runtimeShell}
$out/bin/cataclysm-tiles
EOF
chmod 555 $launcher
'';
};
in
common
}

View File

@ -5,7 +5,7 @@
let
common = callPackage ./common.nix {
inherit tiles CoreFoundation Cocoa debug;
inherit CoreFoundation tiles Cocoa debug;
};
self = common.overrideAttrs (common: rec {
@ -28,8 +28,9 @@ let
withMods = wrapCDDA self;
};
meta = with lib.maintainers; common.meta // {
maintainers = common.meta.maintainers ++ [ rardiol ];
meta = common.meta // {
maintainers = with lib.maintainers;
common.meta.maintainers ++ [ rardiol ];
};
});
in

View File

@ -5,7 +5,7 @@
let
common = callPackage ./common.nix {
inherit tiles CoreFoundation Cocoa debug;
inherit CoreFoundation tiles Cocoa debug;
};
self = common.overrideAttrs (common: rec {
@ -23,8 +23,9 @@ let
withMods = wrapCDDA self;
};
meta = with lib.maintainers; common.meta // {
maintainers = common.meta.maintainers ++ [ skeidel ];
meta = common.meta // {
maintainers = with lib.maintainers;
common.meta.maintainers ++ [ skeidel ];
};
});
in