commit:     1dc5bd0a25acd202393010f3c0ff396b06793e12
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 18 10:36:51 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 18 10:36:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1dc5bd0a

app-arch/pigz: fix compat w/ zlib-1.3

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-arch/pigz/files/pigz-2.7-zlib-1.3.patch | 22 ++++++++++++++++
 app-arch/pigz/pigz-2.7-r2.ebuild            | 41 +++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff --git a/app-arch/pigz/files/pigz-2.7-zlib-1.3.patch 
b/app-arch/pigz/files/pigz-2.7-zlib-1.3.patch
new file mode 100644
index 000000000000..232dc3787ab7
--- /dev/null
+++ b/app-arch/pigz/files/pigz-2.7-zlib-1.3.patch
@@ -0,0 +1,22 @@
+https://github.com/madler/pigz/issues/111
+https://github.com/madler/pigz/commit/907ca0763be4547a9b0cce8c1057217488149744
+
+From 907ca0763be4547a9b0cce8c1057217488149744 Mon Sep 17 00:00:00 2001
+From: Mark Adler <mad...@alumni.caltech.edu>
+Date: Fri, 18 Aug 2023 03:27:12 -0700
+Subject: [PATCH] Make pigz compatible with two-component zlib version numbers.
+
+zlib 1.3 (not 1.3.0) broke the zlib_vernum() function in pigz.
+This commit fixes that.
+--- a/pigz.c
++++ b/pigz.c
+@@ -1333,7 +1333,7 @@ local long zlib_vernum(void) {
+         }
+         ver++;
+     } while (left);
+-    return left < 2 ? num << (left << 2) : -1;
++    return left < 3 ? num << (left << 2) : -1;
+ }
+ 
+ // -- check value combination routines for parallel calculation --
+

diff --git a/app-arch/pigz/pigz-2.7-r2.ebuild b/app-arch/pigz/pigz-2.7-r2.ebuild
new file mode 100644
index 000000000000..8f054ba7cec4
--- /dev/null
+++ b/app-arch/pigz/pigz-2.7-r2.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="A parallel implementation of gzip"
+HOMEPAGE="https://www.zlib.net/pigz/";
+SRC_URI="https://www.zlib.net/pigz/${P}.tar.gz";
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~ppc-macos"
+IUSE="static test"
+RESTRICT="!test? ( test )"
+
+LIB_DEPEND="sys-libs/zlib[static-libs(+)]"
+RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+DEPEND="
+       ${RDEPEND}
+       static? ( ${LIB_DEPEND} )
+       test? ( app-arch/ncompress )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-memcpy-ub.patch
+       "${FILESDIR}"/${P}-zlib-1.3.patch
+)
+
+src_compile() {
+       use static && append-ldflags -static
+       emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
+}
+
+src_install() {
+       dobin ${PN}
+       dosym ${PN} /usr/bin/un${PN}
+       dodoc README
+       doman ${PN}.1
+}

Reply via email to