commit:     a113e55e8dce5fac87f49e6b9833d22f9d1c53fb
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Thu Jan  9 07:47:53 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 21 20:51:14 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a113e55e

app-emulation/hercules: fix implicit function declarations in configure

* add "--tag " for libtool
* use -std=gnu17, workaround for gcc15

Closes: https://bugs.gentoo.org/879629
Closes: https://bugs.gentoo.org/900328
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/40063
Closes: https://github.com/gentoo/gentoo/pull/40063
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../hercules/files/hercules-3.13-autoconf.patch    | 81 ++++++++++++++++++++++
 app-emulation/hercules/hercules-3.13-r1.ebuild     |  6 +-
 2 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/app-emulation/hercules/files/hercules-3.13-autoconf.patch 
b/app-emulation/hercules/files/hercules-3.13-autoconf.patch
new file mode 100644
index 000000000000..e22e91cce514
--- /dev/null
+++ b/app-emulation/hercules/files/hercules-3.13-autoconf.patch
@@ -0,0 +1,81 @@
+From 8a399018269bebd3ee99d2f4f51656b1b74ed02d Mon Sep 17 00:00:00 2001
+From: "Z. Liu" <[email protected]>
+Date: Thu, 9 Jan 2025 14:19:48 +0800
+Subject: [PATCH] autoconf: fix -Wimplicit-function-declaration
+
+With modern C compilers this is a bug and will cause false positives in
+feature tests.
+
+Signed-off-by: Z. Liu <[email protected]>
+---
+ autoconf/hercules.m4 | 17 ++++++++++++-----
+ configure.ac         |  3 +++
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/autoconf/hercules.m4 b/autoconf/hercules.m4
+index edd71d63..08647581 100644
+--- a/autoconf/hercules.m4
++++ b/autoconf/hercules.m4
+@@ -291,6 +291,7 @@ AC_DEFUN([_HC_CHECK_NEED_GETOPT_WRAPPER],
+                    Will the linker complain about duplicate
+                    symbols for getopt? We'll soon find out!
+                 */
++                extern int getopt(int, char *const[], const char *);
+                 extern char *optarg;
+                 extern int optind;
+ 
+@@ -315,6 +316,8 @@ DUPGETOPT1
+                    needs getopt. Will linker complain about
+                    duplicate symbols for getopt? Let's see.
+                 */
++                extern int getopt(int, char *const[], const char *);
++                extern int test1();
+                 extern char *optarg;
+                 extern int optind;
+                 extern int test2();
+@@ -334,11 +337,11 @@ DUPGETOPT1
+                 }
+ DUPGETOPT2
+ 
+-            libtool --mode=compile ${CC-cc} conftest1.c -c -o conftest1.lo > 
/dev/null 2>&1
+-            libtool --mode=compile ${CC-cc} conftest2.c -c -o conftest2.lo > 
/dev/null 2>&1
++            libtool --tag=CC --mode=compile ${CC-cc} conftest1.c -c -o 
conftest1.lo > /dev/null 2>&1
++            libtool --tag=CC --mode=compile ${CC-cc} conftest2.c -c -o 
conftest2.lo > /dev/null 2>&1
+ 
+-            libtool --mode=link ${CC-cc} -shared -rpath /lib -no-undefined 
conftest1.lo                 -o libconftest1.la > /dev/null 2>&1
+-            libtool --mode=link ${CC-cc} -shared -rpath /lib -no-undefined 
conftest2.lo libconftest1.la -o libconftest2.la > /dev/null 2>&1
++            libtool --tag=CC --mode=link ${CC-cc} -shared -rpath /lib 
-no-undefined conftest1.lo                 -o libconftest1.la > /dev/null 2>&1
++            libtool --tag=CC --mode=link ${CC-cc} -shared -rpath /lib 
-no-undefined conftest2.lo libconftest1.la -o libconftest2.la > /dev/null 2>&1
+ 
+             if test $? = 0; then
+ 
+@@ -385,7 +388,11 @@ AC_DEFUN([HC_CHECK_NEED_GETOPT_OPTRESET],
+         [hc_cv_need_getopt_optreset],
+         [
+             AC_TRY_LINK(
+-                [],
++                [
++                    #ifdef HAVE_UNISTD_H
++                    #include <unistd.h>
++                    #endif
++                ],
+                 [
+                     extern int optreset;
+                     optreset=1;
+diff --git a/configure.ac b/configure.ac
+index f12d4705..68dae467 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1168,6 +1168,9 @@ if test "$GCC" = "yes"; then
+ 
+                             -g -O2 -fomit-frame-pointer
+                     */
++                    #if HAVE_STRING_H
++                    #include <string.h>
++                    #endif
+ 
+                     int foo ()
+                     {
+-- 
+2.45.2
+

diff --git a/app-emulation/hercules/hercules-3.13-r1.ebuild 
b/app-emulation/hercules/hercules-3.13-r1.ebuild
index 608739f4b314..f68f4a2d4bd0 100644
--- a/app-emulation/hercules/hercules-3.13-r1.ebuild
+++ b/app-emulation/hercules/hercules-3.13-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="7"
@@ -26,6 +26,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-3.13-posix-test.patch
        "${FILESDIR}"/${PN}-3.13-unbundle-libltdl.patch
        "${FILESDIR}"/${PN}-3.13-user-install.patch
+       "${FILESDIR}"/${PN}-3.13-autoconf.patch
 )
 
 src_prepare() {
@@ -43,6 +44,9 @@ src_prepare() {
 
 src_configure() {
        use custom-cflags || strip-flags
+
+       append-cflags -std=gnu17 # workaround for gcc15
+
        local -x ac_cv_lib_bz2_BZ2_bzBuffToBuffDecompress=$(usex bzip2)
        econf \
                $(use_enable bzip2 cckd-bzip2) \

Reply via email to