Merge pull request #186521 from DeeUnderscore/fix/cataclysm-dda-locale-paths

This commit is contained in:
Sandro 2022-08-17 14:25:05 +02:00 committed by GitHub
commit be2b7afc99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 6 deletions

View File

@ -40,12 +40,7 @@ stdenv.mkDerivation {
buildInputs = cursesDeps ++ optionals tiles tilesDeps; buildInputs = cursesDeps ++ optionals tiles tilesDeps;
postPatch = '' postPatch = ''
patchShebangs . patchShebangs lang/compile_mo.sh
# 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 = [ makeFlags = [

View File

@ -0,0 +1,20 @@
diff --git a/src/translations.cpp b/src/translations.cpp
index fa0ee479b2..0e470098dc 100644
--- a/src/translations.cpp
+++ b/src/translations.cpp
@@ -141,15 +141,11 @@ void select_language()
std::string locale_dir()
{
std::string loc_dir;
-#if !defined(__ANDROID__) && ((defined(__linux__) || defined(BSD) || (defined(MACOSX) && !defined(TILES))))
if( !PATH_INFO::base_path().empty() ) {
loc_dir = PATH_INFO::base_path() + "share/locale";
} else {
loc_dir = PATH_INFO::langdir();
}
-#else
- loc_dir = PATH_INFO::langdir();
-#endif
return loc_dir;
}

View File

@ -19,6 +19,11 @@ let
sha256 = "sha256-2su1uQaWl9WG41207dRvOTdVKcQsEz/y0uTi9JX52uI="; sha256 = "sha256-2su1uQaWl9WG41207dRvOTdVKcQsEz/y0uTi9JX52uI=";
}; };
patches = [
# Unconditionally look for translation files in $out/share/locale
./locale-path-stable.patch
];
makeFlags = common.makeFlags ++ [ makeFlags = common.makeFlags ++ [
# Makefile declares version as 0.F, with no minor release number # Makefile declares version as 0.F, with no minor release number
"VERSION=${version}" "VERSION=${version}"