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;
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@'
patchShebangs lang/compile_mo.sh
'';
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=";
};
patches = [
# Unconditionally look for translation files in $out/share/locale
./locale-path-stable.patch
];
makeFlags = common.makeFlags ++ [
# Makefile declares version as 0.F, with no minor release number
"VERSION=${version}"