media-gfx/pdf4qt: fix 9999 build

- update *Minimal-cmake-fixes patch
- drop Qt<6.8.0 support

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
This commit is contained in:
Alexander Golubev
2025-01-25 11:13:49 +03:00
parent 254f238892
commit f102e22276
3 changed files with 49 additions and 129 deletions

View File

@@ -0,0 +1,47 @@
From 4cc5cf70d017030c9e016587e1182060f64429f2 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Fri, 8 Nov 2024 23:07:36 +0300
Subject: [PATCH 2/2] Minimal cmake fixes
---
CMakeLists.txt | 3 +--
Pdf4QtLibCore/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea5518d..cb8219c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,6 @@ endif()
qt_standard_project_setup()
find_package(OpenSSL REQUIRED)
-find_package(lcms2 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Freetype REQUIRED)
find_package(OpenJPEG CONFIG REQUIRED)
@@ -92,7 +91,7 @@ endif()
option(PDF4QT_INSTALL_TO_USR "Install to usr directory" ON)
if(PDF4QT_LINUX)
- set(PDF4QT_INSTALL_LIB_DIR_IMPL lib)
+ set(PDF4QT_INSTALL_LIB_DIR_IMPL ${CMAKE_INSTALL_LIBDIR})
set(PDF4QT_INSTALL_BIN_DIR_IMPL bin)
# Check if VCPKG_OVERLAY_PORTS is set as an environment variable or a CMake argument
diff --git a/Pdf4QtLibCore/CMakeLists.txt b/Pdf4QtLibCore/CMakeLists.txt
index e930b23..2c46c96 100644
--- a/Pdf4QtLibCore/CMakeLists.txt
+++ b/Pdf4QtLibCore/CMakeLists.txt
@@ -162,7 +162,7 @@ GENERATE_EXPORT_HEADER(Pdf4QtLibCore
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibcore_export.h")
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::Core Qt6::Gui Qt6::Xml Qt6::Svg)
-target_link_libraries(Pdf4QtLibCore PRIVATE lcms2::lcms2)
+target_link_libraries(Pdf4QtLibCore PRIVATE lcms2)
target_link_libraries(Pdf4QtLibCore PRIVATE OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(Pdf4QtLibCore PRIVATE ZLIB::ZLIB)
target_link_libraries(Pdf4QtLibCore PRIVATE Freetype::Freetype)
--
2.45.2

View File

@@ -1,125 +0,0 @@
From d324d980f9be0f7056286c9b251edcbb4b48b920 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Fri, 8 Nov 2024 22:48:12 +0300
Subject: [PATCH 1/2] Support build against Qt-6.7
---
Pdf4QtEditor/main.cpp | 6 ++++++
Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp | 2 ++
Pdf4QtLibWidgets/sources/pdfwidgetutils.h | 2 ++
Pdf4QtViewer/main.cpp | 6 ++++++
4 files changed, 16 insertions(+)
diff --git a/Pdf4QtEditor/main.cpp b/Pdf4QtEditor/main.cpp
index 9825250..e21c440 100644
--- a/Pdf4QtEditor/main.cpp
+++ b/Pdf4QtEditor/main.cpp
@@ -40,14 +40,18 @@ int main(int argc, char *argv[])
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Editor"));
QCommandLineOption noDrm("no-drm", "Disable DRM settings of documents.");
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
QCommandLineOption lightGui("theme-light", "Use a light theme for the GUI.");
QCommandLineOption darkGui("theme-dark", "Use a dark theme for the GUI.");
+#endif
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addOption(noDrm);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
parser.addOption(lightGui);
parser.addOption(darkGui);
+#endif
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The PDF file to open.");
@@ -58,6 +62,7 @@ int main(int argc, char *argv[])
pdf::PDFSecurityHandler::setNoDRMMode();
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
if (parser.isSet(lightGui))
{
pdf::PDFWidgetUtils::setDarkTheme(false);
@@ -67,6 +72,7 @@ int main(int argc, char *argv[])
{
pdf::PDFWidgetUtils::setDarkTheme(true);
}
+#endif
QIcon appIcon(":/app-icon.svg");
QApplication::setWindowIcon(appIcon);
diff --git a/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp b/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp
index 67f15d7..2a39184 100644
--- a/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp
+++ b/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp
@@ -174,10 +174,12 @@ void PDFWidgetUtils::style(QWidget* widget)
}
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
void PDFWidgetUtils::setDarkTheme(bool isDarkTheme)
{
QApplication::styleHints()->setColorScheme(isDarkTheme ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light);
}
+#endif
bool PDFWidgetUtils::isDarkTheme()
{
diff --git a/Pdf4QtLibWidgets/sources/pdfwidgetutils.h b/Pdf4QtLibWidgets/sources/pdfwidgetutils.h
index bfa296e..7ac120c 100644
--- a/Pdf4QtLibWidgets/sources/pdfwidgetutils.h
+++ b/Pdf4QtLibWidgets/sources/pdfwidgetutils.h
@@ -60,8 +60,10 @@ public:
/// Apply style to the widget
static void style(QWidget* widget);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
/// Overrides automatically detected dark theme / light theme settings
static void setDarkTheme(bool isDarkTheme);
+#endif
/// Returns true if the dark theme is currently set for the application.
static bool isDarkTheme();
diff --git a/Pdf4QtViewer/main.cpp b/Pdf4QtViewer/main.cpp
index a22ef72..1050d8b 100644
--- a/Pdf4QtViewer/main.cpp
+++ b/Pdf4QtViewer/main.cpp
@@ -34,14 +34,18 @@ int main(int argc, char *argv[])
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Viewer"));
QCommandLineOption noDrm("no-drm", "Disable DRM settings of documents.");
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
QCommandLineOption lightGui("theme-light", "Use a light theme for the GUI.");
QCommandLineOption darkGui("theme-dark", "Use a dark theme for the GUI.");
+#endif
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addOption(noDrm);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
parser.addOption(lightGui);
parser.addOption(darkGui);
+#endif
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The PDF file to open.");
@@ -52,6 +56,7 @@ int main(int argc, char *argv[])
pdf::PDFSecurityHandler::setNoDRMMode();
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
if (parser.isSet(lightGui))
{
pdf::PDFWidgetUtils::setDarkTheme(false);
@@ -61,6 +66,7 @@ int main(int argc, char *argv[])
{
pdf::PDFWidgetUtils::setDarkTheme(true);
}
+#endif
QIcon appIcon(":/app-icon.svg");
QApplication::setWindowIcon(appIcon);
--
2.45.2

View File

@@ -1,4 +1,4 @@
# Copyright 2024 Gentoo Authors
# Copyright 2024-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -43,10 +43,8 @@ DEPEND="$RDEPEND
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.9999-Minimal-cmake-fixes.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() {