void-packages/srcpkgs/supertux2/patches/locale.patch
Đoàn Trần Công Danh 4b97cd2fb4 srcpkgs/s*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

36 lines
1.2 KiB
Diff

commit 4380f504fbd51aa9ef7eb222b0bced481402fa7d
Author: Érico Rolim <erico.erc@gmail.com>
Date: Wed Dec 9 16:22:22 2020 -0300
supertux/main: add try-catch for locale initialization.
Fixes #1564.
diff --git src/supertux/main.cpp src/supertux/main.cpp
index ad5e3fde6..c33627e18 100644
--- a/src/supertux/main.cpp
+++ b/src/supertux/main.cpp
@@ -563,10 +563,19 @@ Main::run(int argc, char** argv)
_wfreopen(w_errpath.c_str(), L"a", stderr);
#endif
- // Create and install global locale
- std::locale::global(boost::locale::generator().generate(""));
- // Make boost.filesystem use it
- boost::filesystem::path::imbue(std::locale());
+ // Create and install global locale - this can fail on some setups:
+ // - with bad LANG values
+ // - targets where libstdc++ uses its generic locales code (https://gcc.gnu.org/legacy-ml/libstdc++/2003-02/msg00345.html)
+ try
+ {
+ std::locale::global(boost::locale::generator().generate(""));
+ // Make boost.filesystem use it
+ boost::filesystem::path::imbue(std::locale());
+ }
+ catch(const std::runtime_error& err)
+ {
+ std::cout << "Warning: " << err.what() << std::endl;
+ }
int result = 0;