sys-libs/zlib: Sync with Gentoo

It's from Gentoo commit 5ff202d5324f48ba662de69887abf53735b23f0d.
This commit is contained in:
Flatcar Buildbot 2025-01-27 07:11:16 +00:00 committed by Krzesimir Nowak
parent 1df80b82b3
commit b1b2a76ae6
6 changed files with 0 additions and 434 deletions

View File

@ -1,4 +1,2 @@
DIST zlib-1.3.1.tar.xz 1305740 BLAKE2B 42d109223801a493de6d52e7343403d7fc3234a6ca816425fe41ac9c18019b01b93841acd28a235e99f2256a6a17f93624e96b2ddb58d588c8190a6bedb82910 SHA512 1e8e70b362d64a233591906a1f50b59001db04ca14aaffad522198b04680be501736e7d536b4191e2f99767e7001ca486cd802362cca2be05d5d409b83ea732d
DIST zlib-1.3.1.tar.xz.asc 235 BLAKE2B b135336ef55a0c4b8e219e760bbe04bad082c405246ce51a2b373c3dfba0b05cb1e6f539363972f4cabd8290be1db1fdb2fc47fb562c6c612a08d9393065f75b SHA512 d181e9772a8139b3b2f3f42b994a65a966101db35eb46b5c84021c5eb0cc3b4511eb5e9172c509483bd9f7015794b15cfca78ed0959bd91e8216dc12c1c6e668
DIST zlib-1.3.tar.xz 1295740 BLAKE2B 5fe0f32339267348a313f23a21e9588bdb180b7415be303c85f5f169444d019e5f176ef7322f6e64297c360acc2a6041c50e2f66d1860e5c392d8970990f176a SHA512 3868ac4da5842dd36c9dad794930675b9082ce15cbd099ddb79c0f6bd20a24aa8f33a123f378f26fe0ae02d91f31f2994dccaac565cedeaffed7b315e6ded2a2
DIST zlib-1.3.tar.xz.asc 235 BLAKE2B 5fe6ce952699a19e848d0a6e6c3622f934340068fdcd29afb35c74f3c8ae66d04de644800d10b38c743bb2f4852ba28f1a97313cb0e6e6f9b804cbca5289ebbb SHA512 8f3ce5c21938d6abc7e121d2939648a0ce2dc01a8ab4eb001d44eb159935dd0b4f5b5e371b3ecfc0ceb23689e2cefe002065968908503cde15b1bba08aff9db6

View File

@ -1,88 +0,0 @@
From 4232e67ee1440634af8209c7022dfc64cf862819 Mon Sep 17 00:00:00 2001
From: Adrian Ratiu <adrian.ratiu@collabora.com>
Date: Mon, 17 Jan 2022 10:49:58 +0200
Subject: [PATCH v3] configure: fix AR/RANLIB/NM detection
Taken from zlib-devel ML:
https://madler.net/pipermail/zlib-devel_madler.net/2022-January/003322.html
Bug: https://bugs.gentoo.org/831628
Scenarios where ${CROSS_PREFIX}ar & co are set but not desired
are possible, for example in ChromiumOS we use the GNU binutils
tools & GCC to build glibc but LLVM/Clang is used for the rest
of the system.
This allows $AR/$RANLIB/$NM to override default CROSS_PREFIX
tools so they can be set to llvm-ar/ranlib/nm.
Suggested-by: Manoj Gupta <manojgupta@chromium.org>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
---
Changes in v3:
* Whitespace style fixes
* Fixed top level variable tests (eg -z AR -> -z $AR)
* Review and testing as part of Gentoo PR:
https://github.com/gentoo/gentoo/pull/23888
Changes in v2:
* Fixed a typo in the "unset NM" case
---
configure | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index e974d1f..045c616 100755
--- a/configure
+++ b/configure
@@ -46,25 +46,31 @@ VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
# establish commands for library building
-if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
- AR=${AR-"${CROSS_PREFIX}ar"}
- test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
-else
- AR=${AR-"ar"}
- test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
+if [ -z "$AR" ]; then
+ if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
+ AR=${AR-"${CROSS_PREFIX}ar"}
+ test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
+ else
+ AR="ar"
+ test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
+ fi
fi
ARFLAGS=${ARFLAGS-"rc"}
-if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
- RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
- test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
-else
- RANLIB=${RANLIB-"ranlib"}
+if [ -z "$RANLIB" ]; then
+ if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
+ RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
+ test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
+ else
+ RANLIB="ranlib"
+ fi
fi
-if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
- NM=${NM-"${CROSS_PREFIX}nm"}
- test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
-else
- NM=${NM-"nm"}
+if [ -z "$NM" ]; then
+ if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
+ NM=${NM-"${CROSS_PREFIX}nm"}
+ test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
+ else
+ NM="nm"
+ fi
fi
# set defaults before processing command line options
--
2.35.0

View File

