commit:     dd6462a68efbe7ad525a90070738cf7edf2c7148
Author:     Alexander Golubev <fatzer2 <AT> gmail <DOT> com>
AuthorDate: Sat Nov  9 12:16:30 2024 +0000
Commit:     Golubev Alexander <fatzer2 <AT> gmail <DOT> com>
CommitDate: Sat Nov  9 12:19:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=dd6462a6

media-gfx/pdf4qt: new package, add 1.4.0.0, 9999

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

 media-gfx/pdf4qt/Manifest                          |   1 +
 .../files/pdf4qt-1.4.0-Minimal-cmake-fixes.patch   |  47 ++++++++
 ...qt-1.4.0-fix-build-failure-on-resetMatrix.patch |  55 +++++++++
 ...emove-extention-from-Icon-endtry-in-a-des.patch |  26 +++++
 ...4qt-1.4.9999-Support-build-against-Qt-6.7.patch | 125 +++++++++++++++++++++
 media-gfx/pdf4qt/metadata.xml                      |  11 ++
 media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild             |  55 +++++++++
 media-gfx/pdf4qt/pdf4qt-9999.ebuild                |  53 +++++++++
 8 files changed, 373 insertions(+)

diff --git a/media-gfx/pdf4qt/Manifest b/media-gfx/pdf4qt/Manifest
new file mode 100644
index 000000000..dc748637f
--- /dev/null
+++ b/media-gfx/pdf4qt/Manifest
@@ -0,0 +1 @@
+DIST PDF4QT-1.4.0.0.tar.gz 4088081 BLAKE2B 
85073f8821401e4160846dc13bf8170e12c3a06d19efdb0d7c2d7b541818b93dbaae9cea90a2dbc341e0129aba9300ef55e41a68d91c13159118394a9ac7cb0e
 SHA512 
870ce6cb2a6d870c1fa7539a47556de86726a4897e181edc35ec7307a01ff2c0b3bd45b653a9e3a41aae7458cfe94545df6414314dfb5bb34226b7043a4d3a67

