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.
This commit is contained in:
parent
d6863de058
commit
bf71f12cb5
|
@ -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 = [
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
|
|
|
@ -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}"
|
||||
];
|
||||
|
|
|
@ -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();
|
|
@ -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();
|
Loading…
Reference in New Issue