Skip to content

Commit

Permalink
app-arch/pigz: fix compat w/ zlib-1.3
Browse files Browse the repository at this point in the history
Signed-off-by: Sam James <[email protected]>
  • Loading branch information
thesamesam committed Aug 18, 2023
1 parent 5c7a27d commit 1dc5bd0
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app-arch/pigz/files/pigz-2.7-zlib-1.3.patch
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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 --

41 changes: 41 additions & 0 deletions app-arch/pigz/pigz-2.7-r2.ebuild
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 1dc5bd0

Please sign in to comment.