media-gfx/pdf4qt: update patches for 9999

Upstream now uses CRLF for line endings, so lots of updates.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
This commit is contained in:
Alexander Golubev
2026-05-03 03:29:47 +03:00
parent b113c0ce6f
commit 2bf0a59e34
4 changed files with 264 additions and 51 deletions

View File

@@ -0,0 +1,102 @@
From af69af7f294aff5073cd5cbab64d2f4d0f5a0c73 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Wed, 23 Jul 2025 20:38:29 +0300
Subject: [PATCH 3/3] Fix translation install path on *nix
On *nix translations canonically go into <prefix>/share/<project_name>
rather than <prefix>/bin.
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
CMakeLists.txt | 15 +++++++++------
.../sources/pdfapplicationtranslator.cpp | 4 +++-
config.h.cmake | 1 +
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5a6961..4a26037 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,14 +139,19 @@ endif()
if(PDF4QT_LINUX)
set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdf4qt)
+ set(PDF4QT_INSTALL_TRANS_DIR ${PDF4QT_INSTALL_SHARE_DIR}/pdf4qt/translations)
else()
set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdfplugins)
+ set(PDF4QT_INSTALL_TRANS_DIR ${PDF4QT_INSTALL_BIN_DIR}/translations)
endif()
# Relative paths are used by the config
cmake_path(RELATIVE_PATH PDF4QT_PLUGINS_DIR
BASE_DIRECTORY "${PDF4QT_INSTALL_BIN_DIR}"
OUTPUT_VARIABLE PDF4QT_PLUGINS_RELATIVE_PATH)
+cmake_path(RELATIVE_PATH PDF4QT_INSTALL_TRANS_DIR
+ BASE_DIRECTORY "${PDF4QT_INSTALL_BIN_DIR}"
+ OUTPUT_VARIABLE PDF4QT_TRANSLATIONS_RELATIVE_PATH)
configure_file(config.h.cmake config.h)
add_subdirectory(Pdf4QtLibCore)
@@ -196,7 +201,7 @@ qt_collect_translation_source_targets(i18n_targets)
message("CMAKE_TRANSLATION_TARGETS = " ${i18n_targets})
set(PDF4QT_TRANSLATION_TS_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/translations)
-set(PDF4QT_TRANSLATION_QM_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}/translations)
+set(PDF4QT_TRANSLATION_QM_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_TRANS_DIR})
message("PDF4QT_TRANSLATION_TS_OUTPUT_DIRECTORY" ${PDF4QT_TRANSLATION_TS_OUTPUT_DIRECTORY})
message("PDF4QT_TRANSLATION_QM_OUTPUT_DIRECTORY" ${PDF4QT_TRANSLATION_QM_OUTPUT_DIRECTORY})
@@ -207,7 +212,7 @@ qt_add_translations(TARGETS Pdf4QtEditor Pdf4QtViewer Pdf4QtPageMaster Pdf4QtDif
LUPDATE_OPTIONS -no-obsolete
TS_OUTPUT_DIRECTORY ${PDF4QT_TRANSLATION_TS_OUTPUT_DIRECTORY}
QM_OUTPUT_DIRECTORY ${PDF4QT_TRANSLATION_QM_OUTPUT_DIRECTORY}
- QM_FILES_OUTPUT_VARIABLE pdf4qt_qm_files)
+ QM_FILES_OUTPUT_VARIABLE PDF4QT_QM_FILES)
if(WIN32)
set(PDF4QT_LUPDATE_TARGET "${PROJECT_NAME}_lupdate")
@@ -227,10 +232,8 @@ message("CMAKE_TOOLCHAIN_FILE = " ${CMAKE_TOOLCHAIN_FILE})
configure_file(version.txt.in version.txt)
if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY)
- install(DIRECTORY ${PDF4QT_TRANSLATION_QM_OUTPUT_DIRECTORY}
- RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR}
- FILES_MATCHING
- PATTERN *.qm)
+ install(FILES ${PDF4QT_QM_FILES}
+ DESTINATION ${PDF4QT_INSTALL_TRANS_DIR})
if(WIN32)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Desktop/44x44/
diff --git a/Pdf4QtLibCore/sources/pdfapplicationtranslator.cpp b/Pdf4QtLibCore/sources/pdfapplicationtranslator.cpp
index 4f40e62..a03f39e 100644
--- a/Pdf4QtLibCore/sources/pdfapplicationtranslator.cpp
+++ b/Pdf4QtLibCore/sources/pdfapplicationtranslator.cpp
@@ -27,6 +27,8 @@
#include <QMetaEnum>
#include <QCoreApplication>
+#include "config.h"
+
namespace pdf
{
@@ -48,7 +50,7 @@ PDFApplicationTranslator::ELanguage PDFApplicationTranslator::getLanguage() cons
void PDFApplicationTranslator::installTranslator()
{
QDir applicationDirectory(QCoreApplication::applicationDirPath());
- applicationDirectory.cd("translations");
+ applicationDirectory.cd(PDF4QT_TRANSLATIONS_RELATIVE_PATH);
QString translationPath = applicationDirectory.absolutePath();
Q_ASSERT(!m_translator);
diff --git a/config.h.cmake b/config.h.cmake
index 3d68799..30325bb 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1 +1,2 @@
#define PDF4QT_PLUGINS_RELATIVE_PATH "@PDF4QT_PLUGINS_RELATIVE_PATH@"
+#define PDF4QT_TRANSLATIONS_RELATIVE_PATH "@PDF4QT_TRANSLATIONS_RELATIVE_PATH@"
--
2.53.0

View File

@@ -1,67 +1,75 @@
From 5bd30b43526469dd847c7d08357c5b738cece08e Mon Sep 17 00:00:00 2001
From fcb6085c5f57f7d63f3caa494043520b1589832e Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Mon, 11 Nov 2024 19:04:44 +0300
Subject: [PATCH] Make building of tests optional
Subject: [PATCH 1/3] Make building of tests optional
---
CMakeLists.txt | 13 +++++++++++--
UnitTests/CMakeLists.txt | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
UnitTests/CMakeLists.txt | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4f95e3..6d5f8b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ if(WIN32 AND MSVC)
endif()
option(PDF4QT_BUILD_ONLY_CORE_LIBRARY "Build only core library" OFF)
+option(PDF4QT_BUILD_TESTS "Build UnitTests" ON)
set(PDF4QT_QT_ROOT "" CACHE PATH "Qt root directory")
endif()
option(PDF4QT_BUILD_ONLY_CORE_LIBRARY "Build only core library" OFF)
+option(PDF4QT_BUILD_TESTS "Build UnitTests" ON)
set(PDF4QT_QT_ROOT "" CACHE PATH "Qt root directory")
@@ -64,7 +65,11 @@ find_package(Qt6 REQUIRED COMPONENTS Core LinguistTools)
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 Concurrent)
+ find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech Concurrent)
+endif()
+
+if(PDF4QT_BUILD_TESTS)
+ find_package(Qt6 REQUIRED COMPONENTS Test)
endif()
qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES en de cs es ko zh_CN zh_TW fr tr ru)
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 Concurrent)
+ find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech Concurrent)
+endif()
+
+if(PDF4QT_BUILD_TESTS)
+ find_package(Qt6 REQUIRED COMPONENTS Test)
endif()
qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES en de cs es ko zh_CN zh_TW fr tr ru)
@@ -160,7 +165,6 @@ if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY)
add_subdirectory(JBIG2_Viewer)
add_subdirectory(PdfExampleGenerator)
add_subdirectory(PdfTool)
- add_subdirectory(UnitTests)
add_subdirectory(Pdf4QtLibGui)
add_subdirectory(Pdf4QtEditorPlugins)
add_subdirectory(Pdf4QtEditor)
add_subdirectory(JBIG2_Viewer)
add_subdirectory(PdfExampleGenerator)
add_subdirectory(PdfTool)
- add_subdirectory(UnitTests)
add_subdirectory(Pdf4QtLibGui)
add_subdirectory(Pdf4QtEditorPlugins)
add_subdirectory(Pdf4QtEditor)
@@ -171,6 +175,11 @@ if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY)
add_subdirectory(WixInstaller)
endif()
+if(PDF4QT_BUILD_TESTS)
+ enable_testing()
+ add_subdirectory(UnitTests)
+endif()
+
qt_collect_translation_source_targets(i18n_targets)
message("CMAKE_TRANSLATION_TARGETS = " ${i18n_targets})
add_subdirectory(WixInstaller)
endif()
+if(PDF4QT_BUILD_TESTS)
+ enable_testing()
+ add_subdirectory(UnitTests)
+endif()
+
qt_collect_translation_source_targets(i18n_targets)
message("CMAKE_TRANSLATION_TARGETS = " ${i18n_targets})
diff --git a/UnitTests/CMakeLists.txt b/UnitTests/CMakeLists.txt
index c1a912f..9f64ec8 100644
index 34d18df..788d924 100644
--- a/UnitTests/CMakeLists.txt
+++ b/UnitTests/CMakeLists.txt
@@ -32,3 +32,4 @@ set_target_properties(UnitTests PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}
)
+add_test(UnitTests "${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}/UnitTests")
--
2.52.0
@@ -32,6 +32,7 @@ set_target_properties(UnitTests PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}
)
+add_test(UnitTests "${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}/UnitTests")
add_executable(UnitTestsImageOptimizer
tst_imageoptimizertest.cpp
@@ -45,3 +46,4 @@ set_target_properties(UnitTestsImageOptimizer PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}
)
+add_test(UnitTestsImageOptimizer "${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}/UnitTestsImageOptimizer")
--
2.53.0

