commit:     d5c62bd26e15d585d1516010cdbde0d809fd5ae8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 17 20:10:43 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 17 20:18:24 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5c62bd2

media-libs/zxing-cpp: wire up tests

Fortunately, the situation has improved since bug #793173. Wire up the tests
accordingly.

Note that upstream do say that the unit tests option "shouldn't be used
in production builds". My assumption is that this is because of it setting
ZXING_BUILD_FOR_TEST, but when looking at use of that, I can't see anything
harmful.

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

 media-libs/zxing-cpp/Manifest                  |  1 +
 media-libs/zxing-cpp/zxing-cpp-2.2.1-r1.ebuild | 48 ++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/media-libs/zxing-cpp/Manifest b/media-libs/zxing-cpp/Manifest
index 34cf06914feb..e5d66734f685 100644
--- a/media-libs/zxing-cpp/Manifest
+++ b/media-libs/zxing-cpp/Manifest
@@ -1 +1,2 @@
+DIST zxing-cpp-2.2.1-test-samples.tar.gz 97082308 BLAKE2B 
bcea839f766e5696bcaab58d1483e43ef3d4b504979ea4db3114236853db92c64f7079ed91977a158cda745d8a08c0c249bf1b10382daf5a9816bf4280b95092
 SHA512 
4de268d36a337d233a60eed477e8421294d42f357534f21aba9574ec929809a4666fe7a55e3b3ac1518460aedfbb0d615659cc0a170e3685790745066339b064
 DIST zxing-cpp-2.2.1.tar.gz 891055 BLAKE2B 
c6a3343cd0389d930e83dd9db4d6aeca6d4dda715c22c0b10dd76460e9d55bdd8e994c2ac24ba5d5a4f5e2069fcb035b2e4651a380b6b39bcce4b90d0c754df8
 SHA512 
f1de8df783061a152a18cd9102ac0c579c40c76ab4a5ba9f30bcb8ddb532f3fac08736840a631adbf7c30a7fa00ce8d65625c8cd695288620601708e8f256a53

diff --git a/media-libs/zxing-cpp/zxing-cpp-2.2.1-r1.ebuild 
b/media-libs/zxing-cpp/zxing-cpp-2.2.1-r1.ebuild
new file mode 100644
index 000000000000..659cf14edc25
--- /dev/null
+++ b/media-libs/zxing-cpp/zxing-cpp-2.2.1-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="C++ Multi-format 1D/2D barcode image processing library"
+HOMEPAGE="https://github.com/zxing-cpp/zxing-cpp";
+SRC_URI="
+       https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       test? ( 
https://github.com/zxing-cpp/zxing-cpp/releases/download/v${PV}/test_samples.tar.gz
 -> ${P}-test-samples.tar.gz )
+"
+
+LICENSE="Apache-2.0"
+SLOT="0/3"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       test? (
+               dev-cpp/gtest
+               dev-libs/stb
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-cmake.patch"
+       "${FILESDIR}/${P}-cxx20.patch" # bug 939897
+)
+
+src_prepare() {
+       if use test ; then
+               ln -s "${WORKDIR}"/test/samples "${S}"/test/samples || die
+       fi
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_EXAMPLES=OFF # nothing is installed
+               -DBUILD_BLACKBOX_TESTS=$(usex test)
+               -DBUILD_UNIT_TESTS=$(usex test)
+       )
+       cmake_src_configure
+}

Reply via email to