commit:     88fe051e9ccff994a9f83464ac9467c3f6403f98
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sat Jan 27 19:41:09 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 28 21:50:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88fe051e

app-arch/libdeflate: 1.19, 9999 update ebuilds

Make tests that depend on `USE="gzip zlib"` conditional.
Add test time dependency on `sys-libs/zlib`.

Bug: https://github.com/gentoo/gentoo/pull/35036
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35047
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...bdeflate-1.19-make-gzip-tests-conditional.patch | 37 ++++++++++++++++++++++
 app-arch/libdeflate/libdeflate-1.19.ebuild         | 25 ++++++++++++---
 app-arch/libdeflate/libdeflate-9999.ebuild         | 25 ++++++++++++---
 app-arch/libdeflate/metadata.xml                   |  1 +
 4 files changed, 80 insertions(+), 8 deletions(-)

diff --git 
a/app-arch/libdeflate/files/libdeflate-1.19-make-gzip-tests-conditional.patch 
b/app-arch/libdeflate/files/libdeflate-1.19-make-gzip-tests-conditional.patch
new file mode 100644
index 000000000000..ae290f3f69d2
--- /dev/null
+++ 
b/app-arch/libdeflate/files/libdeflate-1.19-make-gzip-tests-conditional.patch
@@ -0,0 +1,37 @@
+Only build these when the user enables zlib and gzip support
+diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt
+index e707a25..fcfaf12 100644
+--- a/programs/CMakeLists.txt
++++ b/programs/CMakeLists.txt
+@@ -80,22 +80,28 @@ if(LIBDEFLATE_BUILD_TESTS)
+     target_link_libraries(libdeflate_test_utils PUBLIC
+                           libdeflate_prog_utils ZLIB::ZLIB)
+ 
++    if(LIBDEFLATE_GZIP_SUPPORT AND LIBDEFLATE_ZLIB_SUPPORT)
+     # Build the benchmark and checksum programs.
+     add_executable(benchmark benchmark.c)
+     target_link_libraries(benchmark PRIVATE libdeflate_test_utils)
+     add_executable(checksum checksum.c)
+     target_link_libraries(checksum PRIVATE libdeflate_test_utils)
++    endif()
+ 
+     # Build the unit test programs and register them with CTest.
+     set(UNIT_TEST_PROGS
+-        test_checksums
+         test_custom_malloc
+         test_incomplete_codes
+         test_invalid_streams
+         test_litrunlen_overflow
+         test_overread
+         test_slow_decompression
+-        test_trailing_bytes
+     )
++    if(LIBDEFLATE_GZIP_SUPPORT AND LIBDEFLATE_ZLIB_SUPPORT)
++      list(APPEND UNIT_TEST_PROGS
++        test_checksums
++        test_trailing_bytes
++      )
++    endif()
+     foreach(PROG ${UNIT_TEST_PROGS})
+         add_executable(${PROG} ${PROG}.c)
+         target_link_libraries(${PROG} PRIVATE libdeflate_test_utils)

diff --git a/app-arch/libdeflate/libdeflate-1.19.ebuild 
b/app-arch/libdeflate/libdeflate-1.19.ebuild
index ef8f83f51db6..2ed3a652def2 100644
--- a/app-arch/libdeflate/libdeflate-1.19.ebuild
+++ b/app-arch/libdeflate/libdeflate-1.19.ebuild
@@ -18,14 +18,31 @@ fi
 
 LICENSE="MIT"
 SLOT="0"
-IUSE="+gzip static-libs +utils +zlib test"
-RESTRICT="!test? ( test )"
+# the zlib USE-flag enables support for zlib
+# the test USE-flag programs depend on sys-libs/zlib for comparison tests
+IUSE="+gzip +utils +zlib test"
+
+RESTRICT="
+       !test? ( test )
+"
+
+REQUIRED_USE="
+       utils? ( gzip )
+"
+
+DEPEND="
+       test? ( sys-libs/zlib )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-1.19-make-gzip-tests-conditional.patch"
+)
 
 src_configure() {
        local mycmakeargs=(
                -DLIBDEFLATE_BUILD_SHARED_LIB="yes"
-               -DLIBDEFLATE_BUILD_STATIC_LIB="$(usex static-libs)"
-               -DLIBDEFLATE_USE_SHARED_LIB="$(usex !static-libs)"
+               -DLIBDEFLATE_BUILD_STATIC_LIB="no"
+               -DLIBDEFLATE_USE_SHARED_LIB="yes"
 
                -DLIBDEFLATE_COMPRESSION_SUPPORT="yes"
                -DLIBDEFLATE_DECOMPRESSION_SUPPORT="yes"

diff --git a/app-arch/libdeflate/libdeflate-9999.ebuild 
b/app-arch/libdeflate/libdeflate-9999.ebuild
index ef8f83f51db6..2ed3a652def2 100644
--- a/app-arch/libdeflate/libdeflate-9999.ebuild
+++ b/app-arch/libdeflate/libdeflate-9999.ebuild
@@ -18,14 +18,31 @@ fi
 
 LICENSE="MIT"
 SLOT="0"
-IUSE="+gzip static-libs +utils +zlib test"
-RESTRICT="!test? ( test )"
+# the zlib USE-flag enables support for zlib
+# the test USE-flag programs depend on sys-libs/zlib for comparison tests
+IUSE="+gzip +utils +zlib test"
+
+RESTRICT="
+       !test? ( test )
+"
+
+REQUIRED_USE="
+       utils? ( gzip )
+"
+
+DEPEND="
+       test? ( sys-libs/zlib )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-1.19-make-gzip-tests-conditional.patch"
+)
 
 src_configure() {
        local mycmakeargs=(
                -DLIBDEFLATE_BUILD_SHARED_LIB="yes"
-               -DLIBDEFLATE_BUILD_STATIC_LIB="$(usex static-libs)"
-               -DLIBDEFLATE_USE_SHARED_LIB="$(usex !static-libs)"
+               -DLIBDEFLATE_BUILD_STATIC_LIB="no"
+               -DLIBDEFLATE_USE_SHARED_LIB="yes"
 
                -DLIBDEFLATE_COMPRESSION_SUPPORT="yes"
                -DLIBDEFLATE_DECOMPRESSION_SUPPORT="yes"

diff --git a/app-arch/libdeflate/metadata.xml b/app-arch/libdeflate/metadata.xml
index e81e4a11f128..17956aa98f85 100644
--- a/app-arch/libdeflate/metadata.xml
+++ b/app-arch/libdeflate/metadata.xml
@@ -12,6 +12,7 @@
        </maintainer>
        <use>
                <flag name="gzip">Support the gzip format</flag>
+               <flag name="test">Build the test programs (requires 
<pkg>sys-libs/zlib</pkg>)</flag>
                <flag name="utils">Build the libdeflate-gzip program</flag>
                <flag name="zlib">Support the zlib format</flag>
        </use>

Reply via email to