@ -1,40 +0,0 @@
https://bugs.gentoo.org/916484
https://github.com/madler/zlib/pull/843
https://github.com/madler/zlib/commit/73331a6a0481067628f065ffe87bb1d8f787d10c
From 73331a6a0481067628f065ffe87bb1d8f787d10c Mon Sep 17 00:00:00 2001
From: Hans Wennborg <hans@chromium.org>
Date: Fri, 18 Aug 2023 11:05:33 +0200
Subject: [PATCH] Reject overflows of zip header fields in minizip.
This checks the lengths of the file name, extra field, and comment
that would be put in the zip headers, and rejects them if they are
too long. They are each limited to 65535 bytes in length by the zip
format. This also avoids possible buffer overflows if the provided
fields are too long.
---
contrib/minizip/zip.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index 3d3d4cadd..0446109b2 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -1043,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
return ZIP_PARAMERROR;
#endif
+ // The filename and comment length must fit in 16 bits.
+ if ((filename!=NULL) && (strlen(filename)>0xffff))
+ return ZIP_PARAMERROR;
+ if ((comment!=NULL) && (strlen(comment)>0xffff))
+ return ZIP_PARAMERROR;
+ // The extra field length must fit in 16 bits. If the member also requires
+ // a Zip64 extra block, that will also need to fit within that 16-bit
+ // length, but that will be checked for later.
+ if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
+ return ZIP_PARAMERROR;
+
zi = (zip64_internal*)file;
if (zi->in_opened_file_inzip == 1)

View File

