6 |
6 |
# Worth keeping an eye on 'develop' branch upstream for possible backports,
|
7 |
7 |
# as they copied this practice from sys-libs/zlib upstream.
|
8 |
8 |
|
9 |
|
inherit cmake
|
|
9 |
inherit cmake-multilib
|
10 |
10 |
|
11 |
11 |
DESCRIPTION="Fork of the zlib data compression library"
|
12 |
12 |
HOMEPAGE="https://github.com/zlib-ng/zlib-ng"
|
... | ... | |
16 |
16 |
SLOT="0"
|
17 |
17 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
|
18 |
18 |
|
19 |
|
CPU_USE=( cpu_flags_{x86_{avx2,sse2,ssse3,sse4a,pclmul},arm_{crc32,neon},ppc_vsx2} )
|
20 |
|
IUSE="compat ${CPU_USE[@]} test"
|
|
19 |
CPU_USE=(
|
|
20 |
x86_{avx2,avx512f,sse2,ssse3,sse4_2,pclmul}
|
|
21 |
arm_{crc32,neon}
|
|
22 |
ppc_{altivec,vsx2,vsx3}
|
|
23 |
)
|
|
24 |
IUSE="compat ${CPU_USE[@]/#/cpu_flags_} test"
|
21 |
25 |
|
22 |
26 |
RESTRICT="!test? ( test )"
|
23 |
27 |
|
24 |
28 |
RDEPEND="compat? ( !sys-libs/zlib )"
|
25 |
29 |
|
26 |
|
src_configure() {
|
|
30 |
PATCHES=(
|
|
31 |
"${FILESDIR}"/zlib-ng-2.1.2-cmake.patch
|
|
32 |
)
|
|
33 |
|
|
34 |
multilib_src_configure() {
|
27 |
35 |
local mycmakeargs=(
|
28 |
|
-DZLIB_COMPAT="$(usex compat)"
|
29 |
|
-DZLIB_ENABLE_TESTS="$(usex test)"
|
|
36 |
-DZLIB_COMPAT=$(usex compat)
|
|
37 |
-DZLIB_ENABLE_TESTS=$(usex test)
|
|
38 |
-DWITH_GTEST=$(usex test)
|
|
39 |
|
30 |
40 |
# Unaligned access is controversial and undefined behaviour
|
31 |
41 |
# Let's keep it off for now
|
32 |
42 |
# https://github.com/gentoo/gentoo/pull/17167
|
33 |
|
-DWITH_UNALIGNED="OFF"
|
|
43 |
-DWITH_UNALIGNED=OFF
|
34 |
44 |
)
|
35 |
45 |
|
36 |
46 |
# The intrinsics options are all defined conditionally, so we need
|
37 |
47 |
# to enable them on/off per-arch here for now.
|
|
48 |
# TODO: There's no s390x USE_EXPAND yet
|
38 |
49 |
if use amd64 || use x86 ; then
|
39 |
50 |
mycmakeargs+=(
|
40 |
51 |
-DWITH_AVX2=$(usex cpu_flags_x86_avx2)
|
|
52 |
-DWITH_AVX512=$(usex cpu_flags_x86_avx512f)
|
|
53 |
-DWITH_AVX512VNNI=OFF # TODO, see bug #908556
|
41 |
54 |
-DWITH_SSE2=$(usex cpu_flags_x86_sse2)
|
42 |
55 |
-DWITH_SSSE3=$(usex cpu_flags_x86_ssse3)
|
43 |
|
-DWITH_SSE4=$(usex cpu_flags_x86_sse4a)
|
|
56 |
-DWITH_SSE42=$(usex cpu_flags_x86_sse4_2)
|
44 |
57 |
-DWITH_PCLMULQDQ=$(usex cpu_flags_x86_pclmul)
|
|
58 |
-DWITH_VPCLMULQDQ=OFF # TODO, see bug #908556
|
45 |
59 |
)
|
46 |
60 |
fi
|
47 |
61 |
|
... | ... | |
56 |
70 |
# The POWER8 support is VSX which was introduced
|
57 |
71 |
# VSX2 was introduced with POWER8, so use that as a proxy for it
|
58 |
72 |
mycmakeargs+=(
|
|
73 |
-DWITH_ALTIVEC=$(usex cpu_flags_ppc_altivec)
|
59 |
74 |
-DWITH_POWER8=$(usex cpu_flags_ppc_vsx2)
|
|
75 |
-DWITH_POWER9=$(usex cpu_flags_ppc_vsx3)
|
60 |
76 |
)
|
61 |
77 |
fi
|
62 |
78 |
|
63 |
|
# TODO: There's no s390x USE_EXPAND yet
|
64 |
|
|
65 |
79 |
cmake_src_configure
|
66 |
80 |
}
|
67 |
81 |
|
68 |
|
src_install() {
|
69 |
|
cmake_src_install
|
70 |
|
|
|
82 |
pkg_postinst() {
|
71 |
83 |
if use compat ; then
|
72 |
84 |
ewarn "zlib-ng is experimental and replacing the system zlib is dangerous"
|
73 |
85 |
ewarn "Please be careful!"
|