commit:     3cc10101043aa2994d613ddd371323275a7beb42
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 11 03:57:32 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Feb 11 04:18:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3cc10101

dev-lang/swi-prolog: fix configure w/ clang 16

Closes: https://bugs.gentoo.org/879657
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/swi-prolog-9.1.2-configure-clang16.patch | 61 ++++++++++++++++++++++
 ...log-9.1.2.ebuild => swi-prolog-9.1.2-r1.ebuild} |  5 ++
 2 files changed, 66 insertions(+)

diff --git a/dev-lang/swi-prolog/files/swi-prolog-9.1.2-configure-clang16.patch 
b/dev-lang/swi-prolog/files/swi-prolog-9.1.2-configure-clang16.patch
new file mode 100644
index 000000000000..292728269526
--- /dev/null
+++ b/dev-lang/swi-prolog/files/swi-prolog-9.1.2-configure-clang16.patch
@@ -0,0 +1,61 @@
+https://bugs.gentoo.org/879657
+https://github.com/SWI-Prolog/swipl-devel/commit/2328d9d54c8aa368a4bf0165b1b811d1f31ba0f7
+https://github.com/SWI-Prolog/swipl-devel/commit/0d1088443348b71a3624835a19469e2b6cc7e284
+
+From 2328d9d54c8aa368a4bf0165b1b811d1f31ba0f7 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <[email protected]>
+Date: Tue, 10 Jan 2023 14:08:04 +0100
+Subject: [PATCH] cmake: Fix C99 compatibility issues in GCC built-in detection
+
+Future compilers may not support implicit ints or implicit
+function declarations, so avoid them, by using an explicit int
+type and including <alloca.h> for the alloca function.
+--- a/cmake/GCCBuiltins.cmake
++++ b/cmake/GCCBuiltins.cmake
+@@ -22,7 +22,7 @@ check_c_source_compiles(
+     "volatile int i=0; int main() { return 0; }"
+     HAVE_VOLATILE)
+ check_c_source_compiles(
+-    "static inline foo() { return 0; } int main() { return foo(); }"
++    "static inline int foo() { return 0; } int main() { return foo(); }"
+     HAVE_INLINE)
+ check_c_source_compiles(
+     "int main() { void *p = &&lbl; goto *p; lbl: return 0; }"
+@@ -45,7 +45,7 @@ check_visibility()
+ # Builtin functions that lead to conflicts
+ 
+ check_c_source_compiles(
+-    "int main() { char *s = alloca(10); return s!=0; }"
++    "#include <alloca.h>\nint main() { char *s = alloca(10); return s!=0; }"
+     HAVE_ALLOCA)
+ check_c_source_compiles(
+     "#include <math.h>\nint main() { double x; return signbit(x); }"
+
+From 0d1088443348b71a3624835a19469e2b6cc7e284 Mon Sep 17 00:00:00 2001
+From: Jan Wielemaker <[email protected]>
+Date: Wed, 11 Jan 2023 13:30:34 +0100
+Subject: [PATCH] Cleanup some no longer used GCC __builtin checks.
+
+--- a/cmake/GCCBuiltins.cmake
++++ b/cmake/GCCBuiltins.cmake
+@@ -9,12 +9,6 @@ check_c_source_compiles(
+ check_c_source_compiles(
+     "int i=0; int main() { return __builtin_expect(i, 0) ? 0 : 1; }"
+     HAVE___BUILTIN_EXPECT)
+-check_c_source_compiles(
+-    "int i=0; struct {int x[10];} st; int main() { return 
__builtin_choose_expr(1, i, st); }"
+-    HAVE___BUILTIN_CHOOSE_EXPR)
+-check_c_source_compiles(
+-    "int i=0; int main() { return __builtin_types_compatible_p(typeof(i), 
int); }"
+-    HAVE___BUILTIN_TYPES_COMPATIBLE_P)
+ check_c_source_compiles(
+     "__thread int i=0; int main() { return 0; }"
+     HAVE___THREAD)
+@@ -48,5 +42,5 @@ check_c_source_compiles(
+     "#include <alloca.h>\nint main() { char *s = alloca(10); return s!=0; }"
+     HAVE_ALLOCA)
+ check_c_source_compiles(
+-    "#include <math.h>\nint main() { double x; return signbit(x); }"
++    "#include <math.h>\nint main() { double x = 0.0; return signbit(x); }"
+     HAVE_SIGNBIT)
+

diff --git a/dev-lang/swi-prolog/swi-prolog-9.1.2.ebuild 
b/dev-lang/swi-prolog/swi-prolog-9.1.2-r1.ebuild
similarity index 97%
rename from dev-lang/swi-prolog/swi-prolog-9.1.2.ebuild
rename to dev-lang/swi-prolog/swi-prolog-9.1.2-r1.ebuild
index 5449898d6a02..7cee8edc9d51 100644
--- a/dev-lang/swi-prolog/swi-prolog-9.1.2.ebuild
+++ b/dev-lang/swi-prolog/swi-prolog-9.1.2-r1.ebuild
@@ -73,6 +73,11 @@ DEPEND="${COMMON_DEPEND}
 "
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+       # Upstream in >= 9.1.3
+       "${FILESDIR}"/${P}-configure-clang16.patch
+)
+
 pkg_setup() {
        java-pkg-opt-2_pkg_setup
 }

Reply via email to