[PATCH 92/94] app-arch/unzip: fix Hurd build

Sam James <[email protected]>
Newsgroups gmane.linux.gentoo.devel
Message-ID <f1719fbd7e452319f31fae002424dfaf2223c715.1774994378.git.sam@gentoo.org>
I thought I'd tested this last time but I must not have. Fix the
configure script having C99 issues.

Revbump again given unzip is clearly very brittle.

Fixes: a0f340dc761a8c13bc18973e71e99abb6c4ebf4a
Signed-off-by: Sam James <[email protected]>
---
 .../unzip/files/unzip-6.0-c99-configure.patch | 64 +++++++++++++++++++
 ..._p29-r1.ebuild => unzip-6.0_p29-r2.ebuild} |  4 ++
 2 files changed, 68 insertions(+)
 create mode 100644 app-arch/unzip/files/unzip-6.0-c99-configure.patch
 rename app-arch/unzip/{unzip-6.0_p29-r1.ebuild => unzip-6.0_p29-r2.ebuild} (96%)

diff --git a/app-arch/unzip/files/unzip-6.0-c99-configure.patch b/app-arch/unzip/files/unzip-6.0-c99-configure.patch
new file mode 100644
index 0000000000000..55c06db3f032c
--- /dev/null
+++ b/app-arch/unzip/files/unzip-6.0-c99-configure.patch
@@ -0,0 +1,64 @@
+--- a/unix/configure
++++ b/unix/configure
+@@ -382,7 +382,7 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ for func in fchmod fchown lchown nl_langinfo
+ do
+   echo Check for $func
+-  echo "int main(){ $func(); return 0; }" > conftest.c
++  echo "void $func(); int main(){ $func(); return 0; }" > conftest.c
+   $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
+   [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
+ done
+@@ -401,14 +401,18 @@ ln -s "${temp_link}" "${temp_file}" && \
+ rm -f "${temp_file}"
+ 
+ echo Check for memset
+-echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
++cat > conftest.c << _EOF_
++#include <string.h>
++int main(){ char k; memset(&k,0,0); return 0; }
++_EOF_
++
+ $CC -o conftest conftest.c >/dev/null 2>/dev/null
+ [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DZMEM"
+ 
+ echo Check for errno declaration
+ cat > conftest.c << _EOF_
+ #include <errno.h>
+-main()
++int main()
+ {
+   errno = 0;
+   return 0;
+@@ -419,6 +423,8 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
+ 
+ echo Check for directory libraries
+ cat > conftest.c << _EOF_
++#include <sys/types.h>
++#include <dirent.h>
+ int main() { return closedir(opendir(".")); }
+ _EOF_
+ 
+@@ -439,7 +445,11 @@ fi
+ 
+ # Dynix/ptx 1.3 needed this
+ echo Check for readlink
+-echo "int main(){ return readlink(); }" > conftest.c
++cat > conftest.c << _EOF_
++#include <unistd.h>
++int main(){ return readlink(); }
++_EOF_
++
+ $CC -o conftest conftest.c >/dev/null 2>/dev/null
+ if [ $? -ne 0 ]; then
+   $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
+@@ -523,7 +533,8 @@ fi
+ # needed for AIX (and others ?) when mmap is used
+ echo Check for valloc
+ cat > conftest.c << _EOF_
+-main()
++#include <stdlib.h>
++int main()
+ {
+ #ifdef MMAP
+     valloc();
diff --git a/app-arch/unzip/unzip-6.0_p29-r1.ebuild b/app-arch/unzip/unzip-6.0_p29-r2.ebuild
similarity index 96%
rename from app-arch/unzip/unzip-6.0_p29-r1.ebuild
rename to app-arch/unzip/unzip-6.0_p29-r2.ebuild
index c94a553316783..a6d06018bbdf5 100644
--- a/app-arch/unzip/unzip-6.0_p29-r1.ebuild
+++ b/app-arch/unzip/unzip-6.0_p29-r2.ebuild
@@ -33,6 +33,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-6.0-no-exec-stack.patch
 	"${FILESDIR}"/${PN}-6.0-format-security.patch
 	"${FILESDIR}"/${PN}-6.0-fix-false-overlap-detection-on-32bit-systems.patch
+	"${FILESDIR}"/${PN}-6.0-c99-configure.patch
 )
 
 src_prepare() {
@@ -43,6 +44,9 @@ src_prepare() {
 
 	default
 
+	sed -i \
+		-e 's:LFLAGS2="-s":LFLAGS2=:' \
+		unix/configure || die
 	sed -i -r \
 		-e '/^CFLAGS/d' \
 		-e '/CFLAGS/s:-O[0-9]?:$(CFLAGS) $(CPPFLAGS):' \
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.