commit:     552083bce5e862998a5b51c8c893fa180132d97c
Author:     Alexander Golubev <fatzer2 <AT> gmail <DOT> com>
AuthorDate: Mon Nov 11 17:01:52 2024 +0000
Commit:     Golubev Alexander <fatzer2 <AT> gmail <DOT> com>
CommitDate: Mon Nov 11 17:07:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=552083bc

media-gfx/pdf4qt: several fixes

- Disable building of unittests due to as for now it's defunct
- Fix plugins' discovery at runtime
- Rename patches to include correct PV

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

 .../pdf4qt-1.4.0.0-Disable-test-building.patch     |  35 +++++++
 ...ntime-respect-cmake-s-plugin-dir-settings.patch | 113 +++++++++++++++++++++
 ...ch => pdf4qt-1.4.0.0-Minimal-cmake-fixes.patch} |   0
 ...1.4.0.0-fix-build-failure-on-resetMatrix.patch} |   0
 ...move-extention-from-Icon-endtry-in-a-des.patch} |   0
 ...4qt-1.4.0.0.ebuild => pdf4qt-1.4.0.0-r1.ebuild} |  12 +--
 media-gfx/pdf4qt/pdf4qt-9999.ebuild                |  13 ++-
 7 files changed, 162 insertions(+), 11 deletions(-)

diff --git a/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Disable-test-building.patch 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Disable-test-building.patch
new file mode 100644
index 000000000..621093940
--- /dev/null
+++ b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Disable-test-building.patch
@@ -0,0 +1,35 @@
+From 8b39f6ddb24b5bf681491c7a90b10bbd21255257 Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <[email protected]>
+Date: Mon, 11 Nov 2024 19:00:55 +0300
+Subject: [PATCH 1/2] Disable test building
+
+Due to it requires an extra dependency and fails tests anyway.
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cb8219c..c70868a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -49,7 +49,7 @@ include(GNUInstallDirs)
+ if(PDF4QT_BUILD_ONLY_CORE_LIBRARY)
+     find_package(Qt6 REQUIRED COMPONENTS Core Gui Svg Xml)
+ else()
+-    find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml 
PrintSupport TextToSpeech Test)
++    find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml 
PrintSupport TextToSpeech)
+ endif()
+ 
+ qt_standard_project_setup()
+@@ -128,7 +128,7 @@ if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY)
+     add_subdirectory(JBIG2_Viewer)
+     add_subdirectory(PdfExampleGenerator)
+     add_subdirectory(PdfTool)
+-    add_subdirectory(UnitTests)
++#    add_subdirectory(UnitTests)
+     add_subdirectory(Pdf4QtLibGui)
+     add_subdirectory(Pdf4QtEditorPlugins)
+     add_subdirectory(Pdf4QtEditor)
+-- 
+2.45.2
+

diff --git 
a/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Make-runtime-respect-cmake-s-plugin-dir-settings.patch
 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Make-runtime-respect-cmake-s-plugin-dir-settings.patch