@ -1,59 +0,0 @@
https://bugs.gentoo.org/879883
https://github.com/madler/zlib/issues/751
From 2ad2713e6cb9166dcede9a020f6913b8189ff0c6 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 23 Nov 2022 04:17:16 +0000
Subject: [PATCH] Revert "Turn off RWX segment warnings on sparc systems."
This breaks building on sparc with older binutils.
This reverts commit 29fd715fd0bdaffee21e2d2d37be8c5a6ac67ee4.
--- a/Makefile.in
+++ b/Makefile.in
@@ -22,7 +22,7 @@ CFLAGS=-O
SFLAGS=-O
LDFLAGS=
-TEST_LDFLAGS=$(LDFLAGS) -L. libz.a
+TEST_LDFLAGS=-L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
@@ -288,10 +288,10 @@ minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
examplesh$(EXE): example.o $(SHAREDLIBV)
- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
+ $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
+ $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
--- a/configure
+++ b/configure
@@ -33,10 +33,7 @@ fi
# set command prefix for cross-compilation
if [ -n "${CHOST}" ]; then
uname=${CHOST}
- mname=${CHOST}
CROSS_PREFIX="${CHOST}-"
-else
- mname=`(uname -a || echo unknown) 2>/dev/null`
fi
# destination name for static library
@@ -223,10 +220,6 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
fi
case "$uname" in
Linux* | linux* | *-linux* | GNU | GNU/* | solaris*)
- case "$mname" in
- *sparc*)
- LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;;
- esac
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
*BSD | *bsd* | DragonFly)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}

View File

@ -1,72 +0,0 @@
https://github.com/madler/zlib/pull/599
Rebased version of:
From 37c9730ba474d274f4cc6a974943eef95087b9f6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 8 Mar 2022 22:38:47 -0800
Subject: [PATCH] configure: Pass LDFLAGS to link tests
LDFLAGS can contain critical flags without which linking wont succeed
therefore ensure that all configure tests involving link time checks are
using LDFLAGS on compiler commandline along with CFLAGS to ensure the
tests perform correctly. Without this some tests may fail resulting in
wrong confgure result, ending in miscompiling the package
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/configure
+++ b/configure
@@ -436,7 +436,7 @@ if test $shared -eq 1; then
echo Checking for shared library support... | tee -a configure.log
# we must test in two steps (cc then ld), required at least on SunOS 4.x
if try $CC -w -c $SFLAGS $test.c &&
- try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
+ try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
elif test -z "$old_cc" -a -z "$old_cflags"; then
echo No shared library support. | tee -a configure.log
@@ -498,7 +498,7 @@ int main(void) {
}
EOF
fi
- if try $CC $CFLAGS -o $test $test.c; then
+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
sizet=`./$test`
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
@@ -532,7 +532,7 @@ int main(void) {
return 0;
}
EOF
- if try $CC $CFLAGS -o $test $test.c; then
+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
echo "Checking for fseeko... Yes." | tee -a configure.log
else
CFLAGS="${CFLAGS} -DNO_FSEEKO"
@@ -549,7 +549,7 @@ cat > $test.c <<EOF
#include <errno.h>
int main() { return strlen(strerror(errno)); }
EOF
-if try $CC $CFLAGS -o $test $test.c; then
+if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
echo "Checking for strerror... Yes." | tee -a configure.log
else
CFLAGS="${CFLAGS} -DNO_STRERROR"
@@ -656,7 +656,7 @@ int main()
return (mytest("Hello%d\n", 1));
}
EOF
- if try $CC $CFLAGS -o $test $test.c; then
+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
echo >> configure.log
@@ -746,7 +746,7 @@ int main()
}
EOF
- if try $CC $CFLAGS -o $test $test.c; then
+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
echo >> configure.log

View File

@ -1,173 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Worth keeping an eye on 'develop' branch upstream for possible backports.
AUTOTOOLS_AUTO_DEPEND="no"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/madler.asc
inherit autotools edo multilib-minimal flag-o-matic verify-sig
DESCRIPTION="Standard (de)compression library"
HOMEPAGE="https://zlib.net/"
SRC_URI="
https://zlib.net/${P}.tar.xz
https://zlib.net/fossils/${P}.tar.xz
https://zlib.net/current/beta/${P}.tar.xz
https://github.com/madler/zlib/releases/download/v${PV}/${P}.tar.xz
verify-sig? (
https://zlib.net/${P}.tar.xz.asc
https://github.com/madler/zlib/releases/download/v${PV}/${P}.tar.xz.asc
)
"
LICENSE="ZLIB"
SLOT="0/1" # subslot = SONAME
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="minizip static-libs"
RDEPEND="!sys-libs/zlib-ng[compat]"
DEPEND="${RDEPEND}"
BDEPEND="
minizip? ( ${AUTOTOOLS_DEPEND} )
verify-sig? ( sec-keys/openpgp-keys-madler )
"
PATCHES=(
# Don't install unexpected & unused crypt.h header (which would clash with other pkgs)
# Pending upstream. bug #658536
"${FILESDIR}"/${PN}-1.2.11-minizip-drop-crypt-header.patch
# Respect AR, RANLIB, NM during build. Pending upstream. bug #831628
"${FILESDIR}"/${PN}-1.2.11-configure-fix-AR-RANLIB-NM-detection.patch
# Respect LDFLAGS during configure tests. Pending upstream
"${FILESDIR}"/${PN}-1.2.13-use-LDFLAGS-in-configure.patch
# Fix building on sparc with older binutils, we pass it in ebuild instead
"${FILESDIR}"/${PN}-1.2.13-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch
# CVE-2023-45853 (bug #916484)
"${FILESDIR}"/${PN}-1.2.13-CVE-2023-45853.patch
)
src_prepare() {
default
if use minizip ; then
cd contrib/minizip || die
eautoreconf
fi
case ${CHOST} in
*-mingw*|mingw*)
# Uses preconfigured Makefile rather than configure script
multilib_copy_sources
;;
esac
}
multilib_src_configure() {
# We pass manually instead of relying on the configure script/makefile
# because it would pass it even for older binutils.
use sparc && append-flags $(test-flags-CCLD -Wl,--no-warn-rwx-segments)
append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
case ${CHOST} in
*-mingw*|mingw*)
;;
*)
# bug #347167
local uname=$("${BROOT}"/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3)
local myconf=(
--shared
--prefix="${EPREFIX}/usr"
--libdir="${EPREFIX}/usr/$(get_libdir)"
${uname:+--uname=${uname}}
)
# Not an autoconf script, so can't use econf
edo "${S}"/configure "${myconf[@]}"
;;
esac
if use minizip ; then
local minizipdir="contrib/minizip"
mkdir -p "${BUILD_DIR}/${minizipdir}" || die
cd ${minizipdir} || die
ECONF_SOURCE="${S}/${minizipdir}" econf $(use_enable static-libs static)
fi
}
multilib_src_compile() {
case ${CHOST} in
*-mingw*|mingw*)
emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}-
sed \
-e 's|@prefix@|'"${EPREFIX}"'/usr|g' \
-e 's|@exec_prefix@|${prefix}|g' \
-e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
-e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
-e 's|@includedir@|${prefix}/include|g' \
-e 's|@VERSION@|'${PV}'|g' \
zlib.pc.in > zlib.pc || die
;;
*)
emake
;;
esac
use minizip && emake -C contrib/minizip
}
multilib_src_install() {
case ${CHOST} in
*-mingw*|mingw*)
emake -f win32/Makefile.gcc install \
BINARY_PATH="${ED}/usr/bin" \
LIBRARY_PATH="${ED}/usr/$(get_libdir)" \
INCLUDE_PATH="${ED}/usr/include" \
SHARED_MODE=1
# Overwrites zlib.pc created from win32/Makefile.gcc, bug #620136
insinto /usr/$(get_libdir)/pkgconfig
doins zlib.pc
;;
*)
emake install DESTDIR="${D}" LDCONFIG=:
;;
esac
if use minizip ; then
emake -C contrib/minizip install DESTDIR="${D}"
# This might not exist if slibtool is used.
# bug #816756
rm -f "${ED}"/usr/$(get_libdir)/libminizip.la || die
fi
if ! use static-libs ; then
# bug #419645
rm "${ED}"/usr/$(get_libdir)/libz.a || die
fi
}
multilib_src_install_all() {
dodoc FAQ README ChangeLog doc/*.txt
if use minizip ; then
dodoc contrib/minizip/*.txt
doman contrib/minizip/*.1
fi
}