diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2022-05-16 20:44:12 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2022-05-16 20:45:47 +0200 |
commit | 4df1ed41c45ff68105b9f40ddbe40a93f680b60b (patch) | |
tree | 31965ff5ccaefc5910d4acc0d7f94a2cb6eb47b2 /app-office/calligra | |
parent | dev-python/utidylib: enable py3.11 (diff) | |
download | gentoo-4df1ed41c45ff68105b9f40ddbe40a93f680b60b.tar.gz gentoo-4df1ed41c45ff68105b9f40ddbe40a93f680b60b.tar.bz2 gentoo-4df1ed41c45ff68105b9f40ddbe40a93f680b60b.zip |
app-office/calligra: Fix build with >=app-text/poppler-22.04.0
Use upstream patches for app-text/poppler-22.03.0 instead of ArchLinux's.
Closes: https://bugs.gentoo.org/843605
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'app-office/calligra')
5 files changed, 194 insertions, 52 deletions
diff --git a/app-office/calligra/calligra-3.2.1-r5.ebuild b/app-office/calligra/calligra-3.2.1-r5.ebuild index d80568af53ec..49246e3bca3d 100644 --- a/app-office/calligra/calligra-3.2.1-r5.ebuild +++ b/app-office/calligra/calligra-3.2.1-r5.ebuild @@ -120,7 +120,8 @@ PATCHES=( "${FILESDIR}"/${P}-{openexr-3,imath-{1,2}}.patch "${FILESDIR}"/${P}-cxx17-for-poppler-22.patch "${FILESDIR}"/${P}-cxx17-fixes.patch - "${FILESDIR}"/${P}-poppler-22.03.0.patch # by Archlinux, TODO upstream + "${FILESDIR}"/${P}-poppler-22.03.0-{1,2}.patch + "${FILESDIR}"/${P}-poppler-22.04.0.patch ) pkg_pretend() { diff --git a/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-1.patch b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-1.patch new file mode 100644 index 000000000000..2d308371a0a7 --- /dev/null +++ b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-1.patch @@ -0,0 +1,73 @@ +From 63ae4ecc780ba42901e6934302b75bd18d3bc5eb Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid <aacid@kde.org> +Date: Wed, 13 Apr 2022 01:25:44 +0200 +Subject: [PATCH 1/3] PdfImport: Fix compile with newer poppler + +Brings a dependency on poppler-qt5 to be able to include the version +header, honestly it's not strictly needed, one could do a +check_cxx_source_compiles, but I don't care about Calligra enough to +spend more time making it compile while it's using poppler the wrong +way. +--- + CMakeLists.txt | 1 + + filters/karbon/pdf/CMakeLists.txt | 2 +- + filters/karbon/pdf/PdfImport.cpp | 9 +++++++++ + 3 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bdd9ed74406..d8c86810b54 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -998,6 +998,7 @@ calligra_drop_product_on_bad_condition( FILTER_WPG_TO_ODG + calligra_drop_product_on_bad_condition( FILTER_PDF_TO_SVG + NOT_WIN "not supported on Windows" + PopplerXPDFHeaders_FOUND "poppler xpdf headers not found" ++ Poppler_FOUND "poppler qt5 headers not found" + ) + + calligra_drop_product_on_bad_condition( FILTER_HTML_TO_ODS +diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt +index 94d4071da3d..ef360f44359 100644 +--- a/filters/karbon/pdf/CMakeLists.txt ++++ b/filters/karbon/pdf/CMakeLists.txt +@@ -19,7 +19,7 @@ set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp ) + add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS}) + calligra_filter_desktop_to_json(calligra_filter_pdf2svg calligra_filter_pdf2svg.desktop) + +-target_link_libraries(calligra_filter_pdf2svg komain Poppler::Core) ++target_link_libraries(calligra_filter_pdf2svg komain Poppler::Core Poppler::Qt5) + + install(TARGETS calligra_filter_pdf2svg DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters) + +diff --git a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp +index 286f5fa78bc..c171c754116 100644 +--- a/filters/karbon/pdf/PdfImport.cpp ++++ b/filters/karbon/pdf/PdfImport.cpp +@@ -30,6 +30,10 @@ + + #include <kpluginfactory.h> + ++#include <poppler-version.h> ++ ++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO)) ++ + // Don't show this warning: it's an issue in poppler + #ifdef __GNUC__ + #pragma GCC diagnostic ignored "-Wunused-parameter" +@@ -73,8 +77,13 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt + if (! globalParams) + return KoFilter::NotImplemented; + ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0) + GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data()); + PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0); ++#else ++ std::unique_ptr<GooString> fname = std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data()); ++ PDFDoc * pdfDoc = new PDFDoc(std::move(fname)); ++#endif + if (! pdfDoc) { + #ifdef HAVE_POPPLER_PRE_0_83 + delete globalParams; +-- +2.35.1 + diff --git a/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-2.patch b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-2.patch new file mode 100644 index 000000000000..f39304e04c82 --- /dev/null +++ b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-2.patch @@ -0,0 +1,94 @@ +From feb28e5fbd4e3b41c74da1220bc14826bcf9b3c7 Mon Sep 17 00:00:00 2001 +From: Dag Andersen <dag.andersen@kdemail.net> +Date: Wed, 13 Apr 2022 14:45:33 +0200 +Subject: [PATCH 2/3] PdfImport: Fix compile with newer poppler + +Also fixes odg2pdf filter. + +Same solution as commit 236bacbe13739414e919de868283b0caf2df5d8a +by accid@kde.org. +--- + filters/karbon/pdf/CMakeLists.txt | 2 +- + filters/karbon/pdf/Pdf2OdgImport.cpp | 9 +++++++++ + filters/karbon/pdf/SvgOutputDev.cpp | 9 +++++++++ + 3 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt +index ef360f44359..849baa70f12 100644 +--- a/filters/karbon/pdf/CMakeLists.txt ++++ b/filters/karbon/pdf/CMakeLists.txt +@@ -29,6 +29,6 @@ set(pdf2odg_PART_SRCS PdfImportDebug.cpp Pdf2OdgImport.cpp SvgOutputDev.cpp) + add_library(calligra_filter_pdf2odg MODULE ${pdf2odg_PART_SRCS}) + calligra_filter_desktop_to_json(calligra_filter_pdf2odg calligra_filter_pdf2odg.desktop) + +-target_link_libraries(calligra_filter_pdf2odg kopageapp karbonui Poppler::Core) ++target_link_libraries(calligra_filter_pdf2odg kopageapp karbonui Poppler::Core Poppler::Qt5) + + install(TARGETS calligra_filter_pdf2odg DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters) +diff --git a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp +index 745239c9c21..b5f3722b320 100644 +--- a/filters/karbon/pdf/Pdf2OdgImport.cpp ++++ b/filters/karbon/pdf/Pdf2OdgImport.cpp +@@ -40,6 +40,8 @@ + + #include <kpluginfactory.h> + ++#include <poppler-version.h> ++ + // Don't show this warning: it's an issue in poppler + #ifdef __GNUC__ + #pragma GCC diagnostic ignored "-Wunused-parameter" +@@ -49,6 +51,8 @@ + #include <PDFDoc.h> + #include <GlobalParams.h> + ++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO)) ++ + K_PLUGIN_FACTORY_WITH_JSON(Pdf2OdgImportFactory, "calligra_filter_pdf2odg.json", + registerPlugin<Pdf2OdgImport>();) + +@@ -86,8 +90,13 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray& from, const + if (! globalParams) + return KoFilter::NotImplemented; + ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0) + GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data()); + PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0); ++#else ++ std::unique_ptr<GooString> fname = std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data()); ++ PDFDoc * pdfDoc = new PDFDoc(std::move(fname)); ++#endif + if (! pdfDoc) { + #ifdef HAVE_POPPLER_PRE_0_83 + delete globalParams; +diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp +index b980fdf60f6..76b909e3b69 100644 +--- a/filters/karbon/pdf/SvgOutputDev.cpp ++++ b/filters/karbon/pdf/SvgOutputDev.cpp +@@ -35,6 +35,10 @@ + #include <QPen> + #include <QImage> + ++#include <poppler-version.h> ++ ++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO)) ++ + class SvgOutputDev::Private + { + public: +@@ -410,7 +414,12 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s) + if (s->getLength() == 0) + return; + ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0) + GfxFont * font = state->getFont(); ++#else ++ std::shared_ptr<GfxFont> font = state->getFont(); ++#endif ++ + + QString str; + +-- +2.35.1 + diff --git a/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0.patch b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0.patch deleted file mode 100644 index c704d7896e1f..000000000000 --- a/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8f328bef497a9e3bc628e4e294c1a70b0c8b0eab Mon Sep 17 00:00:00 2001 -From: foutrelis <foutrelis@eb2447ed-0c53-47e4-bac8-5bc4a241df78> -Date: Wed, 2 Mar 2022 10:28:24 +0000 -Subject: [PATCH] Fix build with poppler 22.03.0 - -diff -uprw a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt ---- a/filters/karbon/pdf/CMakeLists.txt 2020-05-14 09:51:30.000000000 +0300 -+++ b/filters/karbon/pdf/CMakeLists.txt 2022-03-02 12:19:08.039939530 +0200 -@@ -14,6 +14,10 @@ if(Poppler_VERSION VERSION_LESS "0.83.0" - add_definitions("-DHAVE_POPPLER_PRE_0_83") - endif() - -+if(Poppler_VERSION VERSION_LESS "22.3.0") -+ add_definitions("-DHAVE_POPPLER_PRE_22_3") -+endif() -+ - set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp ) - - add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS}) -diff -uprw a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp ---- a/filters/karbon/pdf/Pdf2OdgImport.cpp 2020-05-14 09:51:30.000000000 +0300 -+++ b/filters/karbon/pdf/Pdf2OdgImport.cpp 2022-03-02 12:20:35.125605950 +0200 -@@ -86,8 +86,12 @@ KoFilter::ConversionStatus Pdf2OdgImport - if (! globalParams) - return KoFilter::NotImplemented; - -+#ifdef HAVE_POPPLER_PRE_22_3 - GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data()); - PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0); -+#else -+ PDFDoc * pdfDoc = new PDFDoc(std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data())); -+#endif - if (! pdfDoc) { - #ifdef HAVE_POPPLER_PRE_0_83 - delete globalParams; -diff -uprw a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp ---- a/filters/karbon/pdf/PdfImport.cpp 2020-05-14 09:51:30.000000000 +0300 -+++ b/filters/karbon/pdf/PdfImport.cpp 2022-03-02 12:21:46.197510028 +0200 -@@ -73,8 +73,12 @@ KoFilter::ConversionStatus PdfImport::co - if (! globalParams) - return KoFilter::NotImplemented; - -+#ifdef HAVE_POPPLER_PRE_22_3 - GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data()); - PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0); -+#else -+ PDFDoc * pdfDoc = new PDFDoc(std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data())); -+#endif - if (! pdfDoc) { - #ifdef HAVE_POPPLER_PRE_0_83 - delete globalParams; diff --git a/app-office/calligra/files/calligra-3.2.1-poppler-22.04.0.patch b/app-office/calligra/files/calligra-3.2.1-poppler-22.04.0.patch new file mode 100644 index 000000000000..f76ef92d8fcf --- /dev/null +++ b/app-office/calligra/files/calligra-3.2.1-poppler-22.04.0.patch @@ -0,0 +1,25 @@ +From 2dd2c02094ab9dfd964b2363039527d414db3b28 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid <aacid@kde.org> +Date: Wed, 13 Apr 2022 21:30:14 +0200 +Subject: [PATCH 3/3] SvgOutputDev: Fix ifdef version for getFont API change + +--- + filters/karbon/pdf/SvgOutputDev.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp +index 76b909e3b69..588cda8ecbe 100644 +--- a/filters/karbon/pdf/SvgOutputDev.cpp ++++ b/filters/karbon/pdf/SvgOutputDev.cpp +@@ -414,7 +414,7 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s) + if (s->getLength() == 0) + return; + +-#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0) ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 04, 0) + GfxFont * font = state->getFont(); + #else + std::shared_ptr<GfxFont> font = state->getFont(); +-- +2.35.1 + |