main/zip: fix build with gcc14

This commit is contained in:
Natanael Copa 2024-08-05 12:16:36 +02:00
parent a4f970ce8c
commit 14226268fa
2 changed files with 174 additions and 1 deletions

View file

@ -2,7 +2,7 @@
pkgname=zip
pkgver=3.0
_pkgver=${pkgver%.*}${pkgver##*.}
pkgrel=12
pkgrel=13
pkgdesc="Creates PKZIP-compatible .zip files"
url="http://www.info-zip.org/pub/infozip/Zip.html"
arch="all"
@ -16,6 +16,7 @@ source="https://downloads.sourceforge.net/infozip/zip$_pkgver.tar.gz
30-zip-3.0-pic.patch
40-fix-zipnote.patch
format-security.patch
configure-gcc14.patch
"
builddir="$srcdir"/${pkgname}$_pkgver
@ -36,4 +37,5 @@ e71f7c6f6dd6f8f576018581b155f324eaf6810a2f7c5c402843bdfc3ce6772f09be166b33ff34dc
fcb2d728d79160128064af90eb17a9c03e980d9619c4d930c4dbf79cb13842c7bb694036dcbf5cd9b412efc6fc0b86bb94a88b3f110b6b63bf6bda2b97fe0568 30-zip-3.0-pic.patch
f22649d1cbe94ffcacf622493400489393d6fac80067211e6ba12b85d7b062f76b041f318068731b267167e715b7749589bfe9205670a61c6e56e1ffdfaea29b 40-fix-zipnote.patch
1d2147e97e9e19ac403ec6fb3466059dba96edeee2ac2a809b75c652d50d01d9ce717c1d9812359c8d13330369e60f6421afdb9e54e3e19d6bcf0ddf2405b15e format-security.patch
fd952e9e3cd9535c94f17baeeb34a51ba7b34d604b96620c9f85e458e9a71269e357ec825eb2ee37f34a57d36332e3a79e776e72490a4a67fe42d0832ecc5d95 configure-gcc14.patch
"

View file

@ -0,0 +1,171 @@
diff --git a/unix/configure b/unix/configure
index d22d2f5..f2e682d 100644
--- a/unix/configure
+++ b/unix/configure
@@ -507,55 +507,60 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
for func in rmdir strchr strrchr rename mktemp mktime mkstemp
do
- echo Check for $func
+ printf "Check for %s ... " "$func"
echo "int main(){ $func(); return 0; }" > conftest.c
- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
+ $CC $BFLAG -o conftest -Wno-implicit-function-declaration conftest.c #>/dev/null 2>/dev/null
+ [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`" && echo no || echo yes
done
-echo Check for memset
-echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
+printf "Check for memset ... "
+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 ] && CFLAGS="${CFLAGS} -DZMEM" && echo no || echo yes
-echo Check for memmove
+printf "Check for memmove ... "
cat > conftest.c << _EOF_
#include <string.h>
int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
_EOF_
$CC -o conftest conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_MEMMOVE"
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_MEMMOVE" && echo no || echo yes
-echo Check for strerror
+printf "Check for strerror ... "
cat > conftest.c << _EOF_
#include <string.h>
int main() { strerror( 0); return 0; }
_EOF_
$CC -o conftest conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_STRERROR"
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_STRERROR" && echo no || echo yes
-echo Check for errno declaration
+printf "Check for errno declaration ... "
cat > conftest.c << _EOF_
#include <errno.h>
-main()
+int main()
{
errno = 0;
return 0;
}
_EOF_
-$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO"
+$CC $CFLAGS -c conftest.c #>/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO" && echo no || echo yes
-echo Check for directory libraries
+printf "Check for directory libraries ... "
cat > conftest.c << _EOF_
+#include <sys/types.h>
+#include <dirent.h>
int main() { return closedir(opendir(".")); }
_EOF_
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+$CC -o conftest conftest.c && echo "none" #>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
OPT=""
for lib in ndir dir ucb bsd BSD PW x dirent
@@ -565,67 +570,73 @@ if [ $? -ne 0 ]; then
done
if [ ${OPT} ]; then
LFLAGS2="${LFLAGS2} ${OPT}"
+ echo "$lib"
else
CFLAGS="${CFLAGS} -DNO_DIR"
+ echo no
fi
fi
# Dynix/ptx 1.3 needed this
-echo Check for readlink
-echo "int main(){ return readlink(); }" > conftest.c
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+printf "Check for readlink ... "
+cat > conftest.c << _EOF_
+#include <unistd.h>
+int main(){ return readlink(NULL, NULL, 0); }
+_EOF_
+$CC -o conftest conftest.c && echo yes
if [ $? -ne 0 ]; then
$CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
- [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
+ [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq" && echo yes || echo no
fi
-echo Check for directory include file
+printf "Check for directory include file ... "
OPT=""
for inc in dirent.h sys/ndir.h ndir.h sys/dir.h
do
echo "#include <$inc>" > conftest.c
$CPP conftest.c > /dev/null 2>/dev/null
- [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
+ [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && echo "$inc" && break
done
CFLAGS="${CFLAGS} ${OPT}"
-echo Check for nonexistent include files
for inc in stdlib.h stddef.h unistd.h fcntl.h string.h
do
+ printf "Check for <%s> ... " "$inc"
echo "#include <$inc>" > conftest.c
$CPP conftest.c >/dev/null 2>/dev/null
- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
+ [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && echno no || echo yes
done
-
-echo Check for term I/O include file
+printf "Check for term I/O include file ... "
OPT=""
for inc in termios.h termio.h sgtty.h
do
echo "#include <$inc>" > conftest.c
$CPP conftest.c > /dev/null 2>/dev/null
- [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
+ [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && echo "$inc" && break
done
CFLAGS="${CFLAGS} ${OPT}"
# needed for AIX (and others ?) when mmap is used
-echo Check for valloc
+printf "Check for valloc ... "
cat > conftest.c << _EOF_
-main()
+#include <unistd.h>
+int main()
{
#ifdef MMAP
valloc();
#endif
+return 0;
}
_EOF_
-$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
+$CC ${CFLAGS} -c conftest.c #> /dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC" && echo no || echo yes
echo Check for /usr/local/bin and /usr/local/man