From c2987f1ba88812911204574969785ca964118c5e Mon Sep 17 00:00:00 2001 From: Mitsuhiro Nakamura Date: Fri, 3 May 2019 01:50:40 +0900 Subject: [PATCH] cataclysm-dda{,-git}: refactoring --- pkgs/games/cataclysm-dda/common.nix | 18 +++++++++++++++--- pkgs/games/cataclysm-dda/default.nix | 17 ++--------------- pkgs/games/cataclysm-dda/git.nix | 20 +++----------------- 3 files changed, 20 insertions(+), 35 deletions(-) diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix index b39eb987e00d..5c2d94b3c0c0 100644 --- a/pkgs/games/cataclysm-dda/common.nix +++ b/pkgs/games/cataclysm-dda/common.nix @@ -1,12 +1,13 @@ -{ stdenv, fetchFromGitHub, pkgconfig, gettext, lua, ncurses +{ stdenv, fetchFromGitHub, pkgconfig, gettext, lua, ncurses, CoreFoundation , tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa , debug, runtimeShell }: let - inherit (stdenv.lib) optionals; + inherit (stdenv.lib) optionals optionalString; - cursesDeps = [ gettext lua ncurses ]; + cursesDeps = [ gettext lua ncurses ] + ++ optionals stdenv.isDarwin [ CoreFoundation ]; tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ] ++ optionals stdenv.isDarwin [ Cocoa ]; @@ -30,8 +31,19 @@ let "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; + meta = with stdenv.lib; { description = "A free, post apocalyptic, zombie infested rogue-like"; longDescription = '' diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix index 0fac78829c06..30e82b0e4829 100644 --- a/pkgs/games/cataclysm-dda/default.nix +++ b/pkgs/games/cataclysm-dda/default.nix @@ -4,9 +4,8 @@ }: let - inherit (stdenv.lib) optionals optionalString; - inherit (callPackage ./common.nix { inherit tiles Cocoa debug; }) common utils; - inherit (utils) fetchFromCleverRaven installXDGAppLauncher installMacOSAppLauncher; + inherit (callPackage ./common.nix { inherit tiles CoreFoundation Cocoa debug; }) common utils; + inherit (utils) fetchFromCleverRaven; in stdenv.mkDerivation (common // rec { @@ -18,24 +17,12 @@ stdenv.mkDerivation (common // rec { sha256 = "00zzhx1mh1qjq668cga5nbrxp2qk6b82j5ak65skhgnlr6ii4ysc"; }; - buildInputs = common.buildInputs - ++ optionals stdenv.isDarwin [ CoreFoundation ]; - patches = [ ./patches/fix_locale_dir.patch ]; postPatch = common.postPatch + '' substituteInPlace lua/autoexec.lua --replace "/usr/share" "$out/share" ''; - postInstall = optionalString tiles - ( if !stdenv.isDarwin - then installXDGAppLauncher - else installMacOSAppLauncher - ); - - # Disable, possible problems with hydra - #enableParallelBuilding = true; - meta = with stdenv.lib.maintainers; common.meta // { maintainers = common.meta.maintainers ++ [ skeidel ]; }; diff --git a/pkgs/games/cataclysm-dda/git.nix b/pkgs/games/cataclysm-dda/git.nix index 189372547ce4..b872e95d5896 100644 --- a/pkgs/games/cataclysm-dda/git.nix +++ b/pkgs/games/cataclysm-dda/git.nix @@ -4,9 +4,9 @@ }: let - inherit (stdenv.lib) optionals optionalString substring; - inherit (callPackage ./common.nix { inherit tiles Cocoa debug; }) common utils; - inherit (utils) fetchFromCleverRaven installXDGAppLauncher installMacOSAppLauncher; + inherit (stdenv.lib) substring; + inherit (callPackage ./common.nix { inherit tiles CoreFoundation Cocoa debug; }) common utils; + inherit (utils) fetchFromCleverRaven; in stdenv.mkDerivation (common // rec { @@ -18,26 +18,12 @@ stdenv.mkDerivation (common // rec { sha256 = "18yn0h6b4j9lx67sq1d886la3l6l7bqsnwj6mw2khidssiy18y0n"; }; - buildInputs = common.buildInputs - ++ optionals stdenv.isDarwin [ CoreFoundation ]; - patches = [ ./patches/fix_locale_dir_git.patch ]; makeFlags = common.makeFlags ++ [ "VERSION=git-${version}-${substring 0 8 src.rev}" ]; - postInstall = optionalString tiles - ( if !stdenv.isDarwin - then installXDGAppLauncher - else installMacOSAppLauncher - ); - - # 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; - meta = with stdenv.lib.maintainers; common.meta // { maintainers = common.meta.maintainers ++ [ rardiol ]; };