commit:     3877bb3d71236c4d039a022825c1733ae0683db0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 17 21:47:42 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 17 21:52:52 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3877bb3d

sys-libs/zlib-ng: add 2.0.7

Bug: https://bugs.gentoo.org/901983
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/zlib-ng/Manifest             |  1 +
 sys-libs/zlib-ng/zlib-ng-2.0.7.ebuild | 78 +++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)

diff --git a/sys-libs/zlib-ng/Manifest b/sys-libs/zlib-ng/Manifest
index 1eddb8bdf40a..83cf6ac918fc 100644
--- a/sys-libs/zlib-ng/Manifest
+++ b/sys-libs/zlib-ng/Manifest
@@ -1 +1,2 @@
 DIST zlib-ng-2.0.6.tar.gz 817951 BLAKE2B 
52993caadf14817e328b180d728586e1332ea04504288264934ef49441cb8b8c4a2412d4c11d1982f3764fef5e4fb7ebab442b407e57d9d5f08a5b2ed890bba9
 SHA512 
4888f17160d0a87a9b349704047ae0d0dc57237a10e11adae09ace957afa9743cce5191db67cb082991421fc961ce68011199621034d2369c0e7724fad58b4c5
+DIST zlib-ng-2.0.7.tar.gz 853381 BLAKE2B 
89672bd35ee54df72ff995c1b4ed188538011be4cd077e464f21a088b0b70b3f95b4259dc546a65e8d4900dc5bd5bb98041875e361000898b34518f7e008b99b
 SHA512 
1c19a62bb00727ac49049c299fb70060da95b5fafa448144ae4133372ec8c3da15cef6c1303485290f269b23c580696554ca0383dba3e1f9609f65c332981988

diff --git a/sys-libs/zlib-ng/zlib-ng-2.0.7.ebuild 
b/sys-libs/zlib-ng/zlib-ng-2.0.7.ebuild
new file mode 100644
index 000000000000..641a623a64aa
--- /dev/null
+++ b/sys-libs/zlib-ng/zlib-ng-2.0.7.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2023 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,
+# as they copied this practice from sys-libs/zlib upstream.
+
+inherit cmake
+
+DESCRIPTION="Fork of the zlib data compression library"
+HOMEPAGE="https://github.com/zlib-ng/zlib-ng";
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
+
+CPU_USE=( 
cpu_flags_{x86_{avx2,sse2,ssse3,sse4a,pclmul},arm_{crc32,neon},ppc_vsx2} )
+IUSE="compat ${CPU_USE[@]} test"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="compat? ( !sys-libs/zlib )"
+
+src_configure() {
+       local mycmakeargs=(
+               -DZLIB_COMPAT="$(usex compat)"
+               -DZLIB_ENABLE_TESTS="$(usex test)"
+               # Unaligned access is controversial and undefined behaviour
+               # Let's keep it off for now
+               # https://github.com/gentoo/gentoo/pull/17167
+               -DWITH_UNALIGNED="OFF"
+       )
+
+       # The intrinsics options are all defined conditionally, so we need
+       # to enable them on/off per-arch here for now.
+       if use amd64 || use x86 ; then
+               mycmakeargs+=(
+                       -DWITH_AVX2=$(usex cpu_flags_x86_avx2)
+                       -DWITH_SSE2=$(usex cpu_flags_x86_sse2)
+                       -DWITH_SSSE3=$(usex cpu_flags_x86_ssse3)
+                       -DWITH_SSE4=$(usex cpu_flags_x86_sse4a)
+                       -DWITH_PCLMULQDQ=$(usex cpu_flags_x86_pclmul)
+               )
+       fi
+
+       if use arm || use arm64 ; then
+               mycmakeargs+=(
+                       -DWITH_ACLE=$(usex cpu_flags_arm_crc32)
+                       -DWITH_NEON=$(usex cpu_flags_arm_neon)
+               )
+       fi
+
+       if use ppc || use ppc64 ; then
+               # The POWER8 support is VSX which was introduced
+               # VSX2 was introduced with POWER8, so use that as a proxy for it
+               mycmakeargs+=(
+                       -DWITH_POWER8=$(usex cpu_flags_ppc_vsx2)
+               )
+       fi
+
+       # TODO: There's no s390x USE_EXPAND yet
+
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       if use compat ; then
+               ewarn "zlib-ng is experimental and replacing the system zlib is 
dangerous"
+               ewarn "Please be careful!"
+               ewarn
+               ewarn "The following link explains the guarantees (and what is 
NOT guaranteed):"
+               ewarn "https://github.com/zlib-ng/zlib-ng/blob/2.0.x/PORTING.md";
+       fi
+}

Reply via email to