Toggle diff (93 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index d1803e7f59..a4dd01a40f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1716,6 +1716,7 @@ dist_patch_DATA = \
%D%/packages/patches/quassel-qt-514-compat.patch \
%D%/packages/patches/quickswitch-fix-dmenu-check.patch \
%D%/packages/patches/qtwebkit-pbutils-include.patch \
+ %D%/packages/patches/ragel-specify-char-signedness.patch \
%D%/packages/patches/randomjungle-disable-static-build.patch \
%D%/packages/patches/rapicorn-isnan.patch \
%D%/packages/patches/rapidjson-gcc-compat.patch \
diff --git a/gnu/packages/patches/ragel-specify-char-signedness.patch b/gnu/packages/patches/ragel-specify-char-signedness.patch
new file mode 100644
index 0000000000..fccb79d432
--- /dev/null
+++ b/gnu/packages/patches/ragel-specify-char-signedness.patch
@@ -0,0 +1,58 @@
+Ragel assumes C and C++'s "char" type is signed by default but this is not
+true for every architecture gcc supports. Prevent build failures of dependent
+packages (on architectures such as AArch64 where "char" is normally unsigned)
+by making explicit Ragel's assumption of character signedness.
+
+This is functionally very similar to upstream commit e2650a7, "common: Fix
+ambiguous CHAR_MIN/MAX definition", which is also meant to address this issue.
+However this patch applies to Ragel version 6 and it removes altogether the
+ambiguous "char" type from generated C code, causing Ragel to instead specify
+"signed char" or "unsigned char" as appropriate.
+
+diff --git a/ragel/common.cpp b/ragel/common.cpp
+index 8e9f8ed0..649f388c 100644
+--- a/ragel/common.cpp
++++ b/ragel/common.cpp
+@@ -27,7 +27,7 @@
+
+ HostType hostTypesC[] =
+ {
+- { "char", 0, "char", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, sizeof(char) },
++ { "signed", "char", "char", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, sizeof(signed char) },
+ { "unsigned", "char", "uchar", false, true, false, 0, 0, 0, UCHAR_MAX, sizeof(unsigned char) },
+ { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(short) },
+ { "unsigned", "short", "ushort", false, true, false, 0, 0, 0, USHRT_MAX, sizeof(unsigned short) },
+@@ -66,7 +66,7 @@ HostType hostTypesC[] =
+
+ HostType hostTypesD[] =
+ {
+- { "byte", 0, "byte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 },
++ { "byte", 0, "byte", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 },
+ { "ubyte", 0, "ubyte", false, true, false, 0, 0, 0, UCHAR_MAX, 1 },
+ { "char", 0, "char", false, true, false, 0, 0, 0, UCHAR_MAX, 1 },
+ { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 },
+@@ -93,7 +93,7 @@ HostType hostTypesGo[] =
+
+ HostType hostTypesJava[] =
+ {
+- { "byte", 0, "byte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 },
++ { "byte", 0, "byte", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 },
+ { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 },
+ { "char", 0, "char", false, true, false, 0, 0, 0, USHRT_MAX, 2 },
+ { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, 4 },
+@@ -102,13 +102,13 @@ HostType hostTypesJava[] =
+ /* What are the appropriate types for ruby? */
+ HostType hostTypesRuby[] =
+ {
+- { "char", 0, "char", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 },
++ { "char", 0, "char", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 },
+ { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, 4 },
+ };
+
+ HostType hostTypesCSharp[] =
+ {
+- { "sbyte", 0, "sbyte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 },
++ { "sbyte", 0, "sbyte", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 },
+ { "byte", 0, "byte", false, true, false, 0, 0, 0, UCHAR_MAX, 1 },
+ { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 },
+ { "ushort", 0, "ushort", false, true, false, 0, 0, 0, USHRT_MAX, 2 },
diff --git a/gnu/packages/ragel.scm b/gnu/packages/ragel.scm
index 1d9b67a6e0..e3fc980bd7 100644
--- a/gnu/packages/ragel.scm
+++ b/gnu/packages/ragel.scm
@@ -34,7 +34,9 @@ (define-public ragel
version ".tar.gz"))
(sha256
(base32
- "0gvcsl62gh6sg73nwaxav4a5ja23zcnyxncdcdnqa2yjcpdnw5az"))))
+ "0gvcsl62gh6sg73nwaxav4a5ja23zcnyxncdcdnqa2yjcpdnw5az"))
+ (patches
+ (search-patches "ragel-specify-char-signedness.patch"))))
(build-system gnu-build-system)
(home-page "https://www.colm.net/open-source/ragel/")
(synopsis "State machine compiler")
--
2.33.0