new file mode 100644
index 000000000..04f38c119
--- /dev/null
+++ 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Make-runtime-respect-cmake-s-plugin-dir-settings.patch
@@ -0,0 +1,113 @@
+From 5475c2ba7ae732463b6502b916613be9cef02eb5 Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <[email protected]>
+Date: Mon, 11 Nov 2024 18:15:32 +0300
+Subject: [PATCH 2/2] Make runtime respect cmake's plugin dir settings
+
+---
+ CMakeLists.txt                        |  7 +++++++
+ Pdf4QtEditorPlugins/CMakeLists.txt    |  6 ------
+ Pdf4QtLibGui/CMakeLists.txt           |  6 ++++++
+ Pdf4QtLibGui/pdfprogramcontroller.cpp | 24 +++++++++++-------------
+ 4 files changed, 24 insertions(+), 19 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c70868a..7f3bf14 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -120,6 +120,13 @@ else()
+     set(PDF4QT_INSTALL_SHARE_DIR share)
+ endif()
+ 
++if(PDF4QT_LINUX)
++    set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdf4qt      CACHE PATH 
"Path to where pdf4qt plugins will be installed")
++else()
++    set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdfplugins  CACHE PATH 
"Path to where pdf4qt plugins will be installed")
++endif()
++mark_as_advanced(PDF4QT_PLUGINS_DIR)
++
+ add_subdirectory(Pdf4QtLibCore)
+ 
+ if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY)
+diff --git a/Pdf4QtEditorPlugins/CMakeLists.txt 
b/Pdf4QtEditorPlugins/CMakeLists.txt
+index 177f01c..a5dae48 100644
+--- a/Pdf4QtEditorPlugins/CMakeLists.txt
++++ b/Pdf4QtEditorPlugins/CMakeLists.txt
+@@ -15,12 +15,6 @@
+ #    You should have received a copy of the GNU Lesser General Public License
+ #    along with PDF4QT.  If not, see <https://www.gnu.org/licenses/>.
+ 
+-if(PDF4QT_LINUX)
+-    set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdf4qt)
+-else()
+-    set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdfplugins)
+-endif()
+-
+ add_subdirectory(AudioBookPlugin)
+ add_subdirectory(DimensionsPlugin)
+ add_subdirectory(ObjectInspectorPlugin)
+diff --git a/Pdf4QtLibGui/CMakeLists.txt b/Pdf4QtLibGui/CMakeLists.txt
+index 8e7354e..d95b064 100644
+--- a/Pdf4QtLibGui/CMakeLists.txt
++++ b/Pdf4QtLibGui/CMakeLists.txt
+@@ -86,6 +86,12 @@ GENERATE_EXPORT_HEADER(Pdf4QtLibGui
+                        PDF4QTLIBGUILIBSHARED_EXPORT
+                        EXPORT_FILE_NAME 
"${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibgui_export.h")
+ 
++cmake_path(RELATIVE_PATH PDF4QT_PLUGINS_DIR
++           BASE_DIRECTORY PDF4QT_INSTALL_BIN_DIR
++           OUTPUT_VARIABLE PDF4QT_PLUGINS_RELATIVE_PATH)
++set_source_files_properties(pdfprogramcontroller.cpp
++           PROPERTIES COMPILE_DEFINITIONS 
"PDF4QT_PLUGINS_RELATIVE_PATH=\"${PDF4QT_PLUGINS_RELATIVE_PATH}\"")
++
+ target_link_libraries(Pdf4QtLibGui PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets 
Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml 
Qt6::Svg)
+ target_include_directories(Pdf4QtLibGui INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+ target_include_directories(Pdf4QtLibGui PUBLIC 
${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
+diff --git a/Pdf4QtLibGui/pdfprogramcontroller.cpp 
b/Pdf4QtLibGui/pdfprogramcontroller.cpp
+index ec75f95..422a329 100644
+--- a/Pdf4QtLibGui/pdfprogramcontroller.cpp
++++ b/Pdf4QtLibGui/pdfprogramcontroller.cpp
+@@ -70,6 +70,16 @@
+ #pragma comment(lib, "Shell32")
+ #endif
+ 
++#ifndef PDF4QT_PLUGINS_RELATIVE_PATH
++# if defined(Q_OS_WIN)
++#  define PDF4QT_PLUGINS_RELATIVE_PATH "pdfplugins"
++# elif defined(Q_OS_UNIX)
++#  define PDF4QT_PLUGINS_RELATIVE_PATH "../lib/pdf4qt"
++# else
++#  error Implement this for another OS!
++# endif
++#endif
++
+ namespace pdfviewer
+ {
+ 
+@@ -2160,23 +2170,11 @@ void PDFProgramController::updatePageLayoutActions()
+ void PDFProgramController::loadPlugins()
+ {
+     QStringList availablePlugins;
+-
++    QDir directory(QApplication::applicationDirPath() + "/" 
PDF4QT_PLUGINS_RELATIVE_PATH);
+ #if defined(Q_OS_WIN)
+-    QDir directory(QApplication::applicationDirPath() + "/pdfplugins");
+     availablePlugins = directory.entryList(QStringList("*.dll"));
+ #elif defined(Q_OS_UNIX)
+-#ifndef NDEBUG
+-    QDir directory(QApplication::applicationDirPath() + "/../pdfplugins");
+     availablePlugins = directory.entryList(QStringList("*.so"));
+-#else
+-    QDir directory(QApplication::applicationDirPath());
+-    if (directory.cdUp() &&
+-            directory.cd("lib") &&
+-            directory.cd("pdf4qt"))
+-    {
+-        availablePlugins = directory.entryList(QStringList("*.so"));
+-    }
+-#endif
+ #else
+     static_assert(false, "Implement this for another OS!");
+ #endif
+-- 
+2.45.2
+

diff --git a/media-gfx/pdf4qt/files/pdf4qt-1.4.0-Minimal-cmake-fixes.patch 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Minimal-cmake-fixes.patch
similarity index 100%
rename from media-gfx/pdf4qt/files/pdf4qt-1.4.0-Minimal-cmake-fixes.patch
rename to media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-Minimal-cmake-fixes.patch

diff --git 
a/media-gfx/pdf4qt/files/pdf4qt-1.4.0-fix-build-failure-on-resetMatrix.patch 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-fix-build-failure-on-resetMatrix.patch
similarity index 100%
rename from 
media-gfx/pdf4qt/files/pdf4qt-1.4.0-fix-build-failure-on-resetMatrix.patch
rename to 
media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-fix-build-failure-on-resetMatrix.patch

diff --git 
a/media-gfx/pdf4qt/files/pdf4qt-1.4.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch
 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch
similarity index 100%
rename from 
media-gfx/pdf4qt/files/pdf4qt-1.4.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch
rename to 
media-gfx/pdf4qt/files/pdf4qt-1.4.0.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch

diff --git a/media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild 
b/media-gfx/pdf4qt/pdf4qt-1.4.0.0-r1.ebuild
similarity index 75%
rename from media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild
rename to media-gfx/pdf4qt/pdf4qt-1.4.0.0-r1.ebuild
index f8328f11c..f78ba3f6e 100644
--- a/media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild
+++ b/media-gfx/pdf4qt/pdf4qt-1.4.0.0-r1.ebuild
@@ -34,15 +34,15 @@ RDEPEND="
        media-libs/openjpeg
        sys-libs/zlib
 "
-DEPEND="$RDEPEND
-       dev-qt/qtbase:6[test]
-"
+DEPEND="$RDEPEND"
 
 DOCS=( NOTES.txt README.md RELEASES.txt )
 PATCHES=(
-       "${FILESDIR}/pdf4qt-1.4.0-fix-build-failure-on-resetMatrix.patch"
-       
"${FILESDIR}/pdf4qt-1.4.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch"
-       "${FILESDIR}/pdf4qt-1.4.0-Minimal-cmake-fixes.patch"
+       "${FILESDIR}/pdf4qt-1.4.0.0-fix-build-failure-on-resetMatrix.patch"
+       
"${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"
 )
 
 src_configure() {

diff --git a/media-gfx/pdf4qt/pdf4qt-9999.ebuild 
b/media-gfx/pdf4qt/pdf4qt-9999.ebuild
index de393ae20..3ec4564ab 100644
--- a/media-gfx/pdf4qt/pdf4qt-9999.ebuild
+++ b/media-gfx/pdf4qt/pdf4qt-9999.ebuild
@@ -34,14 +34,17 @@ RDEPEND="
        media-libs/openjpeg
        sys-libs/zlib
 "
-DEPEND="$RDEPEND
-       dev-qt/qtbase:6[test]
-"
+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
 
 DOCS=( NOTES.txt README.md RELEASES.txt )
 PATCHES=(
-       
"${FILESDIR}/pdf4qt-1.4.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch"
-       "${FILESDIR}/pdf4qt-1.4.0-Minimal-cmake-fixes.patch"
+       
"${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"
 )

Reply via email to