diff mbox series

package/lrzsz: fix build with GCC >= 14.x

Message ID 20240915132735.862622-1-thomas.petazzoni@bootlin.com
State New
Headers show
Series package/lrzsz: fix build with GCC >= 14.x | expand

Commit Message

Thomas Petazzoni Sept. 15, 2024, 1:27 p.m. UTC
The lrzsz package currently fails to build with GCC >= 14.x. In [1],
Fabrice had proposed to update the package to what's available on a
Github repository from the upstream maintainer at [2], but in this
very repository (not updated since 4 years), the maintainer writes:

  NOTE:

  Do not use the repository until further notice.
  It contains work in progress and at least one change i am unhappy with.

  Use either http://ohse.de/uwe/testing/lrzsz-0.12.21rc.tar.gz (over
  20 years in rc state, so it's good enough), or 0.12.20 from
  https://ohse.de/uwe/software/lrzsz.html (do not expect me to update
  that old site ever again).

So, let's stick to the 0.12.20 version we have, and add a few patches.

Patch 0001 is patching the configure script, which we obviously don't
normally like. However, the configure.in script is very old and no
longer autoreconfs properly with modern autoconf. Since the patch is
trivial, and upstream seems almost dead, we take the route of patching
the configure script.

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20240726092042.1273023-1-fontaine.fabrice@gmail.com/
[2] https://github.com/UweOhse/lrzsz

Fixes:

  http://autobuild.buildroot.net/results/3eb94eac3e0e1a04d41c618ed9ea2e4e398ea48a/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 .../0001-configure-fix-main-prototype.patch   | 32 ++++++++++++++
 ...-lib-long-options.c-include-stdlib.h.patch | 44 +++++++++++++++++++
 ...03-include-stdio.h-to-remove-warning.patch | 26 +++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 package/lrzsz/0001-configure-fix-main-prototype.patch
 create mode 100644 package/lrzsz/0002-lib-long-options.c-include-stdlib.h.patch
 create mode 100644 package/lrzsz/0003-include-stdio.h-to-remove-warning.patch
diff mbox series

Patch

diff --git a/package/lrzsz/0001-configure-fix-main-prototype.patch b/package/lrzsz/0001-configure-fix-main-prototype.patch
new file mode 100644
index 0000000000..46b7aade00
--- /dev/null
+++ b/package/lrzsz/0001-configure-fix-main-prototype.patch
@@ -0,0 +1,32 @@ 
+From 43b2b711fedd3a28d497b3a5c0e9054fa203ef3d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Sun, 15 Sep 2024 15:12:07 +0200
+Subject: [PATCH] configure: fix main() prototype
+
+The pre-generated configure script has a check that doesn't work with
+GCC >= 14.x due to a partial main() prototype. Doing AUTORECONF = YES
+doesn't work as the configure.in is very old, so let's fix the
+configure script directly.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Upstream: N/A, patching generated file
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index db26726..d160e27 100755
+--- a/configure
++++ b/configure
+@@ -1008,7 +1008,7 @@ cross_compiling=$ac_cv_prog_cc_cross
+ cat > conftest.$ac_ext <<EOF
+ #line 1010 "configure"
+ #include "confdefs.h"
+-main(){return(0);}
++int main(){return(0);}
+ EOF
+ if { (eval echo configure:1014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+   ac_cv_prog_cc_works=yes
+-- 
+2.46.0
+
diff --git a/package/lrzsz/0002-lib-long-options.c-include-stdlib.h.patch b/package/lrzsz/0002-lib-long-options.c-include-stdlib.h.patch
new file mode 100644
index 0000000000..6229114e0a
--- /dev/null
+++ b/package/lrzsz/0002-lib-long-options.c-include-stdlib.h.patch
@@ -0,0 +1,44 @@ 
+From aa6779c2846f13bf58575486b374ef06b2844fe8 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <yegorslists@googlemail.com>
+Date: Tue, 21 May 2024 11:13:17 +0200
+Subject: [PATCH] lib/long-options.c: include stdlib.h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes the following error (compiled with GCC 14.x):
+
+long-options.c:70:11: error: implicit declaration of function ‘exit’
+[-Wimplicit-function-declaration]
+   70 |           exit (0);
+      |           ^~~~
+
+Upstream: https://github.com/UweOhse/lrzsz/pull/4
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ lib/long-options.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/lib/long-options.c b/lib/long-options.c
+index 76b9796..19c84e0 100644
+--- a/lib/long-options.c
++++ b/lib/long-options.c
+@@ -22,6 +22,15 @@
+ #endif
+ 
+ #include <stdio.h>
++
++/* This needs to come after some library #include
++   to get __GNU_LIBRARY__ defined.  */
++#ifdef	__GNU_LIBRARY__
++/* Don't include stdlib.h for non-GNU C libraries because some of them
++   contain conflicting prototypes for getopt.  */
++#include <stdlib.h>
++#endif	/* GNU C library.  */
++
+ #include <getopt.h>
+ #include "long-options.h"
+ 
+-- 
+2.46.0
+
diff --git a/package/lrzsz/0003-include-stdio.h-to-remove-warning.patch b/package/lrzsz/0003-include-stdio.h-to-remove-warning.patch
new file mode 100644
index 0000000000..e4a958cdfa
--- /dev/null
+++ b/package/lrzsz/0003-include-stdio.h-to-remove-warning.patch
@@ -0,0 +1,26 @@ 
+From e164c9cd3207321e162f054357fcd37b06cb0b8a Mon Sep 17 00:00:00 2001
+From: Uwe Ohse <uwe@ohse.de>
+Date: Mon, 2 Mar 2020 22:38:16 +0000
+Subject: [PATCH] include stdio.h to remove warning
+
+Upstream: https://github.com/UweOhse/lrzsz/commit/937a2ff696fb600672eb0e8fab87f75d5e4fbc25
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ src/lsyslog.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/lsyslog.c b/src/lsyslog.c
+index 6baf4a2..d21ab35 100644
+--- a/src/lsyslog.c
++++ b/src/lsyslog.c
+@@ -24,6 +24,7 @@
+ #include <pwd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <stdio.h>
+ #endif
+ 
+ #if __STDC__
+-- 
+2.46.0
+