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 , tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa
, debug, runtimeShell , debug
}: }:
let let
@ -12,7 +12,28 @@ let
tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ] tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ]
++ optionals stdenv.isDarwin [ Cocoa ]; ++ 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"; pname = "cataclysm-dda";
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
@ -40,8 +61,8 @@ let
postInstall = optionalString tiles postInstall = optionalString tiles
( if !stdenv.isDarwin ( if !stdenv.isDarwin
then utils.installXDGAppLauncher then installXDGAppLauncher
else utils.installMacOSAppLauncher else installMacOSAppLauncher
); );
dontStrip = debug; dontStrip = debug;
@ -86,29 +107,4 @@ let
maintainers = with maintainers; [ mnacamura ]; maintainers = with maintainers; [ mnacamura ];
platforms = platforms.unix; 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 let
common = callPackage ./common.nix { common = callPackage ./common.nix {
inherit tiles CoreFoundation Cocoa debug; inherit CoreFoundation tiles Cocoa debug;
}; };
self = common.overrideAttrs (common: rec { self = common.overrideAttrs (common: rec {
@ -28,8 +28,9 @@ let
withMods = wrapCDDA self; withMods = wrapCDDA self;
}; };
meta = with lib.maintainers; common.meta // { meta = common.meta // {
maintainers = common.meta.maintainers ++ [ rardiol ]; maintainers = with lib.maintainers;
common.meta.maintainers ++ [ rardiol ];
}; };
}); });
in in

View File

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