Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-office/calligra/files/, app-office/calligra/
Date: Mon, 16 May 2022 18:46:40
Message-Id: 1652726747.4df1ed41c45ff68105b9f40ddbe40a93f680b60b.asturm@gentoo
1 commit: 4df1ed41c45ff68105b9f40ddbe40a93f680b60b
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 16 18:44:12 2022 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Mon May 16 18:45:47 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4df1ed41
7
8 app-office/calligra: Fix build with >=app-text/poppler-22.04.0
9
10 Use upstream patches for app-text/poppler-22.03.0 instead of ArchLinux's.
11
12 Closes: https://bugs.gentoo.org/843605
13 Package-Manager: Portage-3.0.30, Repoman-3.0.3
14 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
15
16 app-office/calligra/calligra-3.2.1-r5.ebuild | 3 +-
17 .../files/calligra-3.2.1-poppler-22.03.0-1.patch | 73 +++++++++++++++++
18 .../files/calligra-3.2.1-poppler-22.03.0-2.patch | 94 ++++++++++++++++++++++
19 .../files/calligra-3.2.1-poppler-22.03.0.patch | 51 ------------
20 .../files/calligra-3.2.1-poppler-22.04.0.patch | 25 ++++++
21 5 files changed, 194 insertions(+), 52 deletions(-)
22
23 diff --git a/app-office/calligra/calligra-3.2.1-r5.ebuild b/app-office/calligra/calligra-3.2.1-r5.ebuild
24 index d80568af53ec..49246e3bca3d 100644
25 --- a/app-office/calligra/calligra-3.2.1-r5.ebuild
26 +++ b/app-office/calligra/calligra-3.2.1-r5.ebuild
27 @@ -120,7 +120,8 @@ PATCHES=(
28 "${FILESDIR}"/${P}-{openexr-3,imath-{1,2}}.patch
29 "${FILESDIR}"/${P}-cxx17-for-poppler-22.patch
30 "${FILESDIR}"/${P}-cxx17-fixes.patch
31 - "${FILESDIR}"/${P}-poppler-22.03.0.patch # by Archlinux, TODO upstream
32 + "${FILESDIR}"/${P}-poppler-22.03.0-{1,2}.patch
33 + "${FILESDIR}"/${P}-poppler-22.04.0.patch
34 )
35
36 pkg_pretend() {
37
38 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
39 new file mode 100644
40 index 000000000000..2d308371a0a7
41 --- /dev/null
42 +++ b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-1.patch
43 @@ -0,0 +1,73 @@
44 +From 63ae4ecc780ba42901e6934302b75bd18d3bc5eb Mon Sep 17 00:00:00 2001
45 +From: Albert Astals Cid <aacid@×××.org>
46 +Date: Wed, 13 Apr 2022 01:25:44 +0200
47 +Subject: [PATCH 1/3] PdfImport: Fix compile with newer poppler
48 +
49 +Brings a dependency on poppler-qt5 to be able to include the version
50 +header, honestly it's not strictly needed, one could do a
51 +check_cxx_source_compiles, but I don't care about Calligra enough to
52 +spend more time making it compile while it's using poppler the wrong
53 +way.
54 +---
55 + CMakeLists.txt | 1 +
56 + filters/karbon/pdf/CMakeLists.txt | 2 +-
57 + filters/karbon/pdf/PdfImport.cpp | 9 +++++++++
58 + 3 files changed, 11 insertions(+), 1 deletion(-)
59 +
60 +diff --git a/CMakeLists.txt b/CMakeLists.txt
61 +index bdd9ed74406..d8c86810b54 100644
62 +--- a/CMakeLists.txt
63 ++++ b/CMakeLists.txt
64 +@@ -998,6 +998,7 @@ calligra_drop_product_on_bad_condition( FILTER_WPG_TO_ODG
65 + calligra_drop_product_on_bad_condition( FILTER_PDF_TO_SVG
66 + NOT_WIN "not supported on Windows"
67 + PopplerXPDFHeaders_FOUND "poppler xpdf headers not found"
68 ++ Poppler_FOUND "poppler qt5 headers not found"
69 + )
70 +
71 + calligra_drop_product_on_bad_condition( FILTER_HTML_TO_ODS
72 +diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
73 +index 94d4071da3d..ef360f44359 100644
74 +--- a/filters/karbon/pdf/CMakeLists.txt
75 ++++ b/filters/karbon/pdf/CMakeLists.txt
76 +@@ -19,7 +19,7 @@ set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
77 + add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS})
78 + calligra_filter_desktop_to_json(calligra_filter_pdf2svg calligra_filter_pdf2svg.desktop)
79 +
80 +-target_link_libraries(calligra_filter_pdf2svg komain Poppler::Core)
81 ++target_link_libraries(calligra_filter_pdf2svg komain Poppler::Core Poppler::Qt5)
82 +
83 + install(TARGETS calligra_filter_pdf2svg DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters)
84 +
85 +diff --git a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp
86 +index 286f5fa78bc..c171c754116 100644
87 +--- a/filters/karbon/pdf/PdfImport.cpp
88 ++++ b/filters/karbon/pdf/PdfImport.cpp
89 +@@ -30,6 +30,10 @@
90 +
91 + #include <kpluginfactory.h>
92 +
93 ++#include <poppler-version.h>
94 ++
95 ++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
96 ++
97 + // Don't show this warning: it's an issue in poppler
98 + #ifdef __GNUC__
99 + #pragma GCC diagnostic ignored "-Wunused-parameter"
100 +@@ -73,8 +77,13 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt
101 + if (! globalParams)
102 + return KoFilter::NotImplemented;
103 +
104 ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
105 + GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
106 + PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
107 ++#else
108 ++ std::unique_ptr<GooString> fname = std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data());
109 ++ PDFDoc * pdfDoc = new PDFDoc(std::move(fname));
110 ++#endif
111 + if (! pdfDoc) {
112 + #ifdef HAVE_POPPLER_PRE_0_83
113 + delete globalParams;
114 +--
115 +2.35.1
116 +
117
118 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
119 new file mode 100644
120 index 000000000000..f39304e04c82
121 --- /dev/null
122 +++ b/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0-2.patch
123 @@ -0,0 +1,94 @@
124 +From feb28e5fbd4e3b41c74da1220bc14826bcf9b3c7 Mon Sep 17 00:00:00 2001
125 +From: Dag Andersen <dag.andersen@×××××××.net>
126 +Date: Wed, 13 Apr 2022 14:45:33 +0200
127 +Subject: [PATCH 2/3] PdfImport: Fix compile with newer poppler
128 +
129 +Also fixes odg2pdf filter.
130 +
131 +Same solution as commit 236bacbe13739414e919de868283b0caf2df5d8a
132 +by accid@×××.org.
133 +---
134 + filters/karbon/pdf/CMakeLists.txt | 2 +-
135 + filters/karbon/pdf/Pdf2OdgImport.cpp | 9 +++++++++
136 + filters/karbon/pdf/SvgOutputDev.cpp | 9 +++++++++
137 + 3 files changed, 19 insertions(+), 1 deletion(-)
138 +
139 +diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
140 +index ef360f44359..849baa70f12 100644
141 +--- a/filters/karbon/pdf/CMakeLists.txt
142 ++++ b/filters/karbon/pdf/CMakeLists.txt
143 +@@ -29,6 +29,6 @@ set(pdf2odg_PART_SRCS PdfImportDebug.cpp Pdf2OdgImport.cpp SvgOutputDev.cpp)
144 + add_library(calligra_filter_pdf2odg MODULE ${pdf2odg_PART_SRCS})
145 + calligra_filter_desktop_to_json(calligra_filter_pdf2odg calligra_filter_pdf2odg.desktop)
146 +
147 +-target_link_libraries(calligra_filter_pdf2odg kopageapp karbonui Poppler::Core)
148 ++target_link_libraries(calligra_filter_pdf2odg kopageapp karbonui Poppler::Core Poppler::Qt5)
149 +
150 + install(TARGETS calligra_filter_pdf2odg DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters)
151 +diff --git a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp
152 +index 745239c9c21..b5f3722b320 100644
153 +--- a/filters/karbon/pdf/Pdf2OdgImport.cpp
154 ++++ b/filters/karbon/pdf/Pdf2OdgImport.cpp
155 +@@ -40,6 +40,8 @@
156 +
157 + #include <kpluginfactory.h>
158 +
159 ++#include <poppler-version.h>
160 ++
161 + // Don't show this warning: it's an issue in poppler
162 + #ifdef __GNUC__
163 + #pragma GCC diagnostic ignored "-Wunused-parameter"
164 +@@ -49,6 +51,8 @@
165 + #include <PDFDoc.h>
166 + #include <GlobalParams.h>
167 +
168 ++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
169 ++
170 + K_PLUGIN_FACTORY_WITH_JSON(Pdf2OdgImportFactory, "calligra_filter_pdf2odg.json",
171 + registerPlugin<Pdf2OdgImport>();)
172 +
173 +@@ -86,8 +90,13 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray& from, const
174 + if (! globalParams)
175 + return KoFilter::NotImplemented;
176 +
177 ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
178 + GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
179 + PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
180 ++#else
181 ++ std::unique_ptr<GooString> fname = std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data());
182 ++ PDFDoc * pdfDoc = new PDFDoc(std::move(fname));
183 ++#endif
184 + if (! pdfDoc) {
185 + #ifdef HAVE_POPPLER_PRE_0_83
186 + delete globalParams;
187 +diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp
188 +index b980fdf60f6..76b909e3b69 100644
189 +--- a/filters/karbon/pdf/SvgOutputDev.cpp
190 ++++ b/filters/karbon/pdf/SvgOutputDev.cpp
191 +@@ -35,6 +35,10 @@
192 + #include <QPen>
193 + #include <QImage>
194 +
195 ++#include <poppler-version.h>
196 ++
197 ++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
198 ++
199 + class SvgOutputDev::Private
200 + {
201 + public:
202 +@@ -410,7 +414,12 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
203 + if (s->getLength() == 0)
204 + return;
205 +
206 ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
207 + GfxFont * font = state->getFont();
208 ++#else
209 ++ std::shared_ptr<GfxFont> font = state->getFont();
210 ++#endif
211 ++
212 +
213 + QString str;
214 +
215 +--
216 +2.35.1
217 +
218
219 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
220 deleted file mode 100644
221 index c704d7896e1f..000000000000
222 --- a/app-office/calligra/files/calligra-3.2.1-poppler-22.03.0.patch
223 +++ /dev/null
224 @@ -1,51 +0,0 @@
225 -From 8f328bef497a9e3bc628e4e294c1a70b0c8b0eab Mon Sep 17 00:00:00 2001
226 -From: foutrelis <foutrelis@eb2447ed-0c53-47e4-bac8-5bc4a241df78>
227 -Date: Wed, 2 Mar 2022 10:28:24 +0000
228 -Subject: [PATCH] Fix build with poppler 22.03.0
229 -
230 -diff -uprw a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
231 ---- a/filters/karbon/pdf/CMakeLists.txt 2020-05-14 09:51:30.000000000 +0300
232 -+++ b/filters/karbon/pdf/CMakeLists.txt 2022-03-02 12:19:08.039939530 +0200
233 -@@ -14,6 +14,10 @@ if(Poppler_VERSION VERSION_LESS "0.83.0"
234 - add_definitions("-DHAVE_POPPLER_PRE_0_83")
235 - endif()
236 -
237 -+if(Poppler_VERSION VERSION_LESS "22.3.0")
238 -+ add_definitions("-DHAVE_POPPLER_PRE_22_3")
239 -+endif()
240 -+
241 - set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
242 -
243 - add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS})
244 -diff -uprw a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp
245 ---- a/filters/karbon/pdf/Pdf2OdgImport.cpp 2020-05-14 09:51:30.000000000 +0300
246 -+++ b/filters/karbon/pdf/Pdf2OdgImport.cpp 2022-03-02 12:20:35.125605950 +0200
247 -@@ -86,8 +86,12 @@ KoFilter::ConversionStatus Pdf2OdgImport
248 - if (! globalParams)
249 - return KoFilter::NotImplemented;
250 -
251 -+#ifdef HAVE_POPPLER_PRE_22_3
252 - GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
253 - PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
254 -+#else
255 -+ PDFDoc * pdfDoc = new PDFDoc(std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data()));
256 -+#endif
257 - if (! pdfDoc) {
258 - #ifdef HAVE_POPPLER_PRE_0_83
259 - delete globalParams;
260 -diff -uprw a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp
261 ---- a/filters/karbon/pdf/PdfImport.cpp 2020-05-14 09:51:30.000000000 +0300
262 -+++ b/filters/karbon/pdf/PdfImport.cpp 2022-03-02 12:21:46.197510028 +0200
263 -@@ -73,8 +73,12 @@ KoFilter::ConversionStatus PdfImport::co
264 - if (! globalParams)
265 - return KoFilter::NotImplemented;
266 -
267 -+#ifdef HAVE_POPPLER_PRE_22_3
268 - GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
269 - PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
270 -+#else
271 -+ PDFDoc * pdfDoc = new PDFDoc(std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data()));
272 -+#endif
273 - if (! pdfDoc) {
274 - #ifdef HAVE_POPPLER_PRE_0_83
275 - delete globalParams;
276
277 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
278 new file mode 100644
279 index 000000000000..f76ef92d8fcf
280 --- /dev/null
281 +++ b/app-office/calligra/files/calligra-3.2.1-poppler-22.04.0.patch
282 @@ -0,0 +1,25 @@
283 +From 2dd2c02094ab9dfd964b2363039527d414db3b28 Mon Sep 17 00:00:00 2001
284 +From: Albert Astals Cid <aacid@×××.org>
285 +Date: Wed, 13 Apr 2022 21:30:14 +0200
286 +Subject: [PATCH 3/3] SvgOutputDev: Fix ifdef version for getFont API change
287 +
288 +---
289 + filters/karbon/pdf/SvgOutputDev.cpp | 2 +-
290 + 1 file changed, 1 insertion(+), 1 deletion(-)
291 +
292 +diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp
293 +index 76b909e3b69..588cda8ecbe 100644
294 +--- a/filters/karbon/pdf/SvgOutputDev.cpp
295 ++++ b/filters/karbon/pdf/SvgOutputDev.cpp
296 +@@ -414,7 +414,7 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
297 + if (s->getLength() == 0)
298 + return;
299 +
300 +-#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
301 ++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 04, 0)
302 + GfxFont * font = state->getFont();
303 + #else
304 + std::shared_ptr<GfxFont> font = state->getFont();
305 +--
306 +2.35.1
307 +