Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-office/scribus/, app-office/scribus/files/
Date: Sun, 08 May 2022 18:01:06
Message-Id: 1652032812.65615103763c15420ea24f0781626384dcbc83d7.sam@gentoo
1 commit: 65615103763c15420ea24f0781626384dcbc83d7
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 8 17:58:53 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun May 8 18:00:12 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65615103
7
8 app-office/scribus: fix build with Poppler 22.04.0
9
10 Closes: https://bugs.gentoo.org/843287
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../files/scribus-1.5.8-poppler-22.04.0.patch | 291 +++++++++++++++++++++
14 ...scribus-9999.ebuild => scribus-1.5.8-r1.ebuild} | 18 +-
15 app-office/scribus/scribus-9999.ebuild | 2 +-
16 3 files changed, 303 insertions(+), 8 deletions(-)
17
18 diff --git a/app-office/scribus/files/scribus-1.5.8-poppler-22.04.0.patch b/app-office/scribus/files/scribus-1.5.8-poppler-22.04.0.patch
19 new file mode 100644
20 index 000000000000..290484e7e872
21 --- /dev/null
22 +++ b/app-office/scribus/files/scribus-1.5.8-poppler-22.04.0.patch
23 @@ -0,0 +1,291 @@
24 +https://bugs.gentoo.org/843287
25 +https://github.com/scribusproject/scribus/commit/f2237b8f0b5cf7690e864a22ef7a63a6d769fa36.patch
26 +
27 +From f2237b8f0b5cf7690e864a22ef7a63a6d769fa36 Mon Sep 17 00:00:00 2001
28 +From: Jean Ghali <jghali@×××××××××××.fr>
29 +Date: Fri, 1 Apr 2022 23:52:32 +0000
30 +Subject: [PATCH] Fix build with poppler 22.04.0
31 +
32 +git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870
33 +---
34 + scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++---------
35 + 1 file changed, 78 insertions(+), 45 deletions(-)
36 +
37 +diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
38 +index e20a81f99e..5626fe3477 100644
39 +--- a/scribus/plugins/import/pdf/slaoutput.cpp
40 ++++ b/scribus/plugins/import/pdf/slaoutput.cpp
41 +@@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s)
42 + int shade = 100;
43 + currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
44 + fontSize = state->getFontSize();
45 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
46 ++ if (state->getFont() && state->getFont()->getName())
47 ++ fontName = new GooString(state->getFont()->getName().value());
48 ++#else
49 + if (state->getFont())
50 + fontName = state->getFont()->getName()->copy();
51 ++#endif
52 + itemText = s->copy();
53 + }
54 +
55 +@@ -357,7 +362,12 @@ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key
56 + GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
57 + {
58 + SlaOutputDev *dev = (SlaOutputDev*)user_data;
59 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
60 ++ const PDFRectangle& annotRect = annota->getRect();;
61 ++ const PDFRectangle* box = &annotRect;
62 ++#else
63 + PDFRectangle *box = annota->getRect();
64 ++#endif
65 + double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX;
66 + double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;
67 + double width = box->x2 - box->x1;
68 +@@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
69 + if (apa || !achar)
70 + {
71 + AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);
72 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
73 ++ const PDFRectangle& annotaRect = annota->getRect();
74 ++ Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);
75 ++#else
76 + Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);
77 ++#endif
78 + ano->draw(gfx, false);
79 + if (!bgFound)
80 + m_currColorFill = annotOutDev->currColorFill;
81 +@@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
82 +
83 + void SlaOutputDev::updateFont(GfxState *state)
84 + {
85 +- GfxFont *gfxFont;
86 +-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
87 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
88 ++ std::optional<GfxFontLoc> fontLoc;
89 ++ std::string fileName;
90 ++ std::unique_ptr<FoFiTrueType> ff;
91 ++ std::optional<std::vector<unsigned char>> tmpBuf;
92 ++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
93 + std::optional<GfxFontLoc> fontLoc;
94 + const GooString * fileName = nullptr;
95 + std::unique_ptr<FoFiTrueType> ff;
96 ++ char* tmpBuf = nullptr;
97 + #else
98 + GfxFontLoc * fontLoc = nullptr;
99 + GooString * fileName = nullptr;
100 + FoFiTrueType * ff = nullptr;
101 ++ char* tmpBuf = nullptr;
102 + #endif
103 + GfxFontType fontType;
104 + SlaOutFontFileID *id;
105 + SplashFontFile *fontFile;
106 + SplashFontSrc *fontsrc = nullptr;
107 + Object refObj, strObj;
108 +- char *tmpBuf = nullptr;
109 + int tmpBufLen = 0;
110 + int *codeToGID = nullptr;
111 + const double *textMat = nullptr;
112 +@@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state)
113 +
114 + m_font = nullptr;
115 +
116 +- gfxFont = state->getFont();
117 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
118 ++ GfxFont* gfxFont = state->getFont().get();
119 ++#else
120 ++ GfxFont* gfxFont = state->getFont();
121 ++#endif
122 + if (!gfxFont)
123 + goto err1;
124 +
125 +@@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state)
126 + if (fontLoc->locType == gfxFontLocEmbedded)
127 + {
128 + // if there is an embedded font, read it to memory
129 +- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
130 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
131 ++ tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef());
132 + if (! tmpBuf)
133 + goto err2;
134 ++#else
135 ++ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
136 ++ if (!tmpBuf)
137 ++ goto err2;
138 ++#endif
139 +
140 + // external font
141 + }
142 + else
143 + { // gfxFontLocExternal
144 +-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
145 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
146 ++ fileName = fontLoc->path;
147 ++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
148 + fileName = fontLoc->pathAsGooString();
149 + #else
150 + fileName = fontLoc->path;
151 +@@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state)
152 + }
153 +
154 + fontsrc = new SplashFontSrc;
155 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
156 ++ if (!fileName.empty())
157 ++ fontsrc->setFile(fileName);
158 ++ else
159 ++ fontsrc->setBuf(std::move(tmpBuf.value()));
160 ++#else
161 + if (fileName)
162 + fontsrc->setFile(fileName, gFalse);
163 + else
164 + fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
165 ++#endif
166 +
167 + // load the font file
168 + switch (fontType) {
169 + case fontType1:
170 +- if (!(fontFile = m_fontEngine->loadType1Font(
171 +- id,
172 +- fontsrc,
173 +- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
174 ++ if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
175 + {
176 +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
177 +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
178 ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
179 + goto err2;
180 + }
181 + break;
182 + case fontType1C:
183 +- if (!(fontFile = m_fontEngine->loadType1CFont(
184 +- id,
185 +- fontsrc,
186 +- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
187 ++ if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
188 + {
189 +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
190 +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
191 ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
192 + goto err2;
193 + }
194 + break;
195 + case fontType1COT:
196 +- if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(
197 +- id,
198 +- fontsrc,
199 +- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
200 ++ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
201 + {
202 +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
203 +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
204 ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
205 + goto err2;
206 + }
207 + break;
208 + case fontTrueType:
209 + case fontTrueTypeOT:
210 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
211 ++ if (!fileName.empty())
212 ++ ff = FoFiTrueType::load(fileName.c_str());
213 ++ else
214 ++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
215 ++#else
216 + if (fileName)
217 + ff = FoFiTrueType::load(fileName->getCString());
218 + else
219 + ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
220 ++#endif
221 + if (ff)
222 + {
223 + #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
224 +@@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state)
225 + codeToGID = nullptr;
226 + n = 0;
227 + }
228 +- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
229 +- id,
230 +- fontsrc,
231 +- codeToGID, n)))
232 ++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n)))
233 + {
234 +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
235 +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
236 ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
237 + goto err2;
238 + }
239 + break;
240 + case fontCIDType0:
241 + case fontCIDType0C:
242 +- if (!(fontFile = m_fontEngine->loadCIDFont(
243 +- id,
244 +- fontsrc)))
245 ++ if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))
246 + {
247 +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
248 +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
249 ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
250 + goto err2;
251 + }
252 + break;
253 +@@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state)
254 + codeToGID = nullptr;
255 + n = 0;
256 + }
257 +- if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(
258 +- id,
259 +- fontsrc,
260 +- codeToGID, n)))
261 ++ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n)))
262 + {
263 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
264 + gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
265 +@@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state)
266 + }
267 + else
268 + {
269 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
270 ++ if (!fileName.empty())
271 ++ ff = FoFiTrueType::load(fileName.c_str());
272 ++ else
273 ++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
274 ++#else
275 + if (fileName)
276 + ff = FoFiTrueType::load(fileName->getCString());
277 + else
278 + ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
279 ++#endif
280 + if (! ff)
281 + goto err2;
282 + #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
283 +@@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state)
284 + delete ff;
285 + #endif
286 + }
287 +- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
288 +- id,
289 +- fontsrc,
290 +- codeToGID, n, faceIndex)))
291 ++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex)))
292 + {
293 +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
294 +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
295 ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
296 + goto err2;
297 + }
298 + break;
299 +@@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub
300 + GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen)
301 + {
302 + // qDebug() << "beginType3Char";
303 ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
304 + GfxFont *gfxFont;
305 ++ if (!(gfxFont = state->getFont().get()))
306 ++ return gTrue;
307 ++#else
308 ++ GfxFont* gfxFont;
309 + if (!(gfxFont = state->getFont()))
310 + return gTrue;
311 ++#endif
312 + if (gfxFont->getType() != fontType3)
313 + return gTrue;
314 + F3Entry f3e;
315
316 diff --git a/app-office/scribus/scribus-9999.ebuild b/app-office/scribus/scribus-1.5.8-r1.ebuild
317 similarity index 89%
318 copy from app-office/scribus/scribus-9999.ebuild
319 copy to app-office/scribus/scribus-1.5.8-r1.ebuild
320 index b8abdb6f421f..d54fc9affaaa 100644
321 --- a/app-office/scribus/scribus-9999.ebuild
322 +++ b/app-office/scribus/scribus-1.5.8-r1.ebuild
323 @@ -1,21 +1,19 @@
324 # Copyright 1999-2022 Gentoo Authors
325 # Distributed under the terms of the GNU General Public License v2
326
327 -EAPI=7
328 +EAPI=8
329
330 PYTHON_COMPAT=( python3_{8..10} )
331 PYTHON_REQ_USE="tk?"
332 -inherit cmake desktop flag-o-matic python-single-r1 subversion xdg
333 +inherit cmake desktop flag-o-matic python-single-r1 xdg
334
335 DESCRIPTION="Desktop publishing (DTP) and layout program"
336 HOMEPAGE="https://www.scribus.net/"
337 -SRC_URI=""
338 -ESVN_REPO_URI="svn://scribus.net/trunk/Scribus"
339 -ESVN_PROJECT=Scribus-1.5
340 +SRC_URI="mirror://sourceforge/project/${PN}/${PN}-devel/${PV}/${P}.tar.xz"
341
342 LICENSE="GPL-2"
343 SLOT="0"
344 -KEYWORDS=""
345 +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
346 IUSE="+boost debug examples graphicsmagick hunspell +minimal osg +pdf scripts +templates tk"
347
348 REQUIRED_USE="${PYTHON_REQUIRED_USE}
349 @@ -44,6 +42,7 @@ DEPEND="${PYTHON_DEPS}
350 media-libs/lcms:2
351 media-libs/libcdr
352 media-libs/libfreehand
353 + media-libs/libjpeg-turbo:=
354 media-libs/libpagemaker
355 media-libs/libpng:0=
356 media-libs/libvisio
357 @@ -51,7 +50,6 @@ DEPEND="${PYTHON_DEPS}
358 media-libs/tiff:0
359 net-print/cups
360 sys-libs/zlib[minizip]
361 - virtual/jpeg:0=
362 x11-libs/cairo[X,svg]
363 boost? ( dev-libs/boost:= )
364 graphicsmagick? ( media-gfx/graphicsmagick:= )
365 @@ -78,10 +76,16 @@ PATCHES=(
366 "${FILESDIR}"/${PN}-1.5.6-docdir.patch
367 "${FILESDIR}"/${PN}-1.5.8-findhyphen-1.patch
368 "${FILESDIR}"/${PN}-1.5.6-findhyphen.patch
369 + "${FILESDIR}"/${PN}-1.5.8-poppler-22.2.0-1.patch
370 + "${FILESDIR}"/${PN}-1.5.8-poppler-22.2.0-2.patch
371 + "${FILESDIR}"/${PN}-1.5.8-poppler-22.03.0.patch # bug 834537
372 + "${FILESDIR}"/${PN}-1.5.8-poppler-22.04.0.patch # bug 843287
373 )
374
375 CMAKE_BUILD_TYPE="Release"
376
377 +S="${WORKDIR}/${P}"
378 +
379 src_prepare() {
380 cmake_src_prepare
381
382
383 diff --git a/app-office/scribus/scribus-9999.ebuild b/app-office/scribus/scribus-9999.ebuild
384 index b8abdb6f421f..dc6748192f39 100644
385 --- a/app-office/scribus/scribus-9999.ebuild
386 +++ b/app-office/scribus/scribus-9999.ebuild
387 @@ -44,6 +44,7 @@ DEPEND="${PYTHON_DEPS}
388 media-libs/lcms:2
389 media-libs/libcdr
390 media-libs/libfreehand
391 + media-libs/libjpeg-turbo:=
392 media-libs/libpagemaker
393 media-libs/libpng:0=
394 media-libs/libvisio
395 @@ -51,7 +52,6 @@ DEPEND="${PYTHON_DEPS}
396 media-libs/tiff:0
397 net-print/cups
398 sys-libs/zlib[minizip]
399 - virtual/jpeg:0=
400 x11-libs/cairo[X,svg]
401 boost? ( dev-libs/boost:= )
402 graphicsmagick? ( media-gfx/graphicsmagick:= )