aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNewbyte <newbie13xd@gmail.com>2021-12-03 09:46:13 +0100
committerAndy Postnikov <apostnikov@gmail.com>2021-12-03 20:19:21 +0000
commit2345b6cc3fbb6e63dca86ea31d9ac9481fcbc1df (patch)
treea639109b44d3ae4198cefa99ea17eaedc0205c52
parente4985814c5b09588d9c5d4a2e53611732893c916 (diff)
downloadaports-2345b6cc3fbb6e63dca86ea31d9ac9481fcbc1df.tar.gz
aports-2345b6cc3fbb6e63dca86ea31d9ac9481fcbc1df.tar.bz2
aports-2345b6cc3fbb6e63dca86ea31d9ac9481fcbc1df.tar.xz
community/supertux: fix crash on startup
This issue was fixed over a year ago, but there still hasn't been a new release, so let's backport this so people can play the game without having to manually set a different locale.
-rw-r--r--community/supertux/5f8f6e909b42367c677590e2d0464400dff375fd.patch49
-rw-r--r--community/supertux/APKBUILD10
2 files changed, 56 insertions, 3 deletions
diff --git a/community/supertux/5f8f6e909b42367c677590e2d0464400dff375fd.patch b/community/supertux/5f8f6e909b42367c677590e2d0464400dff375fd.patch
new file mode 100644
index 0000000000..9541cb941d
--- /dev/null
+++ b/community/supertux/5f8f6e909b42367c677590e2d0464400dff375fd.patch
@@ -0,0 +1,49 @@
+From 5f8f6e909b42367c677590e2d0464400dff375fd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
+Date: Wed, 9 Dec 2020 16:22:22 -0300
+Subject: [PATCH] supertux/main: add try-catch block around locale
+ initialization.
+
+Unfortunately, libstdc++'s locale implementation is platform specific
+(unlike libcxx, which has a single universal implementation), and its
+"generic" implementation, from 2003, claims to support only the "C"
+locale, and raises an exception if one tries to use a locale other than
+"C". We catch that exception and allow the application to proceed on
+such systems, even though it is very much not ideal.
+
+Also leave note for future code changes.
+
+Fixes #1564.
+---
+ src/supertux/main.cpp | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/src/supertux/main.cpp b/src/supertux/main.cpp
+index ad5e3fde69..efd655855b 100644
+--- a/src/supertux/main.cpp
++++ b/src/supertux/main.cpp
+@@ -563,10 +563,20 @@ 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 situations:
++ // - with bad values for env vars (LANG, LC_ALL, ...)
++ // - targets where libstdc++ uses its generic locales code (https://gcc.gnu.org/legacy-ml/libstdc++/2003-02/msg00345.html)
++ // NOTE: when moving to C++ >= 17, keep the try-catch block, but use std::locale:global(std::locale(""));
++ 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;
+
diff --git a/community/supertux/APKBUILD b/community/supertux/APKBUILD
index ecbf950bcb..14426740d5 100644
--- a/community/supertux/APKBUILD
+++ b/community/supertux/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: alpterry <alpterry@protonmail.com>
pkgname=supertux
pkgver=0.6.2
-pkgrel=3
+pkgrel=4
pkgdesc="Open-source classic 2D jump'n run sidescroller game"
url="https://www.supertux.org/"
arch="all !s390x !mips !mips64" # build fails
@@ -14,6 +14,7 @@ subpackages="$pkgname-doc $pkgname-data::noarch"
options="!check" # no test suite
source="https://github.com/SuperTux/supertux/releases/download/v$pkgver/SuperTux-v$pkgver-Source.tar.gz
missing-include-for-FLT_EPSILON.patch
+ 5f8f6e909b42367c677590e2d0464400dff375fd.patch
"
builddir="$srcdir/SuperTux-v$pkgver-Source"
@@ -44,5 +45,8 @@ data() {
mv "$pkgdir"/usr/share/games "$subpkgdir"/usr/share/games
}
-sha512sums="5baa783ee589b42a9bbce3740659dbb7b617ebfcc00c0a038c03d31b56700e3923c8548700ccebe42b325ca03bd85186bc5edef9f6580d93dc48d8aca88cbf74 SuperTux-v0.6.2-Source.tar.gz
-4e4116cb0dc7f996cdb96484eac99bd7f5a16829f6b082cc2e4c17b22e6e2f34501b8e3e4caf3c956369c5cd6caa12179b8a4cb1f93c2c8c8b014e3829272cb3 missing-include-for-FLT_EPSILON.patch"
+sha512sums="
+5baa783ee589b42a9bbce3740659dbb7b617ebfcc00c0a038c03d31b56700e3923c8548700ccebe42b325ca03bd85186bc5edef9f6580d93dc48d8aca88cbf74 SuperTux-v0.6.2-Source.tar.gz
+4e4116cb0dc7f996cdb96484eac99bd7f5a16829f6b082cc2e4c17b22e6e2f34501b8e3e4caf3c956369c5cd6caa12179b8a4cb1f93c2c8c8b014e3829272cb3 missing-include-for-FLT_EPSILON.patch
+2fa0d8336cc9c8379b24bfa564e202d178dad582ace1f375e9b0d2061c45d793f6a795d451db3f4f4e0ad351a479e1e10c004f2fa9c47f8674fb429b6701582f 5f8f6e909b42367c677590e2d0464400dff375fd.patch
+"