sys-libs/zlib: Sync with Gentoo

It's from Gentoo commit 8c5c6c5165a5b5886ac6233e0d11ce9232118ff1.
This commit is contained in:
Flatcar Buildbot 2024-01-29 07:16:04 +00:00 committed by Krzesimir Nowak
parent 08e0667927
commit 8244a6f706
6 changed files with 346 additions and 0 deletions

View File

@ -1,2 +1,4 @@
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,3 +1,6 @@
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

View File

@ -0,0 +1,17 @@
https://bugs.gentoo.org/879883
https://github.com/madler/zlib/issues/751
This breaks building on sparc with older binutils.
--- a/configure
+++ b/configure
@@ -234,10 +234,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

@ -0,0 +1,79 @@
From 7d7c0b3ede7d5c30e3cdc7c6fbb33c9d4499516a 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] 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>
---
configure | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index c55098a..2535e04 100755
--- a/configure
+++ b/configure
@@ -48,25 +48,31 @@ VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'`
VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'`
# 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.43.0

View File

@ -0,0 +1,74 @@
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>k
--- a/configure
+++ b/configure
@@ -448,8 +448,8 @@ EOF
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 -c $SFLAGS $test.c &&
- try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
+ if try $CC -c $SFLAGS $LDFLAGS $test.c &&
+ 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
@@ -511,7 +511,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}"
@@ -545,7 +545,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"
@@ -562,7 +562,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"
@@ -669,7 +669,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
@@ -759,7 +759,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

@ -0,0 +1,171 @@
# 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 usr-ldscript 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 ~ia64 ~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.3.1-configure-fix-AR-RANLIB-NM-detection.patch
# Respect LDFLAGS during configure tests. Pending upstream
"${FILESDIR}"/${PN}-1.3.1-use-LDFLAGS-in-configure.patch
# Fix building on sparc with older binutils, we pass it in ebuild instead
"${FILESDIR}"/${PN}-1.3.1-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.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=:
gen_usr_ldscript -a z
;;
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
}