diff --git a/media-gfx/pdf4qt/files/pdf4qt-1.4.0-Minimal-cmake-fixes.patch 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0-Minimal-cmake-fixes.patch
new file mode 100644
index 000000000..fbc5fae86
--- /dev/null
+++ b/media-gfx/pdf4qt/files/pdf4qt-1.4.0-Minimal-cmake-fixes.patch
@@ -0,0 +1,47 @@
+From 4cc5cf70d017030c9e016587e1182060f64429f2 Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <[email protected]>
+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(lcms 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
+

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-fix-build-failure-on-resetMatrix.patch
new file mode 100644
index 000000000..1a5ce8bbc
--- /dev/null
+++ b/media-gfx/pdf4qt/files/pdf4qt-1.4.0-fix-build-failure-on-resetMatrix.patch
@@ -0,0 +1,55 @@
+From 2a93ca5a1f40ee8178f07ac1590889c3d2623d6c Mon Sep 17 00:00:00 2001
+From: Jakub Melka <[email protected]>
+Date: Wed, 10 Jul 2024 20:19:06 +0200
+Subject: [PATCH 01/11] Issue #185: Latest git fails to build in linux
+
+---
+ Pdf4QtLibCore/sources/pdfblpainter.cpp | 12 ++++++------
+ RELEASES.txt                           |  1 +
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/Pdf4QtLibCore/sources/pdfblpainter.cpp 
b/Pdf4QtLibCore/sources/pdfblpainter.cpp
+index a8b3e85..007c39b 100644
+--- a/Pdf4QtLibCore/sources/pdfblpainter.cpp
++++ b/Pdf4QtLibCore/sources/pdfblpainter.cpp
+@@ -302,7 +302,7 @@ void PDFBLPaintEngine::updateState(const 
QPaintEngineState& updatedState)
+     if (updatedState.state().testFlag(QPaintEngine::DirtyTransform))
+     {
+         m_currentTransform = updatedState.transform();
+-        m_blContext->setMatrix(getBLMatrix(updatedState.transform()));
++        m_blContext->setTransform(getBLMatrix(updatedState.transform()));
+     }
+ 
+     if (updatedState.state().testFlag(QPaintEngine::DirtyFont))
+@@ -580,7 +580,7 @@ void PDFBLPaintEngine::drawPathImpl(const QPainterPath& 
path, bool enableStroke,
+                 if (!fillPath.isEmpty())
+                 {
+                     m_blContext->save();
+-                    m_blContext->resetMatrix();
++                    m_blContext->resetTransform();
+                     m_blContext->fillPath(getBLPath(fillPath));
+                     m_blContext->restore();
+                 }
+@@ -596,7 +596,7 @@ void PDFBLPaintEngine::drawPathImpl(const QPainterPath& 
path, bool enableStroke,
+                 if (!finalTransformedStrokedPath.isEmpty())
+                 {
+                     m_blContext->save();
+-                    m_blContext->resetMatrix();
++                    m_blContext->resetTransform();
+                     setBLBrush(m_blContext.value(), m_currentPen.brush());
+                     
m_blContext->fillPath(getBLPath(finalTransformedStrokedPath));
+                     m_blContext->restore();
+@@ -1183,10 +1183,10 @@ void 
PDFBLPaintEngine::updateClipping(std::optional<QRegion> clipRegion,
+ 
+     if (m_clipSingleRect)
+     {
+-        BLMatrix2D matrix = m_blContext->userMatrix();
+-        m_blContext->resetMatrix();
++        BLMatrix2D matrix = m_blContext->userTransform();
++        m_blContext->resetTransform();
+         m_blContext->clipToRect(getBLRect(m_finalClipPath->boundingRect()));
+-        m_blContext->setMatrix(matrix);
++        m_blContext->setTransform(matrix);
+     }
+     else
+     {

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-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch
new file mode 100644
index 000000000..d70da88e3
--- /dev/null
+++ 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.0-minor-fix-remove-extention-from-Icon-endtry-in-a-des.patch
@@ -0,0 +1,26 @@
+From 18b4543b2a5d294c220e5dc4b558c52d2a36eeb0 Mon Sep 17 00:00:00 2001
+From: Golubev Alexander <[email protected]>
+Date: Sat, 9 Nov 2024 00:36:30 +0300
+Subject: [PATCH] minor fix: remove extention from Icon endtry in a desktop
+ file
+
+---
+ Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtEditor.desktop | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtEditor.desktop 
b/Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtEditor.desktop
+index 62009ba..f604504 100644
+--- a/Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtEditor.desktop
++++ b/Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtEditor.desktop
+@@ -4,7 +4,7 @@ Type=Application
+ Name=PDF4QT Editor
+ Comment=Edit and modify PDF files
+ Exec=Pdf4QtEditor
+-Icon=io.github.JakubMelka.Pdf4qt.Pdf4QtEditor.svg
++Icon=io.github.JakubMelka.Pdf4qt.Pdf4QtEditor
+ Terminal=false
+ Categories=Office;
+ MimeType=application/pdf;
+-- 
+2.45.2
+

diff --git 
a/media-gfx/pdf4qt/files/pdf4qt-1.4.9999-Support-build-against-Qt-6.7.patch 
b/media-gfx/pdf4qt/files/pdf4qt-1.4.9999-Support-build-against-Qt-6.7.patch
new file mode 100644
index 000000000..e068e386a
--- /dev/null
+++ b/media-gfx/pdf4qt/files/pdf4qt-1.4.9999-Support-build-against-Qt-6.7.patch
@@ -0,0 +1,125 @@
+From d324d980f9be0f7056286c9b251edcbb4b48b920 Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <[email protected]>
+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
+

diff --git a/media-gfx/pdf4qt/metadata.xml b/media-gfx/pdf4qt/metadata.xml
new file mode 100644
index 000000000..2624e7039
--- /dev/null
+++ b/media-gfx/pdf4qt/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Alexander Golubev</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">JakubMelka/PDF4QT</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild 
b/media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild
new file mode 100644
index 000000000..cbe3c0cd3
--- /dev/null
+++ b/media-gfx/pdf4qt/pdf4qt-1.4.0.0.ebuild
@@ -0,0 +1,55 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit cmake
+
+DESCRIPTION="Open source PDF WYSIWYG editor based on Qt"
+HOMEPAGE="https://jakubmelka.github.io/";
+MY_PN="${PN^^}"
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/JakubMelka/${MY_PN}";
+else
+       MY_P="${MY_PN}-${PV}"
+       
SRC_URI="https://github.com/JakubMelka/${MY_PN}/archive/refs/tags/v${PV}.tar.gz
+               -> ${MY_P}.tar.gz"
+       KEYWORDS="~amd64"
+       S=${WORKDIR}/${MY_P}
+fi
+
+LICENSE="LGPL-3+"
+SLOT="0"
+
+RDEPEND="
+       dev-cpp/tbb:=
+       dev-libs/openssl
+       dev-qt/qtbase:6[gui,widgets,xml]
+       dev-qt/qtspeech:6
+       dev-qt/qtsvg:6
+       media-libs/blend2d
+       media-libs/freetype
+       media-libs/lcms
+       media-libs/libjpeg-turbo
+       media-libs/openjpeg
+       sys-libs/zlib
+"
+DEPEND="$RDEPEND
+       dev-qt/qtbase:6[test]
+"
+
+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"
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DPDF4QT_INSTALL_DEPENDENCIES=OFF
+               -DPDF4QT_INSTALL_TO_USR=OFF
+               -DVCPKG_OVERLAY_PORTS="" # suppress a warning
+       )
+       cmake_src_configure
+}

diff --git a/media-gfx/pdf4qt/pdf4qt-9999.ebuild 
b/media-gfx/pdf4qt/pdf4qt-9999.ebuild
new file mode 100644
index 000000000..b514388e5
--- /dev/null
+++ b/media-gfx/pdf4qt/pdf4qt-9999.ebuild
@@ -0,0 +1,53 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit cmake
+
+DESCRIPTION="Open source PDF WYSIWYG editor based on Qt"
+HOMEPAGE="https://jakubmelka.github.io/";
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/JakubMelka/${PN^^}";
+else
+       
SRC_URI="https://github.com/JakubMelka/${PN^^}/archive/refs/tags/v${PV}.tar.gz
+               -> ${P}.tar.gz"
+       KEYWORDS="~amd64"
+fi
+
+LICENSE="LGPL-3+"
+SLOT="0"
+
+RDEPEND="
+       dev-cpp/tbb:=
+       dev-libs/openssl
+       dev-qt/qtbase:6[gui,widgets,xml]
+       dev-qt/qtspeech:6
+       dev-qt/qtsvg:6
+       media-libs/blend2d
+       media-libs/freetype
+       media-libs/lcms
+       media-libs/libjpeg-turbo
+       media-libs/openjpeg
+       sys-libs/zlib
+"
+DEPEND="$RDEPEND
+       dev-qt/qtbase:6[test]
+"
+
+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"
+       # remove when Qt6.8 is stable
+       "${FILESDIR}/pdf4qt-1.4.9999-Support-build-against-Qt-6.7.patch"
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DPDF4QT_INSTALL_DEPENDENCIES=OFF
+               -DPDF4QT_INSTALL_TO_USR=OFF
+               -DVCPKG_OVERLAY_PORTS="" # suppress a warning
+       )
+       cmake_src_configure
+}

Reply via email to