summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-05-08 17:58:53 +0000
committerSam James <sam@gentoo.org>2022-05-08 18:00:12 +0000
commit65615103763c15420ea24f0781626384dcbc83d7 (patch)
treeba3dcbb367c636d82b49bd913903b8b66d17a839 /app-office/scribus
parentmedia-gfx/inkscape: fix build with Poppler 22.04.0 (diff)
downloadgentoo-65615103763c15420ea24f0781626384dcbc83d7.tar.gz
gentoo-65615103763c15420ea24f0781626384dcbc83d7.tar.bz2
gentoo-65615103763c15420ea24f0781626384dcbc83d7.zip
app-office/scribus: fix build with Poppler 22.04.0
Closes: https://bugs.gentoo.org/843287 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-office/scribus')
-rw-r--r--app-office/scribus/files/scribus-1.5.8-poppler-22.04.0.patch291
-rw-r--r--app-office/scribus/scribus-1.5.8-r1.ebuild163
-rw-r--r--app-office/scribus/scribus-9999.ebuild2
3 files changed, 455 insertions, 1 deletions
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
new file mode 100644
index 000000000000..290484e7e872
--- /dev/null
+++ b/app-office/scribus/files/scribus-1.5.8-poppler-22.04.0.patch
@@ -0,0 +1,291 @@
+https://bugs.gentoo.org/843287
+https://github.com/scribusproject/scribus/commit/f2237b8f0b5cf7690e864a22ef7a63a6d769fa36.patch
+
+From f2237b8f0b5cf7690e864a22ef7a63a6d769fa36 Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Fri, 1 Apr 2022 23:52:32 +0000
+Subject: [PATCH] Fix build with poppler 22.04.0
+
+git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870
+---
+ scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++---------
+ 1 file changed, 78 insertions(+), 45 deletions(-)
+
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+index e20a81f99e..5626fe3477 100644
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s)
+ int shade = 100;
+ currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
+ fontSize = state->getFontSize();
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ if (state->getFont() && state->getFont()->getName())
++ fontName = new GooString(state->getFont()->getName().value());
++#else
+ if (state->getFont())
+ fontName = state->getFont()->getName()->copy();
++#endif
+ itemText = s->copy();
+ }
+
+@@ -357,7 +362,12 @@ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key
+ GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
+ {
+ SlaOutputDev *dev = (SlaOutputDev*)user_data;
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ const PDFRectangle& annotRect = annota->getRect();;
++ const PDFRectangle* box = &annotRect;
++#else
+ PDFRectangle *box = annota->getRect();
++#endif
+ double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX;
+ double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;
+ double width = box->x2 - box->x1;
+@@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
+ if (apa || !achar)
+ {
+ AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ const PDFRectangle& annotaRect = annota->getRect();
++ Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);
++#else
+ Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);
++#endif
+ ano->draw(gfx, false);
+ if (!bgFound)
+ m_currColorFill = annotOutDev->currColorFill;
+@@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
+
+ void SlaOutputDev::updateFont(GfxState *state)
+ {
+- GfxFont *gfxFont;
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ std::optional<GfxFontLoc> fontLoc;
++ std::string fileName;
++ std::unique_ptr<FoFiTrueType> ff;
++ std::optional<std::vector<unsigned char>> tmpBuf;
++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ std::optional<GfxFontLoc> fontLoc;
+ const GooString * fileName = nullptr;
+ std::unique_ptr<FoFiTrueType> ff;
++ char* tmpBuf = nullptr;
+ #else
+ GfxFontLoc * fontLoc = nullptr;
+ GooString * fileName = nullptr;
+ FoFiTrueType * ff = nullptr;
++ char* tmpBuf = nullptr;
+ #endif
+ GfxFontType fontType;
+ SlaOutFontFileID *id;
+ SplashFontFile *fontFile;
+ SplashFontSrc *fontsrc = nullptr;
+ Object refObj, strObj;
+- char *tmpBuf = nullptr;
+ int tmpBufLen = 0;
+ int *codeToGID = nullptr;
+ const double *textMat = nullptr;
+@@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state)
+
+ m_font = nullptr;
+
+- gfxFont = state->getFont();
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ GfxFont* gfxFont = state->getFont().get();
++#else
++ GfxFont* gfxFont = state->getFont();
++#endif
+ if (!gfxFont)
+ goto err1;
+
+@@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state)
+ if (fontLoc->locType == gfxFontLocEmbedded)
+ {
+ // if there is an embedded font, read it to memory
+- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef());
+ if (! tmpBuf)
+ goto err2;
++#else
++ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
++ if (!tmpBuf)
++ goto err2;
++#endif
+
+ // external font
+ }
+ else
+ { // gfxFontLocExternal
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ fileName = fontLoc->path;
++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ fileName = fontLoc->pathAsGooString();
+ #else
+ fileName = fontLoc->path;
+@@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state)
+ }
+
+ fontsrc = new SplashFontSrc;
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ if (!fileName.empty())
++ fontsrc->setFile(fileName);
++ else
++ fontsrc->setBuf(std::move(tmpBuf.value()));
++#else
+ if (fileName)
+ fontsrc->setFile(fileName, gFalse);
+ else
+ fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
++#endif
+
+ // load the font file
+ switch (fontType) {
+ case fontType1:
+- if (!(fontFile = m_fontEngine->loadType1Font(
+- id,
+- fontsrc,
+- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
++ if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
+ {
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontType1C:
+- if (!(fontFile = m_fontEngine->loadType1CFont(
+- id,
+- fontsrc,
+- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
++ if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
+ {
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontType1COT:
+- if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(
+- id,
+- fontsrc,
+- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
++ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
+ {
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontTrueType:
+ case fontTrueTypeOT:
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ if (!fileName.empty())
++ ff = FoFiTrueType::load(fileName.c_str());
++ else
++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
++#else
+ if (fileName)
+ ff = FoFiTrueType::load(fileName->getCString());
+ else
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
++#endif
+ if (ff)
+ {
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+@@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state)
+ codeToGID = nullptr;
+ n = 0;
+ }
+- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
+- id,
+- fontsrc,
+- codeToGID, n)))
++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n)))
+ {
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
+ break;
+ case fontCIDType0:
+ case fontCIDType0C:
+- if (!(fontFile = m_fontEngine->loadCIDFont(
+- id,
+- fontsrc)))
++ if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))
+ {
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
+ break;
+@@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state)
+ codeToGID = nullptr;
+ n = 0;
+ }
+- if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(
+- id,
+- fontsrc,
+- codeToGID, n)))
++ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n)))
+ {
+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+ gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+@@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state)
+ }
+ else
+ {
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++ if (!fileName.empty())
++ ff = FoFiTrueType::load(fileName.c_str());
++ else
++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
++#else
+ if (fileName)
+ ff = FoFiTrueType::load(fileName->getCString());
+ else
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
++#endif
+ if (! ff)
+ goto err2;
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+@@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state)
+ delete ff;
+ #endif
+ }
+- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
+- id,
+- fontsrc,
+- codeToGID, n, faceIndex)))
++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex)))
+ {
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
+ break;
+@@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub
+ GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen)
+ {
+ // qDebug() << "beginType3Char";
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ GfxFont *gfxFont;
++ if (!(gfxFont = state->getFont().get()))
++ return gTrue;
++#else
++ GfxFont* gfxFont;
+ if (!(gfxFont = state->getFont()))
+ return gTrue;
++#endif
+ if (gfxFont->getType() != fontType3)
+ return gTrue;
+ F3Entry f3e;
diff --git a/app-office/scribus/scribus-1.5.8-r1.ebuild b/app-office/scribus/scribus-1.5.8-r1.ebuild
new file mode 100644
index 000000000000..d54fc9affaaa
--- /dev/null
+++ b/app-office/scribus/scribus-1.5.8-r1.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_REQ_USE="tk?"
+inherit cmake desktop flag-o-matic python-single-r1 xdg
+
+DESCRIPTION="Desktop publishing (DTP) and layout program"
+HOMEPAGE="https://www.scribus.net/"
+SRC_URI="mirror://sourceforge/project/${PN}/${PN}-devel/${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE="+boost debug examples graphicsmagick hunspell +minimal osg +pdf scripts +templates tk"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ tk? ( scripts )"
+
+# osg
+# couple of third_party libs bundled
+DEPEND="${PYTHON_DEPS}
+ app-text/libmspub
+ app-text/libqxp
+ app-text/poppler:=
+ dev-libs/hyphen
+ dev-libs/icu:0=
+ dev-libs/librevenge
+ dev-libs/libxml2
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5[-gles2-only]
+ dev-qt/qtnetwork:5
+ dev-qt/qtopengl:5
+ dev-qt/qtprintsupport:5
+ dev-qt/qtwidgets:5
+ dev-qt/qtxml:5
+ media-libs/fontconfig
+ media-libs/freetype:2
+ media-libs/harfbuzz:0=[icu]
+ media-libs/lcms:2
+ media-libs/libcdr
+ media-libs/libfreehand
+ media-libs/libjpeg-turbo:=
+ media-libs/libpagemaker
+ media-libs/libpng:0=
+ media-libs/libvisio
+ media-libs/libzmf
+ media-libs/tiff:0
+ net-print/cups
+ sys-libs/zlib[minizip]
+ x11-libs/cairo[X,svg]
+ boost? ( dev-libs/boost:= )
+ graphicsmagick? ( media-gfx/graphicsmagick:= )
+ hunspell? ( app-text/hunspell:= )
+ osg? ( dev-games/openscenegraph:= )
+ pdf? ( app-text/podofo:0= )
+ scripts? (
+ $(python_gen_cond_dep '
+ dev-python/pillow[tk?,${PYTHON_USEDEP}]
+ ')
+ )
+"
+RDEPEND="${DEPEND}
+ app-text/ghostscript-gpl
+"
+BDEPEND="
+ dev-qt/linguist-tools:5
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ # non(?)-upstreamable
+ "${FILESDIR}"/${PN}-1.5.3-fpic.patch
+ "${FILESDIR}"/${PN}-1.5.6-docdir.patch
+ "${FILESDIR}"/${PN}-1.5.8-findhyphen-1.patch
+ "${FILESDIR}"/${PN}-1.5.6-findhyphen.patch
+ "${FILESDIR}"/${PN}-1.5.8-poppler-22.2.0-1.patch
+ "${FILESDIR}"/${PN}-1.5.8-poppler-22.2.0-2.patch
+ "${FILESDIR}"/${PN}-1.5.8-poppler-22.03.0.patch # bug 834537
+ "${FILESDIR}"/${PN}-1.5.8-poppler-22.04.0.patch # bug 843287
+)
+
+CMAKE_BUILD_TYPE="Release"
+
+S="${WORKDIR}/${P}"
+
+src_prepare() {
+ cmake_src_prepare
+
+ rm -r codegen/cheetah scribus/third_party/hyphen || die
+
+ sed \
+ -e "/^\s*unzip\.[ch]/d" \
+ -e "/^\s*ioapi\.[ch]/d" \
+ -i scribus/CMakeLists.txt Scribus.pro || die
+ rm scribus/ioapi.[ch] || die
+
+ sed \
+ -e 's:\(${CMAKE_INSTALL_PREFIX}\):./\1:g' \
+ -i resources/templates/CMakeLists.txt || die
+
+ sed \
+ -e "/^add_subdirectory(ui\/qml)/s/^/#DONT/" \
+ -i scribus/CMakeLists.txt || die # nothing but a bogus Hello World test
+}
+
+src_configure() {
+ # bug #550818
+ append-cppflags -DHAVE_MEMRCHR
+
+ local mycmakeargs=(
+ -DHAVE_PYTHON=ON
+ -DWANT_DISTROBUILD=ON
+ -DWANT_CPP17=ON
+ -DDOCDIR="${EPREFIX}"/usr/share/doc/${PF}/
+ -DPython3_EXECUTABLE="${PYTHON}"
+ -DWITH_BOOST=$(usex boost)
+ -DWANT_DEBUG=$(usex debug)
+ -DWANT_NOEXAMPLES=$(usex !examples)
+ -DWANT_GRAPHICSMAGICK=$(usex graphicsmagick)
+ -DWANT_HUNSPELL=$(usex hunspell)
+ -DWANT_HEADERINSTALL=$(usex !minimal)
+ -DWANT_NOOSG=$(usex !osg)
+ -DWITH_PODOFO=$(usex pdf)
+ -DWANT_NOTEMPLATES=$(usex !templates)
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ if ! use tk; then
+ rm "${ED}"/usr/share/scribus/scripts/{FontSample,CalendarWizard}.py || die
+ fi
+ if use scripts; then
+ python_fix_shebang "${ED}"/usr/share/scribus/scripts
+ python_optimize "${ED}"/usr/share/scribus/scripts
+ else
+ rm "${ED}"/usr/share/scribus/scripts/*.py || die
+ fi
+
+ mv "${ED}"/usr/share/doc/${PF}/{en,html} || die
+ ln -sf html "${ED}"/usr/share/doc/${PF}/en || die
+
+ # These files are parsed to populate the help/about window.
+ cat >> "${T}"/COPYING <<- EOF || die
+ ${PN} is licensed under the "${LICENSE}".
+ Please visit https://www.gnu.org/licenses/gpl-2.0.html for the complete license text.
+ EOF
+ dodoc "${T}"/COPYING
+ docompress -x /usr/share/doc/${PF}/en /usr/share/doc/${PF}/{AUTHORS,TRANSLATION,LINKS,COPYING}
+
+ local size
+ for size in 16 32 128 256 512; do
+ newicon -s $size resources/iconsets/artwork/icon_${size}x${size}.png scribus.png
+ done
+ newicon -s 64 resources/iconsets/artwork/icon_32x32@2x.png scribus.png
+ doicon resources/iconsets/*/scribus.png
+ domenu scribus.desktop
+}
diff --git a/app-office/scribus/scribus-9999.ebuild b/app-office/scribus/scribus-9999.ebuild
index b8abdb6f421f..dc6748192f39 100644
--- a/app-office/scribus/scribus-9999.ebuild
+++ b/app-office/scribus/scribus-9999.ebuild
@@ -44,6 +44,7 @@ DEPEND="${PYTHON_DEPS}
media-libs/lcms:2
media-libs/libcdr
media-libs/libfreehand
+ media-libs/libjpeg-turbo:=
media-libs/libpagemaker
media-libs/libpng:0=
media-libs/libvisio
@@ -51,7 +52,6 @@ DEPEND="${PYTHON_DEPS}
media-libs/tiff:0
net-print/cups
sys-libs/zlib[minizip]
- virtual/jpeg:0=
x11-libs/cairo[X,svg]
boost? ( dev-libs/boost:= )
graphicsmagick? ( media-gfx/graphicsmagick:= )