supertux2: fix locale on musl, remove -data subpackage.

Unless LANG was 'C', supertux2 would immediately abort when launched.

The data subpackage is no longer necessary.
This commit is contained in:
Érico Rolim 2020-12-09 16:24:11 -03:00 committed by Érico Nogueira Rolim
parent 665102eaa6
commit cbacb5711c
3 changed files with 38 additions and 10 deletions

View File

@ -1 +0,0 @@
supertux2

View File

@ -0,0 +1,36 @@
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
--- src/supertux/main.cpp
+++ 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;

View File

@ -1,7 +1,7 @@
# Template file for 'supertux2' # Template file for 'supertux2'
pkgname=supertux2 pkgname=supertux2
version=0.6.2 version=0.6.2
revision=2 revision=3
wrksrc="SuperTux-v${version}-Source" wrksrc="SuperTux-v${version}-Source"
build_style=cmake build_style=cmake
configure_args=" configure_args="
@ -12,17 +12,10 @@ configure_args="
hostmakedepends="pkg-config" hostmakedepends="pkg-config"
makedepends="SDL2_image-devel boost-devel glew-devel libcurl-devel makedepends="SDL2_image-devel boost-devel glew-devel libcurl-devel
libopenal-devel libraqm-devel physfs-devel" libopenal-devel libraqm-devel physfs-devel"
depends="supertux2-data"
short_desc="Side-scrolling platform game, milestone 2" short_desc="Side-scrolling platform game, milestone 2"
maintainer="beefcurtains <beefcurtains@voidlinux.org>" maintainer="beefcurtains <beefcurtains@voidlinux.org>"
license="GPL-3.0-or-later, GPL-2.0-or-later, CC-BY-SA-3.0, CC-BY-SA-4.0, CC-BY-3.0" license="GPL-3.0-or-later, GPL-2.0-or-later, CC-BY-SA-3.0, CC-BY-SA-4.0, CC-BY-3.0"
homepage="https://supertux.github.io/" homepage="https://supertux.github.io/"
distfiles="https://github.com/SuperTux/supertux/releases/download/v${version}/SuperTux-v${version}-Source.tar.gz" distfiles="https://github.com/SuperTux/supertux/releases/download/v${version}/SuperTux-v${version}-Source.tar.gz"
checksum=26a9e56ea2d284148849f3239177d777dda5b675a10ab2d76ee65854c91ff598 checksum=26a9e56ea2d284148849f3239177d777dda5b675a10ab2d76ee65854c91ff598
replaces="supertux2-data>=0"
supertux2-data_package() {
short_desc+=" - data files"
pkg_install() {
vmove usr/share/supertux2
}
}