From d8dec0a2332a66e940a876d44c06da044e9c5a76 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Nakamura Date: Fri, 3 May 2019 01:29:07 +0900 Subject: [PATCH 1/4] cataclysm-dda: 0.C -> 0.D --- pkgs/games/cataclysm-dda/default.nix | 38 +++++++------------ .../patches/fix_locale_dir.patch | 22 +++++------ pkgs/top-level/all-packages.nix | 3 +- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix index 3ddac8f3fc7a..0fac78829c06 100644 --- a/pkgs/games/cataclysm-dda/default.nix +++ b/pkgs/games/cataclysm-dda/default.nix @@ -1,47 +1,37 @@ -{ stdenv, callPackage, ncurses -, tiles ? true, Cocoa, libicns +{ stdenv, callPackage, CoreFoundation +, tiles ? true, Cocoa , debug ? false }: let inherit (stdenv.lib) optionals optionalString; inherit (callPackage ./common.nix { inherit tiles Cocoa debug; }) common utils; - inherit (utils) fetchFromCleverRaven installMacOSAppLauncher; + inherit (utils) fetchFromCleverRaven installXDGAppLauncher installMacOSAppLauncher; in stdenv.mkDerivation (common // rec { - version = "0.C"; + version = "0.D"; name = "cataclysm-dda-${version}"; src = fetchFromCleverRaven { rev = "${version}"; - sha256 = "03sdzsk4qdq99qckq0axbsvg1apn6xizscd8pwp5w6kq2fyj5xkv"; + sha256 = "00zzhx1mh1qjq668cga5nbrxp2qk6b82j5ak65skhgnlr6ii4ysc"; }; - nativeBuildInputs = common.nativeBuildInputs - ++ optionals (tiles && stdenv.isDarwin) [ libicns ]; + buildInputs = common.buildInputs + ++ optionals stdenv.isDarwin [ CoreFoundation ]; patches = [ ./patches/fix_locale_dir.patch ]; - makeFlags = common.makeFlags - ++ optionals stdenv.isDarwin [ - "OSX_MIN=10.6" # SDL for macOS only supports deploying on 10.6 and above - ] ++ optionals stdenv.cc.isGNU [ - "WARNINGS+=-Wno-deprecated-declarations" - "WARNINGS+=-Wno-ignored-attributes" - ] ++ optionals stdenv.cc.isClang [ - "WARNINGS+=-Wno-inconsistent-missing-override" - ]; - - NIX_CFLAGS_COMPILE = optionalString stdenv.cc.isClang "-Wno-user-defined-warnings"; - - postBuild = optionalString (tiles && stdenv.isDarwin) '' - # iconutil on macOS is not available in nixpkgs - png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/* + postPatch = common.postPatch + '' + substituteInPlace lua/autoexec.lua --replace "/usr/share" "$out/share" ''; - postInstall = optionalString (tiles && stdenv.isDarwin) - installMacOSAppLauncher; + postInstall = optionalString tiles + ( if !stdenv.isDarwin + then installXDGAppLauncher + else installMacOSAppLauncher + ); # Disable, possible problems with hydra #enableParallelBuilding = true; diff --git a/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch b/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch index 775a8ec6007d..60a3dc457453 100644 --- a/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch +++ b/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch @@ -1,20 +1,20 @@ diff --git a/src/translations.cpp b/src/translations.cpp -index 6520cfe..49f7b2c 100644 +index 2585b7ec56..7bb005823c 100644 --- a/src/translations.cpp +++ b/src/translations.cpp -@@ -72,15 +72,11 @@ void set_language(bool reload_options) - - // Step 2. Bind to gettext domain. - const char *locale_dir; --#ifdef __linux__ - if (!FILENAMES["base_path"].empty()) { - locale_dir = std::string(FILENAMES["base_path"] + "share/locale").c_str(); +@@ -195,14 +195,12 @@ void set_language() + auto env = getenv( "LANGUAGE" ); + locale_dir = std::string( FILENAMES["base_path"] + "lang/mo/" + ( env ? env : "none" ) + + "/LC_MESSAGES/cataclysm-dda.mo" ); +-#elif (defined __linux__ || (defined MACOSX && !defined TILES)) ++#else + if( !FILENAMES["base_path"].empty() ) { + locale_dir = FILENAMES["base_path"] + "share/locale"; } else { locale_dir = "lang/mo"; } -#else - locale_dir = "lang/mo"; --#endif // __linux__ + #endif - bindtextdomain("cataclysm-dda", locale_dir); - bind_textdomain_codeset("cataclysm-dda", "UTF-8"); + const char *locale_dir_char = locale_dir.c_str(); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ea43db314a95..13a86b44b911 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21008,8 +21008,7 @@ in }; cataclysm-dda = callPackage ../games/cataclysm-dda { - inherit (darwin.apple_sdk.frameworks) Cocoa; - ncurses = ncurses5; + inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa; }; cataclysm-dda-git = callPackage ../games/cataclysm-dda/git.nix { From 520dd5d71e1ccd50d6ef439c1dccbe3d53b6a5eb Mon Sep 17 00:00:00 2001 From: Mitsuhiro Nakamura Date: Fri, 3 May 2019 01:40:17 +0900 Subject: [PATCH 2/4] cataclysm-dda-git: 2018-07-15 -> 2019-05-03 --- pkgs/games/cataclysm-dda/git.nix | 10 +++++----- .../patches/fix_locale_dir_git.patch | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkgs/games/cataclysm-dda/git.nix b/pkgs/games/cataclysm-dda/git.nix index c8f031d31942..189372547ce4 100644 --- a/pkgs/games/cataclysm-dda/git.nix +++ b/pkgs/games/cataclysm-dda/git.nix @@ -1,5 +1,5 @@ -{ stdenv, callPackage -, tiles ? true, Cocoa, CoreFoundation +{ stdenv, callPackage, CoreFoundation +, tiles ? true, Cocoa , debug ? false }: @@ -10,12 +10,12 @@ let in stdenv.mkDerivation (common // rec { - version = "2018-07-15"; + version = "2019-05-03"; name = "cataclysm-dda-git-${version}"; src = fetchFromCleverRaven { - rev = "e1e5d81"; - sha256 = "198wfj8l1p8xlwicj92cq237pzv2ha9pcf240y7ijhjpmlc9jkr1"; + rev = "65a05026e7306b5d1228dc6ed885c43447f128b5"; + sha256 = "18yn0h6b4j9lx67sq1d886la3l6l7bqsnwj6mw2khidssiy18y0n"; }; buildInputs = common.buildInputs diff --git a/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch b/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch index c3140af03c8b..1b92c8816614 100644 --- a/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch +++ b/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch @@ -1,12 +1,13 @@ diff --git a/src/translations.cpp b/src/translations.cpp -index 3a86291..e6c5f84 100644 +index 0068a35785..c8034cbeac 100644 --- a/src/translations.cpp +++ b/src/translations.cpp -@@ -176,15 +176,11 @@ void set_language() - - // Step 2. Bind to gettext domain. - std::string locale_dir; --#if (defined __linux__ || (defined MACOSX && !defined TILES)) +@@ -202,14 +202,12 @@ void set_language() + auto env = getenv( "LANGUAGE" ); + locale_dir = std::string( FILENAMES["base_path"] + "lang/mo/" + ( env ? env : "none" ) + + "/LC_MESSAGES/cataclysm-dda.mo" ); +-#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES))) ++#else if( !FILENAMES["base_path"].empty() ) { locale_dir = FILENAMES["base_path"] + "share/locale"; } else { @@ -14,7 +15,6 @@ index 3a86291..e6c5f84 100644 } -#else - locale_dir = "lang/mo"; --#endif // __linux__ + #endif const char *locale_dir_char = locale_dir.c_str(); - bindtextdomain( "cataclysm-dda", locale_dir_char ); From c2987f1ba88812911204574969785ca964118c5e Mon Sep 17 00:00:00 2001 From: Mitsuhiro Nakamura Date: Fri, 3 May 2019 01:50:40 +0900 Subject: [PATCH 3/4] 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 ]; }; From f7dacc3ae239155420339bb6dac52967e1ffb0a0 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Nakamura Date: Fri, 3 May 2019 17:00:23 +0900 Subject: [PATCH 4/4] cataclysm-dda-git: remove obsolete lua dependency --- pkgs/games/cataclysm-dda/common.nix | 6 +++--- pkgs/games/cataclysm-dda/default.nix | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix index 5c2d94b3c0c0..3a7b410a04bd 100644 --- a/pkgs/games/cataclysm-dda/common.nix +++ b/pkgs/games/cataclysm-dda/common.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, pkgconfig, gettext, lua, ncurses, CoreFoundation +{ stdenv, fetchFromGitHub, pkgconfig, gettext, ncurses, CoreFoundation , tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa , debug, runtimeShell }: @@ -6,7 +6,7 @@ let inherit (stdenv.lib) optionals optionalString; - cursesDeps = [ gettext lua ncurses ] + cursesDeps = [ gettext ncurses ] ++ optionals stdenv.isDarwin [ CoreFoundation ]; tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ] @@ -22,7 +22,7 @@ let ''; makeFlags = [ - "PREFIX=$(out)" "LUA=1" "USE_HOME_DIR=1" "LANGUAGES=all" + "PREFIX=$(out)" "USE_HOME_DIR=1" "LANGUAGES=all" ] ++ optionals (!debug) [ "RELEASE=1" ] ++ optionals tiles [ diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix index 30e82b0e4829..84a70c275a2f 100644 --- a/pkgs/games/cataclysm-dda/default.nix +++ b/pkgs/games/cataclysm-dda/default.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, CoreFoundation +{ stdenv, callPackage, lua, CoreFoundation , tiles ? true, Cocoa , debug ? false }: @@ -17,12 +17,18 @@ stdenv.mkDerivation (common // rec { sha256 = "00zzhx1mh1qjq668cga5nbrxp2qk6b82j5ak65skhgnlr6ii4ysc"; }; + buildInputs = common.buildInputs ++ [ lua ]; + patches = [ ./patches/fix_locale_dir.patch ]; postPatch = common.postPatch + '' substituteInPlace lua/autoexec.lua --replace "/usr/share" "$out/share" ''; + makeFlags = common.makeFlags ++ [ + "LUA=1" + ]; + meta = with stdenv.lib.maintainers; common.meta // { maintainers = common.meta.maintainers ++ [ skeidel ]; };