Control: tags -1 + patch

Attached is a patch getting the package to build again in unstable.

Note, a proper fix require regenererating a lot of configure scripts
using newer autoconf macros, and figuring out why STDC_HEADERS is not
defined to include the proper system headers.  It will require more
spare time than I have available at the moment.

-- 
Happy hacking
Petter Reinholdtsen
>From 41255fd2985d8ed18590c7d2d2cb4fb7b30c25fe Mon Sep 17 00:00:00 2001
From: Petter Reinholdtsen <p...@hungry.com>
Date: Fri, 14 Feb 2025 11:02:37 +0000
Subject: [PATCH] Get code building in Debian Unstable.

Fixed configure runs to use valid C, missing prototypes when
STDC_HEADERS is missing and drop modifying ownership of installed
files.
---
 debian/patches/133-configure-signatures.patch | 201 ++++++++++++++++++
 debian/patches/series                         |   1 +
 debian/rules                                  |   8 +-
 3 files changed, 206 insertions(+), 4 deletions(-)
 create mode 100644 debian/patches/133-configure-signatures.patch

diff --git a/debian/patches/133-configure-signatures.patch b/debian/patches/133-configure-signatures.patch
new file mode 100644
index 0000000..55de8c5
--- /dev/null
+++ b/debian/patches/133-configure-signatures.patch
@@ -0,0 +1,201 @@
+Description: Fix configure and build problem with newer GCC.
+ Make sure main() return int.  Also make sure required prototypes are
+ available, despite STDC_HEADERS not being defined for some reason.
+Author: Petter Reinholdtsen <p...@hungry.com>
+Forwarded: no
+Last-Update: 2025-02-14
+---
+--- binutils-h8300-hms-2.16.1.orig/configure
++++ binutils-h8300-hms-2.16.1/configure
+@@ -1932,7 +1932,7 @@ cat > conftest.$ac_ext << EOF
+ #line 1933 "configure"
+ #include "confdefs.h"
+ 
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:1938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+@@ -2261,7 +2261,7 @@ cat > conftest.$ac_ext <<EOF
+ #line 2262 "configure"
+ #include "confdefs.h"
+ #include "gmp.h"
+-int main() {
++int main() {
+ 
+ #if __GNU_MP_VERSION < 3
+ choke me
+@@ -2291,7 +2291,7 @@ echo "configure:2286: checking for MPFR"
+ #include "confdefs.h"
+ #include <gmp.h>
+ #include <mpfr.h>
+-int main() {
++int main() {
+ mpfr_t n; mpfr_init(n);
+ ; return 0; }
+ EOF
+@@ -3009,7 +3009,7 @@ fi
+ # executable--we might be using a cross compiler--we only care whether it
+ # can be created.  At this point the main configure script has set CC.
+ we_are_ok=no
+-echo "int main () { return 0; }" > conftest.c
++echo "int main () { return 0; }" > conftest.c
+ ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
+ if test $? = 0 ; then
+   if test -s conftest || test -s conftest.exe ; then
+--- binutils-h8300-hms-2.16.1.orig/configure.in
++++ binutils-h8300-hms-2.16.1/configure.in
+@@ -1598,7 +1598,7 @@ fi
+ # executable--we might be using a cross compiler--we only care whether it
+ # can be created.  At this point the main configure script has set CC.
+ we_are_ok=no
+-echo "int main () { return 0; }" > conftest.c
++echo "int main () { return 0; }" > conftest.c
+ ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
+ if test $? = 0 ; then
+   if test -s conftest || test -s conftest.exe ; then
+diff --git a/binutils/configure b/binutils/configure
+index d716798..678b66b 100755
+--- a/binutils/configure
++++ b/binutils/configure
+@@ -1196,7 +1196,7 @@ cat > conftest.$ac_ext << EOF
+ #line 1197 "configure"
+ #include "confdefs.h"
+ 
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:1202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+@@ -2369,7 +2369,7 @@ cat > conftest.$ac_ext << EOF
+ #line 2370 "configure"
+ #include "confdefs.h"
+ 
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+@@ -3278,7 +3278,7 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++int main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+@@ -4904,7 +4904,7 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++int main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+diff --git a/intl/configure b/intl/configure
+index 341eea0..d9f0218 100755
+--- a/intl/configure
++++ b/intl/configure
+@@ -791,7 +791,7 @@ cross_compiling=$ac_cv_prog_cc_cross
+ cat > conftest.$ac_ext <<EOF
+ #line 793 "configure"
+ #include "confdefs.h"
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+   ac_cv_prog_cc_works=yes
+@@ -1407,7 +1407,7 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++int main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+diff --git a/ld/configure b/ld/configure
+index bd539a7..62c40a0 100755
+--- a/ld/configure
++++ b/ld/configure
+@@ -1200,7 +1200,7 @@ cat > conftest.$ac_ext << EOF
+ #line 1201 "configure"
+ #include "confdefs.h"
+ 
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:1206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+@@ -2424,7 +2424,7 @@ cat > conftest.$ac_ext << EOF
+ #line 2425 "configure"
+ #include "confdefs.h"
+ 
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:2430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+@@ -3185,7 +3185,7 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++int main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+diff --git a/libiberty/configure b/libiberty/configure
+index ed656bc..63403ce 100755
+--- a/libiberty/configure
++++ b/libiberty/configure
+@@ -3326,7 +3326,7 @@ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+-main () {
++int main () {
+   /* Are we little or big endian?  From Harbison&Steele.  */
+   union
+   {
+@@ -5741,7 +5741,7 @@ find_stack_direction ()
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+-main ()
++int main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+diff --git a/libiberty/md5.c b/libiberty/md5.c
+index e458f2a..a4ddb67 100644
+--- a/libiberty/md5.c
++++ b/libiberty/md5.c
+@@ -33,6 +33,8 @@
+ #else
+ # ifndef HAVE_MEMCPY
+ #  define memcpy(d, s, n) bcopy ((s), (d), (n))
++# else
++void memcpy(void *, const void*, long unsigned int);
+ # endif
+ #endif
+ 
+diff --git a/libiberty/regex.c b/libiberty/regex.c
+index 3babf6c..6c47744 100644
+--- a/libiberty/regex.c
++++ b/libiberty/regex.c
+@@ -133,8 +133,10 @@
+ #  if defined STDC_HEADERS || defined _LIBC
+ #   include <stdlib.h>
+ #  else
+-char *malloc ();
+-char *realloc ();
++void *malloc (long unsigned int);
++void *realloc (void *, long unsigned int);
++void free(void*);
++void abort(void);
+ #  endif
+ 
+ /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
diff --git a/debian/patches/series b/debian/patches/series
index 5d9c7cb..c243697 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@
 131_sprintf
 132_texinfo_fixes
 bts729274
+133-configure-signatures.patch
diff --git a/debian/rules b/debian/rules
index e53ba19..3f880d9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -56,19 +56,19 @@ override_dh_auto_install:
 	rm -rf $(CURDIR)/debian/$(p_cross)/usr/share/locale
 
 	# install documentation
-	install -p -o root -g root -m 644 binutils/NEWS \
+	install -p -m 644 binutils/NEWS \
 		$(CURDIR)/debian/$(p_cross)/usr/share/doc/$(p_cross)/NEWS
-	install -p -o root -g root -m 644 binutils/MAINTAINERS \
+	install -p -m 644 binutils/MAINTAINERS \
 		$(CURDIR)/debian/$(p_cross)/usr/share/doc/$(p_cross)/MAINTAINERS
 	for pkg in bfd gas gprof ld; do \
 		for f in ChangeLog NEWS README PORTING MAINTAINERS TODO ; do \
 			[ -f $$pkg/$$f ] || continue ; \
-			install -p -o root -g root -m 644 $$pkg/$$f \
+			install -p -m 644 $$pkg/$$f \
 				$(CURDIR)/debian/$(p_cross)/usr/share/doc/$(p_cross)/$$pkg/$$f ; \
 		done ; \
 	done
 	
 	# Override files
-	install -p -o root -g root -m 644 $(CURDIR)/debian/overrides.lintian \
+	install -p -m 644 $(CURDIR)/debian/overrides.lintian \
 		$(CURDIR)/debian/$(p_cross)/usr/share/lintian/overrides/$(p_cross)
 
-- 
2.47.2

Reply via email to