commit:     0fd4388f8e81db03a48408f083a6128461b1cbb5
Author:     Alexander Golubev <fatzer2 <AT> gmail <DOT> com>
AuthorDate: Wed Nov 20 05:05:57 2024 +0000
Commit:     Golubev Alexander <fatzer2 <AT> gmail <DOT> com>
CommitDate: Wed Nov 20 05:10:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0fd4388f

media-gfx/pdf4qt: fix tests

Also simplify ebuild with xdg eclass.

Signed-off-by: Alexander Golubev <fatzer2 <AT> gmail.com>

 media-gfx/pdf4qt/pdf4qt-9999.ebuild | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/media-gfx/pdf4qt/pdf4qt-9999.ebuild 
b/media-gfx/pdf4qt/pdf4qt-9999.ebuild
index 3ec4564ab..da9e894cc 100644
--- a/media-gfx/pdf4qt/pdf4qt-9999.ebuild
+++ b/media-gfx/pdf4qt/pdf4qt-9999.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
-inherit cmake xdg-utils
+inherit cmake xdg
 
 DESCRIPTION="Open source PDF WYSIWYG editor based on Qt"
 HOMEPAGE="https://jakubmelka.github.io/";
@@ -20,6 +20,8 @@ fi
 
 LICENSE="LGPL-3+"
 SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
 
 RDEPEND="
        dev-cpp/tbb:=
@@ -34,21 +36,30 @@ RDEPEND="
        media-libs/openjpeg
        sys-libs/zlib
 "
-DEPEND="$RDEPEND"
-# test ? ( dev-qt/qtbase:6[test] )
-# Note: testing is disabled because as for now the only test is failing.
-# See https://github.com/JakubMelka/PDF4QT/issues/222
+DEPEND="$RDEPEND
+       test? ( dev-qt/qtbase:6[test] )
+"
 
 DOCS=( NOTES.txt README.md RELEASES.txt )
 PATCHES=(
        
"${FILESDIR}/pdf4qt-1.4.0.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch"
        "${FILESDIR}/pdf4qt-1.4.0.0-Minimal-cmake-fixes.patch"
-       "${FILESDIR}/pdf4qt-1.4.0.0-Disable-test-building.patch"
        
"${FILESDIR}/pdf4qt-1.4.0.0-Make-runtime-respect-cmake-s-plugin-dir-settings.patch"
        # remove when Qt6.8 is stable
        "${FILESDIR}/pdf4qt-1.4.9999-Support-build-against-Qt-6.7.patch"
 )
 
+src_prepare() {
+       cmake_src_prepare
+
+       # Conditionally dissable test build
+       if ! use test; then
+               sed -i -e '/find_package(Qt6/s/Test//' \
+                          -e '/add_subdirectory(UnitTests)/d' \
+                       CMakeLists.txt || die
+       fi
+}
+
 src_configure() {
        local mycmakeargs=(
                -DPDF4QT_INSTALL_DEPENDENCIES=OFF
@@ -58,12 +69,6 @@ src_configure() {
        cmake_src_configure
 }
 
-pkg_postinst() {
-       xdg_icon_cache_update
-       xdg_desktop_database_update
-}
-
-pkg_postrm() {
-       xdg_icon_cache_update
-       xdg_desktop_database_update
+src_test() {
+       "${BUILD_DIR}"/bin/UnitTests || die "tests failed"
 }

Reply via email to