summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-05-08 17:41:15 +0000
committerSam James <sam@gentoo.org>2022-05-08 17:42:19 +0000
commitea7abbfe5d1f6fbe2f25979b00e3d36651e0a041 (patch)
tree21c9a307ae548e0749228859167bd5be6c9ce87c
parentdev-python/xmltodict: add 0.13.0 (diff)
downloadgentoo-ea7abbfe5d1f6fbe2f25979b00e3d36651e0a041.tar.gz
gentoo-ea7abbfe5d1f6fbe2f25979b00e3d36651e0a041.tar.bz2
gentoo-ea7abbfe5d1f6fbe2f25979b00e3d36651e0a041.zip
media-gfx/inkscape: fix build with Poppler 22.04.0
Also, switch out the 22.03.0 patch with the variant in upstream's 1.1.x branch so that 22.04.x patch applies (from same place). Closes: https://bugs.gentoo.org/843275 Closes: https://bugs.gentoo.org/835661 Bug: https://bugs.gentoo.org/835424 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.03.0.patch43
-rw-r--r--media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.04.0.patch130
-rw-r--r--media-gfx/inkscape/inkscape-1.1.2-r1.ebuild184
3 files changed, 357 insertions, 0 deletions
diff --git a/media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.03.0.patch b/media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.03.0.patch
new file mode 100644
index 00000000000..4083c942664
--- /dev/null
+++ b/media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.03.0.patch
@@ -0,0 +1,43 @@
+https://gitlab.com/inkscape/inkscape/-/commit/f7857a4fc2b916e64d9689ccc89914ad19f3ef0a.patch
+https://bugs.gentoo.org/843275
+
+From f7857a4fc2b916e64d9689ccc89914ad19f3ef0a Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos@foutrelis.com>
+Date: Sun, 20 Mar 2022 22:41:51 -0300
+Subject: [PATCH] Ensure compatibility with Poppler 22.03 and later
+
+This change ensures that Inkscape will build against Poppler 22.03 after
+the changes that were made to the constructor of `PDFDoc`.
+
+See: https://gitlab.freedesktop.org/poppler/poppler/-/commit/4f2abd3ef
+
+Co-authored-by: Rafael Siejakowski <rs@rs-math.net>
+(cherry picked from commit a18c57ffff313fd08bc8a44f6b6bf0b01d7e9b75)
+--- a/src/extension/internal/pdfinput/pdf-input.cpp
++++ b/src/extension/internal/pdfinput/pdf-input.cpp
+@@ -668,8 +668,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
+
+ // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from
+ // glib gstdio.c
+- GooString *filename_goo = new GooString(uri);
+- pdf_doc = std::make_shared<PDFDoc>(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password
++ pdf_doc = _POPPLER_MAKE_SHARED_PDFDOC(uri); // TODO: Could ask for password
+
+ if (!pdf_doc->isOk()) {
+ int error = pdf_doc->getErrorCode();
+--- a/src/extension/internal/pdfinput/poppler-transition-api.h
++++ b/src/extension/internal/pdfinput/poppler-transition-api.h
+@@ -14,6 +14,12 @@
+
+ #include <glib/poppler-features.h>
+
++#if POPPLER_CHECK_VERSION(22, 3, 0)
++#define _POPPLER_MAKE_SHARED_PDFDOC(uri) std::make_shared<PDFDoc>(std::make_unique<GooString>(uri))
++#else
++#define _POPPLER_MAKE_SHARED_PDFDOC(uri) std::make_shared<PDFDoc>(new GooString(uri), nullptr, nullptr, nullptr)
++#endif
++
+ #if POPPLER_CHECK_VERSION(0, 83, 0)
+ #define _POPPLER_CONST_83 const
+ #else
+GitLab
diff --git a/media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.04.0.patch b/media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.04.0.patch
new file mode 100644
index 00000000000..8e507d0ebcf
--- /dev/null
+++ b/media-gfx/inkscape/files/inkscape-1.1.2-r1-poppler-22.04.0.patch
@@ -0,0 +1,130 @@
+https://gitlab.com/inkscape/inkscape/-/commit/a18c57ffff313fd08bc8a44f6b6bf0b01d7e9b75.patch
+https://bugs.gentoo.org/835661
+
+From 08b2f3d93c08bcf1e363f4284112fd14a7cbd09c Mon Sep 17 00:00:00 2001
+From: Rafael Siejakowski <rs@rs-math.net>
+Date: Mon, 4 Apr 2022 22:09:39 -0300
+Subject: [PATCH] Compatibility with Poppler 22.04
+
+Replace vanilla pointers with std::shared_ptr for pointers to fonts;
+eliminate manual ref-counting.
+Cherry-picked from 6a7b9ec0af088baa08b92fd76b33eca26537fb35.
+
+Fixes https://gitlab.com/inkscape/inkscape/-/issues/3387
+--- a/src/extension/internal/pdfinput/pdf-parser.cpp
++++ b/src/extension/internal/pdfinput/pdf-parser.cpp
+@@ -30,6 +30,7 @@
+ #include "Gfx.h"
+ #include "pdf-parser.h"
+ #include "util/units.h"
++#include "poppler-transition-api.h"
+
+ #include "glib/poppler-features.h"
+ #include "goo/gmem.h"
+@@ -2158,7 +2159,7 @@ void PdfParser::opSetCharSpacing(Object args[], int /*numArgs*/)
+ // TODO not good that numArgs is ignored but args[] is used:
+ void PdfParser::opSetFont(Object args[], int /*numArgs*/)
+ {
+- GfxFont *font = res->lookupFont(args[0].getName());
++ auto font = res->lookupFont(args[0].getName());
+
+ if (!font) {
+ // unsetting the font (drawing no text) is better than using the
+@@ -2179,7 +2180,9 @@ void PdfParser::opSetFont(Object args[], int /*numArgs*/)
+ fflush(stdout);
+ }
+
++#if !POPPLER_CHECK_VERSION(22, 4, 0)
+ font->incRefCnt();
++#endif
+ state->setFont(font, args[1].getNum());
+ fontChanged = gTrue;
+ }
+@@ -2373,7 +2376,6 @@ void PdfParser::doShowText(const GooString *s) {
+ #else
+ void PdfParser::doShowText(GooString *s) {
+ #endif
+- GfxFont *font;
+ int wMode;
+ double riseX, riseY;
+ CharCode code;
+@@ -2392,7 +2394,7 @@ void PdfParser::doShowText(GooString *s) {
+ #endif
+ int len, n, uLen;
+
+- font = state->getFont();
++ auto font = state->getFont();
+ wMode = font->getWMode();
+
+ builder->beginString(state);
+@@ -2445,10 +2447,10 @@ void PdfParser::doShowText(GooString *s) {
+ //out->updateCTM(state, 1, 0, 0, 1, 0, 0);
+ if (false){ /*!out->beginType3Char(state, curX + riseX, curY + riseY, tdx, tdy,
+ code, u, uLen)) {*/
+- _POPPLER_CALL_ARGS(charProc, ((Gfx8BitFont *)font)->getCharProc, code);
+- if ((resDict = ((Gfx8BitFont *)font)->getResources())) {
++ _POPPLER_CALL_ARGS(charProc, _POPPLER_FONTPTR_TO_GFX8(font)->getCharProc, code);
++ if (resDict = _POPPLER_FONTPTR_TO_GFX8(font)->getResources()) {
+ pushResources(resDict);
+- }
++ }
+ if (charProc.isStream()) {
+ //parse(&charProc, gFalse); // TODO: parse into SVG font
+ } else {
+--- a/src/extension/internal/pdfinput/poppler-transition-api.h
++++ b/src/extension/internal/pdfinput/poppler-transition-api.h
+@@ -14,6 +14,12 @@
+
+ #include <glib/poppler-features.h>
+
++#if POPPLER_CHECK_VERSION(22, 4, 0)
++#define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr.get())
++#else
++#define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr)
++#endif
++
+ #if POPPLER_CHECK_VERSION(22, 3, 0)
+ #define _POPPLER_MAKE_SHARED_PDFDOC(uri) std::make_shared<PDFDoc>(std::make_unique<GooString>(uri))
+ #else
+--- a/src/extension/internal/pdfinput/svg-builder.cpp
++++ b/src/extension/internal/pdfinput/svg-builder.cpp
+@@ -108,7 +108,6 @@ SvgBuilder::~SvgBuilder() = default;
+
+ void SvgBuilder::_init() {
+ _font_style = nullptr;
+- _current_font = nullptr;
+ _font_specification = nullptr;
+ _font_scaling = 1;
+ _need_font_update = true;
+@@ -1021,11 +1020,8 @@ void SvgBuilder::updateFont(GfxState *state) {
+ _need_font_update = false;
+ updateTextMatrix(state); // Ensure that we have a text matrix built
+
+- if (_font_style) {
+- //sp_repr_css_attr_unref(_font_style);
+- }
+ _font_style = sp_repr_css_attr_new();
+- GfxFont *font = state->getFont();
++ auto font = state->getFont();
+ // Store original name
+ if (font->getName()) {
+ _font_specification = font->getName()->getCString();
+@@ -1171,7 +1167,6 @@ void SvgBuilder::updateFont(GfxState *state) {
+ sp_repr_css_set_property(_font_style, "writing-mode", "tb");
+ }
+
+- _current_font = font;
+ _invalidated_style = true;
+ }
+
+--- a/src/extension/internal/pdfinput/svg-builder.h
++++ b/src/extension/internal/pdfinput/svg-builder.h
+@@ -203,7 +203,6 @@ private:
+ std::vector<SvgGraphicsState> _state_stack;
+
+ SPCSSAttr *_font_style; // Current font style
+- GfxFont *_current_font;
+ const char *_font_specification;
+ double _font_scaling;
+ bool _need_font_update;
+GitLab
diff --git a/media-gfx/inkscape/inkscape-1.1.2-r1.ebuild b/media-gfx/inkscape/inkscape-1.1.2-r1.ebuild
new file mode 100644
index 00000000000..92895f6cd95
--- /dev/null
+++ b/media-gfx/inkscape/inkscape-1.1.2-r1.ebuild
@@ -0,0 +1,184 @@
+# 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="xml"
+MY_P="${P/_/}"
+inherit cmake flag-o-matic xdg toolchain-funcs python-single-r1
+
+if [[ ${PV} = 9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://gitlab.com/inkscape/inkscape.git"
+else
+ SRC_URI="https://media.inkscape.org/dl/resources/file/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+DESCRIPTION="SVG based generic vector-drawing program"
+HOMEPAGE="https://inkscape.org/"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+IUSE="cdr dbus dia exif graphicsmagick imagemagick inkjar jemalloc jpeg
+openmp postscript readline spell svg2 test visio wpg"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+BDEPEND="
+ dev-util/glib-utils
+ >=dev-util/intltool-0.40
+ >=sys-devel/gettext-0.17
+ virtual/pkgconfig
+"
+COMMON_DEPEND="${PYTHON_DEPS}
+ >=app-text/poppler-0.57.0:=[cairo]
+ >=dev-cpp/cairomm-1.12:0
+ >=dev-cpp/glibmm-2.54.1:2
+ dev-cpp/gtkmm:3.0
+ >=dev-cpp/pangomm-2.40:1.4
+ >=dev-libs/boehm-gc-7.1:=
+ >=dev-libs/boost-1.65:=
+ dev-libs/double-conversion:=
+ >=dev-libs/glib-2.41
+ >=dev-libs/libsigc++-2.8:2
+ >=dev-libs/libxml2-2.7.4
+ >=dev-libs/libxslt-1.1.25
+ dev-libs/gdl:3
+ dev-libs/popt
+ media-gfx/potrace
+ media-libs/fontconfig
+ media-libs/freetype:2
+ media-libs/lcms:2
+ media-libs/libpng:0=
+ net-libs/libsoup:2.4
+ sci-libs/gsl:=
+ x11-libs/libX11
+ >=x11-libs/pango-1.37.2
+ x11-libs/gtk+:3
+ $(python_gen_cond_dep '
+ dev-python/lxml[${PYTHON_USEDEP}]
+ media-gfx/scour[${PYTHON_USEDEP}]
+ ')
+ cdr? (
+ app-text/libwpg:0.3
+ dev-libs/librevenge
+ media-libs/libcdr
+ )
+ dbus? ( dev-libs/dbus-glib )
+ exif? ( media-libs/libexif )
+ imagemagick? (
+ !graphicsmagick? ( media-gfx/imagemagick:=[cxx] )
+ graphicsmagick? ( media-gfx/graphicsmagick:=[cxx] )
+ )
+ jemalloc? ( dev-libs/jemalloc )
+ jpeg? ( virtual/jpeg:0 )
+ readline? ( sys-libs/readline:= )
+ spell? ( app-text/gspell )
+ visio? (
+ app-text/libwpg:0.3
+ dev-libs/librevenge
+ media-libs/libvisio
+ )
+ wpg? (
+ app-text/libwpg:0.3
+ dev-libs/librevenge
+ )
+"
+# These only use executables provided by these packages
+# See share/extensions for more details. inkscape can tell you to
+# install these so we could of course just not depend on those and rely
+# on that.
+RDEPEND="${COMMON_DEPEND}
+ $(python_gen_cond_dep '
+ dev-python/numpy[${PYTHON_USEDEP}]
+ ')
+ dia? ( app-office/dia )
+ postscript? ( app-text/ghostscript-gpl )
+"
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-cpp/gtest )
+"
+
+RESTRICT="!test? ( test )"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.1.2-r1-poppler-22.03.0.patch" # bug 835424
+ "${FILESDIR}/${PN}-1.1.2-r1-poppler-22.04.0.patch" # bug 835661 / bug 843275
+)
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
+ tc-has-openmp || die "Please switch to an openmp compatible compiler"
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} = 9999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ fi
+ [[ -d "${S}" ]] || mv -v "${WORKDIR}/${P}_202"?-??-* "${S}" || die
+}
+
+src_prepare() {
+ cmake_src_prepare
+ sed -i "/install.*COPYING/d" CMakeScripts/ConfigCPack.cmake || die
+}
+
+src_configure() {
+ # aliasing unsafe wrt #310393
+ append-flags -fno-strict-aliasing
+
+ local mycmakeargs=(
+ # -DWITH_LPETOOL # Compile with LPE Tool and experimental LPEs enabled
+ -DWITH_NLS=ON
+ -DENABLE_POPPLER=ON
+ -DENABLE_POPPLER_CAIRO=ON
+ -DWITH_PROFILING=OFF
+ -DWITH_INTERNAL_2GEOM=ON
+ -DBUILD_TESTING=$(usex test)
+ -DWITH_LIBCDR=$(usex cdr)
+ -DWITH_DBUS=$(usex dbus)
+ -DWITH_IMAGE_MAGICK=$(usex imagemagick $(usex !graphicsmagick)) # requires ImageMagick 6, only IM must be enabled
+ -DWITH_GRAPHICS_MAGICK=$(usex graphicsmagick $(usex imagemagick)) # both must be enabled to use GraphicsMagick
+ -DWITH_GNU_READLINE=$(usex readline)
+ -DWITH_GSPELL=$(usex spell)
+ -DWITH_JEMALLOC=$(usex jemalloc)
+ -DENABLE_LCMS=ON
+ -DWITH_OPENMP=$(usex openmp)
+ -DBUILD_SHARED_LIBS=ON
+ -DWITH_SVG2=$(usex svg2)
+ -DWITH_LIBVISIO=$(usex visio)
+ -DWITH_LIBWPG=$(usex wpg)
+ )
+
+ cmake_src_configure
+}
+
+src_test() {
+ cmake_build -j1 check
+}
+
+src_install() {
+ cmake_src_install
+
+ find "${ED}" -type f -name "*.la" -delete || die
+
+ find "${ED}"/usr/share/man -type f -maxdepth 3 -name '*.bz2' -exec bzip2 -d {} \; || die
+
+ find "${ED}"/usr/share/man -type f -maxdepth 3 -name '*.gz' -exec gzip -d {} \; || die
+
+ local extdir="${ED}"/usr/share/${PN}/extensions
+
+ if [[ -e "${extdir}" ]] && [[ -n $(find "${extdir}" -mindepth 1) ]]; then
+ python_optimize "${ED}"/usr/share/${PN}/extensions
+ fi
+
+ # Empty directory causes sandbox issues, see bug #761915
+ rm -r "${ED}/usr/share/inkscape/fonts" || die "Failed to remove fonts directory."
+}