diff options
author | Mitsuhiro Nakamura <m.nacamura@gmail.com> | 2020-04-08 10:54:28 +0900 |
---|---|---|
committer | Mitsuhiro Nakamura <m.nacamura@gmail.com> | 2020-07-18 14:21:12 +0900 |
commit | bf71f12cb5e9868d8427160d0680fde48c2316c2 (patch) | |
tree | 4520ff68aa171fbad2bcf26b0ea62efa1e774592 /pkgs/games/cataclysm-dda | |
parent | d6863de058d61a35bef6d6c9221171ed040fc075 (diff) |
cataclysm-dda{,-git}: apply locale patch dynamically
Each time src/translations.cpp is modified, we have to update the locale
patch. Using sed to patch dynamically should be handy.
Diffstat (limited to 'pkgs/games/cataclysm-dda')
-rw-r--r-- | pkgs/games/cataclysm-dda/common.nix | 5 | ||||
-rw-r--r-- | pkgs/games/cataclysm-dda/default.nix | 2 | ||||
-rw-r--r-- | pkgs/games/cataclysm-dda/git.nix | 5 | ||||
-rw-r--r-- | pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch | 18 | ||||
-rw-r--r-- | pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch | 20 |
5 files changed, 5 insertions, 45 deletions
diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix index bf071d62c67f..48941bdb01f6 100644 --- a/pkgs/games/cataclysm-dda/common.nix +++ b/pkgs/games/cataclysm-dda/common.nix @@ -21,6 +21,11 @@ let postPatch = '' patchShebangs . + + # 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@' ''; makeFlags = [ diff --git a/pkgs/games/cataclysm-dda/default.nix b/pkgs/games/cataclysm-dda/default.nix index 490e5a45ac0c..ed3fe7fdfc7a 100644 --- a/pkgs/games/cataclysm-dda/default.nix +++ b/pkgs/games/cataclysm-dda/default.nix @@ -16,8 +16,6 @@ stdenv.mkDerivation (common // rec { sha256 = "15l6w6lxays7qmsv0ci2ry53asb9an9dh7l7fc13256k085qcg68"; }; - patches = [ ./patches/fix_locale_dir.patch ]; - 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 d7b4bf4bde1d..8e803ed63dff 100644 --- a/pkgs/games/cataclysm-dda/git.nix +++ b/pkgs/games/cataclysm-dda/git.nix @@ -18,11 +18,6 @@ stdenv.mkDerivation (common // rec { sha256 = "0ww2q5gykxm802z1kffmnrfahjlx123j1gfszklpsv0b1fccm1ab"; }; - patches = [ - # Locale patch required for Darwin builds, see: https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970 - ./patches/fix_locale_dir_git.patch - ]; - makeFlags = common.makeFlags ++ [ "VERSION=git-${version}-${substring 0 8 src.rev}" ]; diff --git a/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch b/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch deleted file mode 100644 index 5bfff892d2af..000000000000 --- a/pkgs/games/cataclysm-dda/patches/fix_locale_dir.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/src/translations.cpp -+++ b/src/translations.cpp -@@ -212,14 +212,12 @@ void set_language() - auto env = getenv( "LANGUAGE" ); - locale_dir = std::string( PATH_INFO::base_path() + "lang/mo/" + ( env ? env : "none" ) + - "/LC_MESSAGES/cataclysm-dda.mo" ); --#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES))) -+#else - if( !PATH_INFO::base_path().empty() ) { - locale_dir = PATH_INFO::base_path() + "share/locale"; - } else { - locale_dir = "lang/mo"; - } --#else -- locale_dir = "lang/mo"; - #endif - - const char *locale_dir_char = locale_dir.c_str(); diff --git a/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch b/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch deleted file mode 100644 index 79b442ff5c99..000000000000 --- a/pkgs/games/cataclysm-dda/patches/fix_locale_dir_git.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/translations.cpp b/src/translations.cpp -index 067e2cd77d..5660d18b3d 100644 ---- a/src/translations.cpp -+++ b/src/translations.cpp -@@ -211,14 +211,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 - - const char *locale_dir_char = locale_dir.c_str(); |