summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2018-05-07 02:06:25 +0530
committerArun Isaac <arunisaac@systemreboot.net>2018-05-08 09:40:37 +0530
commite554d43dfcd4f9a3e34fc2d0ebca47b06f99b2fe (patch)
tree4d88104adf2b53828810eadca078f5e4b5248ce9 /gnu/packages/patches
parent9b557beab95fbd19739c68a44e32ac05d905ad79 (diff)
downloadguix-e554d43dfcd4f9a3e34fc2d0ebca47b06f99b2fe.tar.gz
gnu: wesnoth: Update to 1.14.0.
* gnu/packages/patches/wesnoth-fix-std-bad-cast.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/games.scm (wesnoth): Update to 1.14.0.
[source]: Add wesnoth-fix-std-bad-cast.patch to patches.
[arguments]: Remove "-DENABLE_STRICT_COMPILATION=OFF" configure flag.
[inputs]: Remove sdl-image, sdl-mixer, sdl-net and sdl-ttf. Add openssl and
sdl-union of sdl2, sdl2-image, sdl2-mixer and sdl2-ttf.
[home-page]: Use HTTPS URI.
(wesnoth-server)[inputs]: Remove sdl-net. Add icu4c, openssl and sdl2.
[arguments]: Remove delete-data phase. Since wesnoth 1.14.0, configure flag
"-DENABLE_GAME=OFF" disables installation of game assets.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/wesnoth-fix-std-bad-cast.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/gnu/packages/patches/wesnoth-fix-std-bad-cast.patch b/gnu/packages/patches/wesnoth-fix-std-bad-cast.patch
new file mode 100644
index 0000000000..18328ed018
--- /dev/null
+++ b/gnu/packages/patches/wesnoth-fix-std-bad-cast.patch
@@ -0,0 +1,67 @@
+From 18e5ea50a7136cb3686c5a7c51c111ccce73dc54 Mon Sep 17 00:00:00 2001
+From: Iris Morelle <shadowm@wesnoth.org>
+Date: Sun, 6 May 2018 16:10:42 -0300
+Subject: [PATCH] i18n: Blind fix attempt for std::bad_cast being thrown on
+ Windows
+
+Several reports on Steam and our forums point at std::bad_cast being
+thrown when accessing Preferences and the Multiplayer menu amongst
+others. It's possible that the locale configuration on those systems is
+not quite right, and compare() and icompare() are able to throw
+std::bad_cast when this happens as they both use std::use_facet().
+
+Note that much like the macOS/iOS version of icompare(), this stopgap
+patch doesn't attempt to provide any form of case-insensitive fallback
+and just uses a case-sensitive comparison instead.
+---
+ src/gettext_boost.cpp | 29 +++++++++++++++++++++++++++--
+ 1 file changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/src/gettext_boost.cpp b/src/gettext_boost.cpp
+index 3cc7690d5ef..fb04ffeea90 100644
+--- a/src/gettext_boost.cpp
++++ b/src/gettext_boost.cpp
+@@ -423,7 +423,19 @@ void set_language(const std::string& language, const std::vector<std::string>* /
+ int compare(const std::string& s1, const std::string& s2)
+ {
+ 	std::lock_guard<std::mutex> lock(get_mutex());
+-	return std::use_facet<std::collate<char>>(get_manager().get_locale()).compare(s1.c_str(), s1.c_str() + s1.size(), s2.c_str(), s2.c_str() + s2.size());
++
++	try {
++		return std::use_facet<std::collate<char>>(get_manager().get_locale()).compare(s1.c_str(), s1.c_str() + s1.size(), s2.c_str(), s2.c_str() + s2.size());
++	} catch(const std::bad_cast&) {
++		static bool bad_cast_once = false;
++
++		if(!bad_cast_once) {
++			ERR_G << "locale set-up for compare() is broken, falling back to std::string::compare()\n";
++			bad_cast_once = true;
++		}
++
++		return s1.compare(s2);
++	}
+ }
+ 
+ int icompare(const std::string& s1, const std::string& s2)
+@@ -433,8 +445,21 @@ int icompare(const std::string& s1, const std::string& s2)
+ 	return compare(s1, s2);
+ #else
+ 	std::lock_guard<std::mutex> lock(get_mutex());
+-	return std::use_facet<bl::collator<char>>(get_manager().get_locale()).compare(
++
++	try {
++		return std::use_facet<bl::collator<char>>(get_manager().get_locale()).compare(
+ 			bl::collator_base::secondary, s1, s2);
++	} catch(const std::bad_cast&) {
++		static bool bad_cast_once = false;
++
++		if(!bad_cast_once) {
++			ERR_G << "locale set-up for icompare() is broken, falling back to std::string::compare()\n";
++			bad_cast_once = true;
++		}
++
++		// FIXME: not even lazily case-insensitive
++		return s1.compare(s2);
++	}
+ #endif
+ }
+