commit: d040971837115908259b477bcfd11c4834da22b5 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Tue Oct 28 10:54:47 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Tue Oct 28 11:32:19 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0409718
sys-libs/minizip-ng: Make USE=compat build minizip-ng as well Build both libminizip-ng and libminizip when USE=compat is enabled. This permits users to use minizip-ng as minizip provider without breaking packages that actually need minizip-ng. While at it, I've reenabled all tests, since they all pass for me. I've also replaced -j1 with CTEST_JOBS=1 which seems to be the cleaner way of expressing it. Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/44364 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> sys-libs/minizip-ng/minizip-ng-4.0.10-r1.ebuild | 105 ++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/sys-libs/minizip-ng/minizip-ng-4.0.10-r1.ebuild b/sys-libs/minizip-ng/minizip-ng-4.0.10-r1.ebuild new file mode 100644 index 000000000000..6eae8b8f8af1 --- /dev/null +++ b/sys-libs/minizip-ng/minizip-ng-4.0.10-r1.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2025 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-multilib multibuild + +DESCRIPTION="Fork of the popular zip manipulation library found in the zlib distribution" +HOMEPAGE="https://github.com/zlib-ng/minizip-ng" +SRC_URI="https://github.com/zlib-ng/minizip-ng/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="ZLIB" +SLOT="0/4" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc64 ~riscv ~x86" +IUSE="compat lzma openssl test zstd" +RESTRICT="!test? ( test )" + +# Automagically prefers sys-libs/zlib-ng if installed, so let's +# just depend on it as presumably it's better tested anyway. +RDEPEND=" + app-arch/bzip2[${MULTILIB_USEDEP}] + dev-libs/libbsd[${MULTILIB_USEDEP}] + sys-libs/zlib-ng[${MULTILIB_USEDEP}] + virtual/libiconv + compat? ( !sys-libs/zlib[minizip] ) + lzma? ( app-arch/xz-utils ) + openssl? ( dev-libs/openssl:=[${MULTILIB_USEDEP}] ) + zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] ) +" +DEPEND=" + ${RDEPEND} + test? ( dev-cpp/gtest ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-4.0.4-libbsd-overlay.patch +) + +run_both() { + local MULTIBUILD_VARIANTS=( base ) + use compat && MULTIBUILD_VARIANTS+=( compat ) + + multibuild_foreach_variant "${@}" +} + +my_src_configure() { + local compat=OFF + [[ ${MULTIBUILD_VARIANT} == compat ]] && compat=ON + local mycmakeargs=( + "${mycmakeargs[@]}" + -DMZ_COMPAT="${compat}" + ) + + cmake_src_configure +} + +multilib_src_configure() { + local mycmakeargs=( + -DMZ_BUILD_TESTS=$(usex test) + -DMZ_BUILD_UNIT_TESTS=$(usex test) + + -DMZ_FETCH_LIBS=OFF + -DMZ_FORCE_FETCH_LIBS=OFF + + # Compression library options + -DMZ_ZLIB=ON + -DMZ_BZIP2=ON + -DMZ_LZMA=$(usex lzma) + -DMZ_ZSTD=$(usex zstd) + -DMZ_LIBCOMP=OFF + + # Encryption support options + -DMZ_PKCRYPT=ON + -DMZ_WZAES=ON + -DMZ_OPENSSL=$(usex openssl) + -DMZ_LIBBSD=ON + + # Character conversion options + -DMZ_ICONV=ON + ) + + run_both my_src_configure +} + +multilib_src_compile() { run_both cmake_src_compile; } + +multilib_src_test() { + # TODO: A bunch of tests end up looping and writing over each other's files + # It gets better with a patch applied (see https://github.com/zlib-ng/minizip-ng/issues/623#issuecomment-1264518994) + # but still hangs. + local CTEST_JOBS=1 + run_both cmake_src_test +} + +multilib_src_install() { run_both cmake_src_install; } + +pkg_postinst() { + if use compat ; then + ewarn "minizip-ng is experimental and replacing the system zlib[minizip] is dangerous" + ewarn "Please be careful!" + fi +}
