package/lrzsz: fix build with gcc 15

Import upstream pull request https://github.com/UweOhse/lrzsz/pull/8
to fix GCC 15.x build issues. This pull request also replaces our
patch 0002, which is dropped by this commit.

Fixes:

  https://autobuild.buildroot.net/results/a1a5aad2ccc69aeff586d7a83620f10d51ccfdb6/

Signed-off-by: Frank Chung <uuidxx@163.com>
[Thomas:
- Added two more backports needed to fix the build
- Used the actual patch submitted in the pull request, rendering our
  0002 patch useless
- Defined ac_cv_type_signal as a workaround to a configure script issue]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Frank Chung
2025-08-18 14:58:50 +00:00
committed by Thomas Petazzoni
parent 2c6a292b93
commit 13e778fcf1
8 changed files with 172 additions and 48 deletions

View File

@@ -1,4 +1,4 @@
From c2758812867a52a6bb56b87d52c35ebff797e777 Mon Sep 17 00:00:00 2001
From 4c264d704357220b91a070862e0490c641b3f560 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
@@ -30,5 +30,5 @@ index cc586d5..16a259a 100755
if { (eval echo configure:1059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
--
2.45.2
2.50.1

View File

@@ -1,4 +1,4 @@
From e164c9cd3207321e162f054357fcd37b06cb0b8a Mon Sep 17 00:00:00 2001
From bbbaccd80c69a705f27e9236808d42088cf1f1cb 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
@@ -22,5 +22,5 @@ index 6baf4a2..d21ab35 100644
#if __STDC__
--
2.46.0
2.50.1

View File

@@ -1,40 +0,0 @@
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>
[Fiona: remove conditional on __GNU_LIBRARY__ to fix build with musl]
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
---
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,9 @@
#endif
#include <stdio.h>
+
+#include <stdlib.h>
+
#include <getopt.h>
#include "long-options.h"
--
2.46.0

View File

@@ -1,9 +1,9 @@
From a9faaf7f02811e7409074362700e963609885ba6 Mon Sep 17 00:00:00 2001
From b526a62d5992d838ee34fb992defdeb8ee0ed594 Mon Sep 17 00:00:00 2001
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date: Fri, 29 Nov 2024 14:14:25 +0100
Subject: [PATCH] FTBFS fix missing includes
From: https://sources.debian.org/data/main/l/lrzsz/0.12.21rc-0.1/debian/patches/include.diff
Taken from: https://sources.debian.org/data/main/l/lrzsz/0.12.21rc-0.1/debian/patches/include.diff
Description: Fixes FTBFS (missing includes)
Author: Martin A. Godisch <godisch@debian.org>
@@ -120,5 +120,5 @@ index dd9736b..7bc3736 100644
#include <ctype.h>
#include <errno.h>
--
2.45.2
2.50.1

View File

@@ -0,0 +1,93 @@
From 01a8cdf3f8e64b80ff219c250c899605c50312f5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 22 Mar 2025 23:06:54 -0700
Subject: [PATCH] Fix build with GCC 15
This is collection of changes needed to get compiling with gcc-15
which switched to use C23 as default std.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream: https://github.com/UweOhse/lrzsz/pull/8
Signed-off-by: Frank Chung <uuidxx@163.com>
---
lib/error.c | 2 +-
lib/getopt.h | 2 +-
lib/long-options.c | 3 ++-
lib/long-options.h | 2 +-
lib/xstrtol.c | 2 --
5 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/error.c b/lib/error.c
index 3861578..2a2f1ff 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -74,7 +74,7 @@ extern char *program_name;
# if HAVE_STRERROR
# ifndef strerror /* On some systems, strerror is a macro */
-char *strerror ();
+char *strerror (int);
# endif
# else
static char *
diff --git a/lib/getopt.h b/lib/getopt.h
index 4ac33b7..46971cb 100644
--- a/lib/getopt.h
+++ b/lib/getopt.h
@@ -101,7 +101,7 @@ struct option
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+extern int getopt (int, char * const [], const char *);
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
diff --git a/lib/long-options.c b/lib/long-options.c
index fe069fd..4db5cea 100644
--- a/lib/long-options.c
+++ b/lib/long-options.c
@@ -22,6 +22,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <getopt.h>
#include "long-options.h"
@@ -43,7 +44,7 @@ parse_long_options (argc, argv,version, usage)
int argc;
char **argv;
void (*version)();
- void (*usage)();
+ void (*usage)(int);
#endif
{
int c;
diff --git a/lib/long-options.h b/lib/long-options.h
index 14459cd..3fb8fa6 100644
--- a/lib/long-options.h
+++ b/lib/long-options.h
@@ -6,5 +6,5 @@
#endif
void parse_long_options __P ((int _argc, char **_argv,
- void (*_version) (void),
+ void (*_version) (),
void (*_usage) (int)));
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index d7b4b56..7d0737d 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -65,8 +65,6 @@ extern int errno;
} \
while (0)
-__unsigned long int __strtol ();
-
/* FIXME: comment. */
strtol_error
--
2.50.1

View File

@@ -0,0 +1,38 @@
From 8d91782ae404c59f42029b3af394fbccb2d43856 Mon Sep 17 00:00:00 2001
From: Uwe Ohse <uwe@ohse.de>
Date: Mon, 2 Mar 2020 21:24:45 +0000
Subject: [PATCH] remove old prototypes
Upstream: 34f9527076276aace5fc2e31388e09aaaf1773eb
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/lrz.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/lrz.c b/src/lrz.c
index 63e1326..a31e82d 100644
--- a/src/lrz.c
+++ b/src/lrz.c
@@ -32,6 +32,7 @@
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
+#include <time.h>
#ifdef HAVE_UTIME_H
#include <utime.h>
@@ -42,11 +43,6 @@
#include "xstrtoul.h"
#include "error.h"
-#ifndef STRICT_PROTOTYPES
-extern time_t time();
-extern char *strerror();
-extern char *strstr();
-#endif
#ifndef HAVE_ERRNO_DECLARATION
extern int errno;
--
2.50.1

View File

@@ -0,0 +1,31 @@
From 755da0781a2b20674f183cbf8cddf28ac56f7bad Mon Sep 17 00:00:00 2001
From: Uwe Ohse <uwe@ohse.de>
Date: Mon, 2 Mar 2020 21:26:21 +0000
Subject: [PATCH] remove old prototypes
Upstream: 7cdaef47634d2d8944a4192bb87c6e57dd24c41f
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/lsz.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/lsz.c b/src/lsz.c
index 1598150..b8041b2 100644
--- a/src/lsz.c
+++ b/src/lsz.c
@@ -51,12 +51,6 @@ void *mm_addr=NULL;
#include "xstrtoul.h"
#include "error.h"
-#ifndef STRICT_PROTOTYPES
-extern time_t time();
-extern char *strerror();
-extern char *strstr();
-#endif
-
#ifndef HAVE_ERRNO_DECLARATION
extern int errno;
#endif
--
2.50.1

View File

@@ -11,7 +11,9 @@ LRZSZ_LICENSE = GPL-2.0+
LRZSZ_LICENSE_FILES = COPYING
LRZSZ_CPE_ID_VALID = YES
LRZSZ_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
LRZSZ_CONF_ENV = LIBS=$(TARGET_NLS_LIBS)
LRZSZ_CONF_ENV = \
ac_cv_type_signal=void \
LIBS=$(TARGET_NLS_LIBS)
define LRZSZ_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/src/lrz $(TARGET_DIR)/usr/bin/rz