From de56294e578096f6daba3cff214af5d23ac8865e Mon Sep 17 00:00:00 2001 From: Mitsuhiro Nakamura Date: Thu, 9 Apr 2020 16:11:51 +0900 Subject: cataclysm-dda{,-git}: clean up --- pkgs/games/cataclysm-dda/common.nix | 182 ++++++++++++++++++------------------ pkgs/games/cataclysm-dda/git.nix | 7 +- pkgs/games/cataclysm-dda/stable.nix | 7 +- 3 files changed, 97 insertions(+), 99 deletions(-) (limited to 'pkgs/games/cataclysm-dda') diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix index 3cbda9479070..6948db097ae2 100644 --- a/pkgs/games/cataclysm-dda/common.nix +++ b/pkgs/games/cataclysm-dda/common.nix @@ -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,103 +12,99 @@ let tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ] ++ optionals stdenv.isDarwin [ Cocoa ]; - common = stdenv.mkDerivation { - pname = "cataclysm-dda"; + 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 - nativeBuildInputs = [ pkgconfig ]; +stdenv.mkDerivation { + pname = "cataclysm-dda"; - buildInputs = cursesDeps ++ optionals tiles tilesDeps; + nativeBuildInputs = [ pkgconfig ]; - postPatch = '' - patchShebangs . + buildInputs = cursesDeps ++ optionals tiles tilesDeps; - # Locale patch required for Darwin builds, see: - # https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970 - sed -i src/translations.cpp \ - -e 's@#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))@#elif 1@' - ''; + postPatch = '' + patchShebangs . - makeFlags = [ - "PREFIX=$(out)" "USE_HOME_DIR=1" "LANGUAGES=all" - ] ++ optionals (!debug) [ - "RELEASE=1" - ] ++ optionals tiles [ - "TILES=1" "SOUND=1" - ] ++ optionals stdenv.isDarwin [ - "NATIVE=osx" "CLANG=1" - ]; - - postInstall = optionalString tiles - ( if !stdenv.isDarwin - then utils.installXDGAppLauncher - else utils.installMacOSAppLauncher - ); - - dontStrip = debug; - - # https://hydra.nixos.org/build/65193254 - # src/weather_data.cpp:203:1: fatal error: opening dependency file obj/tiles/weather_data.d: No such file or directory - # make: *** [Makefile:687: obj/tiles/weather_data.o] Error 1 - enableParallelBuilding = false; - - passthru = { - isTiles = tiles; - isCurses = !tiles; - }; - - meta = with stdenv.lib; { - description = "A free, post apocalyptic, zombie infested rogue-like"; - longDescription = '' - Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world. - Surviving is difficult: you have been thrown, ill-equipped, into a - landscape now riddled with monstrosities of which flesh eating zombies are - neither the strangest nor the deadliest. - - Yet with care and a little luck, many things are possible. You may try to - eke out an existence in the forests silently executing threats and - providing sustenance with your longbow. You can ride into town in a - jerry-rigged vehicle, all guns blazing, to settle matters in a fug of - smoke from your molotovs. You could take a more measured approach and - construct an impregnable fortress, surrounded by traps to protect you from - the horrors without. The longer you survive, the more skilled and adapted - you will get and the better equipped and armed to deal with the threats - you are presented with. - - In the course of your ordeal there will be opportunities and temptations - to improve or change your very nature. There are tales of survivors fitted - with extraordinary cybernetics giving great power and stories too of - gravely mutated survivors who, warped by their ingestion of exotic - substances or radiation, now more closely resemble insects, birds or fish - than their original form. - ''; - homepage = "https://cataclysmdda.org/"; - license = licenses.cc-by-sa-30; - maintainers = with maintainers; [ mnacamura ]; - platforms = platforms.unix; - }; - }; + # Locale patch required for Darwin builds, see: + # https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970 + sed -i src/translations.cpp \ + -e 's@#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))@#elif 1@' + ''; - 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 - ''; + makeFlags = [ + "PREFIX=$(out)" "USE_HOME_DIR=1" "LANGUAGES=all" + ] ++ optionals (!debug) [ + "RELEASE=1" + ] ++ optionals tiles [ + "TILES=1" "SOUND=1" + ] ++ optionals stdenv.isDarwin [ + "NATIVE=osx" "CLANG=1" + ]; - 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 - ''; + postInstall = optionalString tiles + ( if !stdenv.isDarwin + then installXDGAppLauncher + else installMacOSAppLauncher + ); + + dontStrip = debug; + + # https://hydra.nixos.org/build/65193254 + # src/weather_data.cpp:203:1: fatal error: opening dependency file obj/tiles/weather_data.d: No such file or directory + # make: *** [Makefile:687: obj/tiles/weather_data.o] Error 1 + enableParallelBuilding = false; + + passthru = { + isTiles = tiles; + isCurses = !tiles; }; -in -common + meta = with stdenv.lib; { + description = "A free, post apocalyptic, zombie infested rogue-like"; + longDescription = '' + Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world. + Surviving is difficult: you have been thrown, ill-equipped, into a + landscape now riddled with monstrosities of which flesh eating zombies are + neither the strangest nor the deadliest. + + Yet with care and a little luck, many things are possible. You may try to + eke out an existence in the forests silently executing threats and + providing sustenance with your longbow. You can ride into town in a + jerry-rigged vehicle, all guns blazing, to settle matters in a fug of + smoke from your molotovs. You could take a more measured approach and + construct an impregnable fortress, surrounded by traps to protect you from + the horrors without. The longer you survive, the more skilled and adapted + you will get and the better equipped and armed to deal with the threats + you are presented with. + + In the course of your ordeal there will be opportunities and temptations + to improve or change your very nature. There are tales of survivors fitted + with extraordinary cybernetics giving great power and stories too of + gravely mutated survivors who, warped by their ingestion of exotic + substances or radiation, now more closely resemble insects, birds or fish + than their original form. + ''; + homepage = "https://cataclysmdda.org/"; + license = licenses.cc-by-sa-30; + maintainers = with maintainers; [ mnacamura ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/games/cataclysm-dda/git.nix b/pkgs/games/cataclysm-dda/git.nix index 89af582b3c07..7b9228350049 100644 --- a/pkgs/games/cataclysm-dda/git.nix +++ b/pkgs/games/cataclysm-dda/git.nix @@ -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 diff --git a/pkgs/games/cataclysm-dda/stable.nix b/pkgs/games/cataclysm-dda/stable.nix index e142f67d190a..4176083b861c 100644 --- a/pkgs/games/cataclysm-dda/stable.nix +++ b/pkgs/games/cataclysm-dda/stable.nix @@ -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 -- cgit v1.2.3