diff options
Diffstat (limited to 'sys-libs/zlib')
14 files changed, 802 insertions, 231 deletions
diff --git a/sys-libs/zlib/Manifest b/sys-libs/zlib/Manifest index 9a8e50982b8b..74c4bb0f8222 100644 --- a/sys-libs/zlib/Manifest +++ b/sys-libs/zlib/Manifest @@ -1,3 +1,4 @@ -DIST zlib-1.2.11-cygwin-gzopen_w.patch 1170 BLAKE2B fe351436716634bd823da8c2811d332327d335d450d89bee85d7713b09dd454fe6aee264b044a41bf3be603aa36d67943ba6c7d8b46470e180e9b639728b5274 SHA512 14cc63a17fbf6afb6c8a8dd0b92df9807b48e0faf09c88f952083f10716ae62be8de2a0e1424b77fb538605b88898b381160521f2872afdda59e12bd27535c5a -DIST zlib-1.2.11.tar.gz 607698 BLAKE2B 6bfc4bca5dcadba8a0d4121a2b3ed0bfe440c261003521862c8e6381f1a6f0a72d3fc037351d30afd7ef321e8e8d2ec817c046ac749f2ca0c97fbdc2f7e840b7 SHA512 73fd3fff4adeccd4894084c15ddac89890cd10ef105dd5e1835e1e9bbb6a49ff229713bd197d203edfa17c2727700fce65a2a235f07568212d820dca88b528ae -DIST zlib-1.2.7-cygwin-minizip.patch 2626 BLAKE2B 885f1fda877c0b783618b163702fb46126b7db572767cd4edb86bd92db1f432c887ef1724e70c8319c26886368dba3a962af5284ec0875c20ec8ad2245fd100a SHA512 e372f1e06311e843eca2092e182c41abb009b5e9880b60292d708e4bc0de5a9e4c43d49b25b0c09df4784bc46a1254472bc5cdbdd8d6c762a9f6a145a555bfe7 +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 diff --git a/sys-libs/zlib/files/zlib-1.2.11-configure-fix-AR-RANLIB-NM-detection.patch b/sys-libs/zlib/files/zlib-1.2.11-configure-fix-AR-RANLIB-NM-detection.patch new file mode 100644 index 000000000000..1ab5b2f5dc81 --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.2.11-configure-fix-AR-RANLIB-NM-detection.patch @@ -0,0 +1,88 @@ +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 + diff --git a/sys-libs/zlib/files/zlib-1.2.11-fix-deflateParams-usage.patch b/sys-libs/zlib/files/zlib-1.2.11-fix-deflateParams-usage.patch deleted file mode 100644 index 18764849b945..000000000000 --- a/sys-libs/zlib/files/zlib-1.2.11-fix-deflateParams-usage.patch +++ /dev/null @@ -1,67 +0,0 @@ -From f9694097dd69354b03cb8af959094c7f260db0a1 Mon Sep 17 00:00:00 2001 -From: Mark Adler <madler@alumni.caltech.edu> -Date: Mon, 16 Jan 2017 09:49:35 -0800 -Subject: [PATCH] Permit a deflateParams() parameter change as soon as - possible. - -This commit allows a parameter change even if the input data has -not all been compressed and copied to the application output -buffer, so long as all of the input data has been compressed to -the internal pending output buffer. This also allows an immediate -deflateParams change so long as there have been no deflate calls -since initialization or reset. ---- - deflate.c | 6 +++--- - zlib.h | 11 ++++++----- - 2 files changed, 9 insertions(+), 8 deletions(-) - -diff --git a/deflate.c b/deflate.c -index b63311a5..20bda4f6 100644 ---- a/deflate.c -+++ b/deflate.c -@@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm) - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : - #endif - adler32(0L, Z_NULL, 0); -- s->last_flush = Z_NO_FLUSH; -+ s->last_flush = -2; - - _tr_init(s); - -@@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy) - func = configuration_table[s->level].func; - - if ((strategy != s->strategy || func != configuration_table[level].func) && -- s->high_water) { -+ s->last_flush != -2) { - /* Flush the last buffer: */ - int err = deflate(strm, Z_BLOCK); - if (err == Z_STREAM_ERROR) - return err; -- if (strm->avail_out == 0) -+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) - return Z_BUF_ERROR; - } - if (s->level != level) { -diff --git a/zlib.h b/zlib.h -index 5daf4f28..577d81e3 100644 ---- a/zlib.h -+++ b/zlib.h -@@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression approach (which is a function of the level) or the -- strategy is changed, and if any input has been consumed in a previous -- deflate() call, then the input available so far is compressed with the old -- level and strategy using deflate(strm, Z_BLOCK). There are three approaches -- for the compression levels 0, 1..3, and 4..9 respectively. The new level -- and strategy will take effect at the next call of deflate(). -+ strategy is changed, and if there have been any deflate() calls since the -+ state was initialized or reset, then the input available so far is -+ compressed with the old level and strategy using deflate(strm, Z_BLOCK). -+ There are three approaches for the compression levels 0, 1..3, and 4..9 -+ respectively. The new level and strategy will take effect at the next call -+ of deflate(). - - If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does - not have enough output space to complete, then the parameter change will not diff --git a/sys-libs/zlib/files/zlib-1.2.13-CVE-2023-45853.patch b/sys-libs/zlib/files/zlib-1.2.13-CVE-2023-45853.patch new file mode 100644 index 000000000000..ecb5acecbb33 --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.2.13-CVE-2023-45853.patch @@ -0,0 +1,40 @@ +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) diff --git a/sys-libs/zlib/files/zlib-1.2.13-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch b/sys-libs/zlib/files/zlib-1.2.13-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch new file mode 100644 index 000000000000..b5a1b4de2c47 --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.2.13-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch @@ -0,0 +1,59 @@ +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"} diff --git a/sys-libs/zlib/files/zlib-1.2.13-use-LDFLAGS-in-configure.patch b/sys-libs/zlib/files/zlib-1.2.13-use-LDFLAGS-in-configure.patch new file mode 100644 index 000000000000..9f2b240334e8 --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.2.13-use-LDFLAGS-in-configure.patch @@ -0,0 +1,72 @@ +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 diff --git a/sys-libs/zlib/files/zlib-1.3.1-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch b/sys-libs/zlib/files/zlib-1.3.1-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch new file mode 100644 index 000000000000..5bfb8006c4bb --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.3.1-Revert-Turn-off-RWX-segment-warnings-on-sparc-system.patch @@ -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"} diff --git a/sys-libs/zlib/files/zlib-1.3.1-configure-fix-AR-RANLIB-NM-detection.patch b/sys-libs/zlib/files/zlib-1.3.1-configure-fix-AR-RANLIB-NM-detection.patch new file mode 100644 index 000000000000..e1e5cf4b9196 --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.3.1-configure-fix-AR-RANLIB-NM-detection.patch @@ -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 + diff --git a/sys-libs/zlib/files/zlib-1.3.1-configure-fix-AR-libtool-on-darwin.patch b/sys-libs/zlib/files/zlib-1.3.1-configure-fix-AR-libtool-on-darwin.patch new file mode 100644 index 000000000000..4506e753ca2e --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.3.1-configure-fix-AR-libtool-on-darwin.patch @@ -0,0 +1,22 @@ +diff --color -ur zlib-1.3.1/configure zlib-1.3.1.new/configure +--- zlib-1.3.1/configure 2024-01-21 02:29:31.000000000 +0000 ++++ zlib-1.3.1.new/configure 2024-02-17 19:37:10.614600000 +0000 +@@ -265,14 +265,16 @@ + SHAREDLIBV=libz.$VER$shared_ext + SHAREDLIBM=libz.$VER1$shared_ext + LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} ++ if test -z ${AR}; then + if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then + AR="${CROSS_PREFIX}libtool" + elif libtool -V 2>&1 | grep Apple > /dev/null; then + AR="libtool" + else + AR="/usr/bin/libtool" + fi +- ARFLAGS="-o" ;; ++ ARFLAGS="-o" ++ fi ;; + *) + LDSHARED=${LDSHARED-"$cc -shared"} ;; + esac + diff --git a/sys-libs/zlib/files/zlib-1.3.1-use-LDFLAGS-in-configure.patch b/sys-libs/zlib/files/zlib-1.3.1-use-LDFLAGS-in-configure.patch new file mode 100644 index 000000000000..2b1d70f7b6f6 --- /dev/null +++ b/sys-libs/zlib/files/zlib-1.3.1-use-LDFLAGS-in-configure.patch @@ -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 diff --git a/sys-libs/zlib/metadata.xml b/sys-libs/zlib/metadata.xml index a45bfbc4ee9e..4d41ee8a0c0b 100644 --- a/sys-libs/zlib/metadata.xml +++ b/sys-libs/zlib/metadata.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <maintainer type="project"> <email>base-system@gentoo.org</email> diff --git a/sys-libs/zlib/zlib-1.2.11-r4.ebuild b/sys-libs/zlib/zlib-1.2.11-r4.ebuild deleted file mode 100644 index 5dfe56381a95..000000000000 --- a/sys-libs/zlib/zlib-1.2.11-r4.ebuild +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -AUTOTOOLS_AUTO_DEPEND="no" -inherit autotools multilib-minimal usr-ldscript - -CYGWINPATCHES=( - "https://github.com/cygwinports/zlib/raw/22a3462cae33a82ad966ea0a7d6cbe8fc1368fec/1.2.11-gzopen_w.patch -> ${PN}-1.2.11-cygwin-gzopen_w.patch" - "https://github.com/cygwinports/zlib/raw/22a3462cae33a82ad966ea0a7d6cbe8fc1368fec/1.2.7-minizip-cygwin.patch -> ${PN}-1.2.7-cygwin-minizip.patch" -) - -DESCRIPTION="Standard (de)compression library" -HOMEPAGE="https://zlib.net/" -SRC_URI="https://zlib.net/${P}.tar.gz - http://www.gzip.org/zlib/${P}.tar.gz - http://www.zlib.net/current/beta/${P}.tar.gz - elibc_Cygwin? ( ${CYGWINPATCHES[*]} )" - -LICENSE="ZLIB" -SLOT="0/1" # subslot = SONAME -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" -IUSE="minizip static-libs" - -BDEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )" -# See #309623 for libxml2 -RDEPEND=" - !<dev-libs/libxml2-2.7.7 - !sys-libs/zlib-ng[compat] -" -DEPEND="${RDEPEND}" - -PATCHES=( - "${FILESDIR}"/${PN}-1.2.11-fix-deflateParams-usage.patch - "${FILESDIR}"/${PN}-1.2.11-minizip-drop-crypt-header.patch #658536 -) - -src_prepare() { - default - - if use elibc_Cygwin ; then - local p - for p in "${CYGWINPATCHES[@]}" ; do - # Strip out the "... -> " from the array - eapply -p2 "${DISTDIR}/${p#*> }" - done - fi - - if use minizip ; then - cd contrib/minizip || die - eautoreconf - fi - - case ${CHOST} in - *-cygwin*) - # do not use _wopen, is a mingw symbol only - sed -i -e '/define WIDECHAR/d' "${S}"/gzguts.h || die - # zlib1.dll is the mingw name, need cygz.dll - # cygz.dll is loaded by toolchain, put into subdir - sed -i -e 's|zlib1.dll|win32/cygz.dll|' win32/Makefile.gcc || die - ;; - esac - - case ${CHOST} in - *-mingw*|mingw*|*-cygwin*) - # uses preconfigured Makefile rather than configure script - multilib_copy_sources - ;; - esac -} - -echoit() { echo "$@"; "$@"; } - -multilib_src_configure() { - case ${CHOST} in - *-mingw*|mingw*|*-cygwin*) - ;; - *) - local uname=$("${EPREFIX}"/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3) #347167 - local myconf=( - --shared - --prefix="${EPREFIX}/usr" - --libdir="${EPREFIX}/usr/$(get_libdir)" - ${uname:+--uname=${uname}} - ) - # not an autoconf script, so can't use econf - echoit "${S}"/configure "${myconf[@]}" || die - ;; - 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*|*-cygwin*) - 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 -} - -sed_macros() { - # clean up namespace a little #383179 - # we do it here so we only have to tweak 2 files - sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die -} - -multilib_src_install() { - case ${CHOST} in - *-mingw*|mingw*|*-cygwin*) - 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 #620136 - insinto /usr/$(get_libdir)/pkgconfig - doins zlib.pc - ;; - - *) - emake install DESTDIR="${D}" LDCONFIG=: - gen_usr_ldscript -a z - ;; - esac - sed_macros "${ED}"/usr/include/*.h - - if use minizip ; then - emake -C contrib/minizip install DESTDIR="${D}" - sed_macros "${ED}"/usr/include/minizip/*.h - fi - - if ! use static-libs ; then - rm -f "${ED}"/usr/$(get_libdir)/lib{z,minizip}.{a,la} || die #419645 - fi -} - -multilib_src_install_all() { - dodoc FAQ README ChangeLog doc/*.txt - use minizip && dodoc contrib/minizip/*.txt -} diff --git a/sys-libs/zlib/zlib-1.3-r4.ebuild b/sys-libs/zlib/zlib-1.3-r4.ebuild new file mode 100644 index 000000000000..22c5713a4520 --- /dev/null +++ b/sys-libs/zlib/zlib-1.3-r4.ebuild @@ -0,0 +1,173 @@ +# 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 ~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.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 +} diff --git a/sys-libs/zlib/zlib-1.3.1-r1.ebuild b/sys-libs/zlib/zlib-1.3.1-r1.ebuild new file mode 100644 index 000000000000..d328fd643286 --- /dev/null +++ b/sys-libs/zlib/zlib-1.3.1-r1.ebuild @@ -0,0 +1,173 @@ +# 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 ~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 + + # On Darwin, don't force /usr/bin/libtool as AR. bug #924839 + "${FILESDIR}"/${PN}-1.3.1-configure-fix-AR-libtool-on-darwin.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 +} |