View File

@@ -0,0 +1,103 @@
From 211927ae917fb04d902590a0fa9205b2a1716906 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Mon, 11 Nov 2024 18:15:32 +0300
Subject: [PATCH 2/3] Make runtime respect cmake's plugin dir settings
This fixes plugin lookup on linux where plugins were installed into
<prefix>/lib/pdf4qt but were expected at <prefix>/pdfplugins.
---
CMakeLists.txt | 12 ++++++++++++
Pdf4QtEditorPlugins/CMakeLists.txt | 6 ------
Pdf4QtLibGui/pdfprogramcontroller.cpp | 16 +++-------------
config.h.cmake | 1 +
4 files changed, 16 insertions(+), 19 deletions(-)
create mode 100644 config.h.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d5f8b6..a5a6961 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,6 +137,18 @@ else()
set(PDF4QT_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
endif()
+if(PDF4QT_LINUX)
+ set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdf4qt)
+else()
+ set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdfplugins)
+endif()
+
+# Relative paths are used by the config
+cmake_path(RELATIVE_PATH PDF4QT_PLUGINS_DIR
+ BASE_DIRECTORY "${PDF4QT_INSTALL_BIN_DIR}"
+ OUTPUT_VARIABLE PDF4QT_PLUGINS_RELATIVE_PATH)
+configure_file(config.h.cmake config.h)
+
add_subdirectory(Pdf4QtLibCore)
if(PDF4QT_INSTALL_INCLUDE)
diff --git a/Pdf4QtEditorPlugins/CMakeLists.txt b/Pdf4QtEditorPlugins/CMakeLists.txt
index 33019ca..26e2615 100644
--- a/Pdf4QtEditorPlugins/CMakeLists.txt
+++ b/Pdf4QtEditorPlugins/CMakeLists.txt
@@ -20,12 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-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/pdfprogramcontroller.cpp b/Pdf4QtLibGui/pdfprogramcontroller.cpp
index 565672a..cdf98d5 100644
--- a/Pdf4QtLibGui/pdfprogramcontroller.cpp
+++ b/Pdf4QtLibGui/pdfprogramcontroller.cpp
@@ -75,6 +75,8 @@
#include <windows.h>
#endif
+#include "config.h"
+
#if defined(PDF4QT_USE_PRAGMA_LIB)
#pragma comment(lib, "Shell32")
#endif
@@ -2465,23 +2467,11 @@ void PDFProgramController::leaveFullscreenMode()
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
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 0000000..3d68799
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1 @@
+#define PDF4QT_PLUGINS_RELATIVE_PATH "@PDF4QT_PLUGINS_RELATIVE_PATH@"
--
2.53.0

View File

@@ -43,8 +43,8 @@ DEPEND="$RDEPEND
DOCS=( NOTES.txt README.md RELEASES.txt )
PATCHES=(
"${FILESDIR}/${PN}-1.5.3.9999-Make-building-of-tests-optional.patch"
"${FILESDIR}/${PN}-1.5.1.0-Make-runtime-respect-cmake-s-plugin-dir-settings.patch"
"${FILESDIR}/${PN}-1.5.1.0-Fix-translation-install-path-on-nix.patch"
"${FILESDIR}/${PN}-1.5.3.9999-Make-runtime-respect-cmake-s-plugin-dir-settings.patch"
"${FILESDIR}/${PN}-1.5.3.9999-Fix-translation-install-path-on-nix.patch"
)
src_configure() {