summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
author Matteo Bernardini2024-05-23 09:06:48 +0200
committer Matteo Bernardini2024-06-08 15:02:58 +0200
commita7012d8bf5f1de8e04d0bc783cae0f8e93500257 (patch)
treed0c0e019d333cfbb9befe51aa42ff43a360176a8 /graphics
parentbc9d18b502448dd277146e40e6546eac0cd8d670 (diff)
downloadslackbuilds-inkscape.tar.gz
graphics/inkscape: Patch for the newer poppler.inkscape
Patch also to support the c++20 standard Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'graphics')
-rw-r--r--graphics/inkscape/inkscape.SlackBuild3
-rw-r--r--graphics/inkscape/patches/1_694d8ae.patch (renamed from graphics/inkscape/libxml2-2.12.patch)0
-rw-r--r--graphics/inkscape/patches/2_f7e9445.patch76
-rw-r--r--graphics/inkscape/patches/3_96ca7a6.patch64
-rw-r--r--graphics/inkscape/patches/4_1798e9c.patch91
5 files changed, 233 insertions, 1 deletions
diff --git a/graphics/inkscape/inkscape.SlackBuild b/graphics/inkscape/inkscape.SlackBuild
index 416df46df2..4b4ef37481 100644
--- a/graphics/inkscape/inkscape.SlackBuild
+++ b/graphics/inkscape/inkscape.SlackBuild
@@ -94,7 +94,8 @@ dos2unix -k -q share/extensions/*.py
# Fix man page location:
sed -i CMakeScripts/Pod2man.cmake -e "s/SHARE_INSTALL/CMAKE_INSTALL_PREFIX/g"
-patch -p1 < $CWD/libxml2-2.12.patch
+# Apply upstream commits for the newer libxml2 and poppler
+for i in $CWD/patches/* ; do patch -p1 < $i ; done
mkdir -p build
cd build
diff --git a/graphics/inkscape/libxml2-2.12.patch b/graphics/inkscape/patches/1_694d8ae.patch
index dc5b0f5346..dc5b0f5346 100644
--- a/graphics/inkscape/libxml2-2.12.patch
+++ b/graphics/inkscape/patches/1_694d8ae.patch
diff --git a/graphics/inkscape/patches/2_f7e9445.patch b/graphics/inkscape/patches/2_f7e9445.patch
new file mode 100644
index 0000000000..bc5a98c99c
--- /dev/null
+++ b/graphics/inkscape/patches/2_f7e9445.patch
@@ -0,0 +1,76 @@
+From f7e944575ea5247952d23f85dfa905cfa13f7b28 Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm@gentoo.org>
+Date: Mon, 4 Mar 2024 22:59:40 +0100
+Subject: [PATCH] Fix build with >=poppler-24.03.0
+
+Fixes build errors caused by:
+
+"Use an enum for Function getType"
+Upstream commit 6e3824d45d42cb806a28a2df84e4ab6bb3587083
+
+Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
+
+Fixes https://gitlab.com/inkscape/inkscape/-/issues/4787
+---
+ .../internal/pdfinput/poppler-transition-api.h | 10 ++++++++++
+ src/extension/internal/pdfinput/svg-builder.cpp | 8 ++++----
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
+index 66b15d705a2..58aa1ec921d 100644
+--- a/src/extension/internal/pdfinput/poppler-transition-api.h
++++ b/src/extension/internal/pdfinput/poppler-transition-api.h
+@@ -14,6 +14,16 @@
+
+ #include <glib/poppler-features.h>
+
++#if POPPLER_CHECK_VERSION(24, 3, 0)
++#define _POPPLER_FUNCTION_TYPE_SAMPLED Function::Type::Sampled
++#define _POPPLER_FUNCTION_TYPE_EXPONENTIAL Function::Type::Exponential
++#define _POPPLER_FUNCTION_TYPE_STITCHING Function::Type::Stitching
++#else
++#define _POPPLER_FUNCTION_TYPE_SAMPLED 0
++#define _POPPLER_FUNCTION_TYPE_EXPONENTIAL 2
++#define _POPPLER_FUNCTION_TYPE_STITCHING 3
++#endif
++
+ #if POPPLER_CHECK_VERSION(22, 4, 0)
+ #define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr.get())
+ #else
+diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
+index 525fbfec0a8..f0a9c1ac696 100644
+--- a/src/extension/internal/pdfinput/svg-builder.cpp
++++ b/src/extension/internal/pdfinput/svg-builder.cpp
+@@ -1175,9 +1175,9 @@ static bool svgGetShadingColor(GfxShading *shading, double offset, GfxColor *res
+ #define INT_EPSILON 8
+ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
+ _POPPLER_CONST Function *func) {
+- int type = func->getType();
++ auto type = func->getType();
+ auto space = shading->getColorSpace();
+- if ( type == 0 || type == 2 ) { // Sampled or exponential function
++ if (type == _POPPLER_FUNCTION_TYPE_SAMPLED || type == _POPPLER_FUNCTION_TYPE_EXPONENTIAL) {
+ GfxColor stop1, stop2;
+ if (!svgGetShadingColor(shading, 0.0, &stop1) || !svgGetShadingColor(shading, 1.0, &stop2)) {
+ return false;
+@@ -1185,7 +1185,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh
+ _addStopToGradient(gradient, 0.0, &stop1, space, 1.0);
+ _addStopToGradient(gradient, 1.0, &stop2, space, 1.0);
+ }
+- } else if ( type == 3 ) { // Stitching
++ } else if (type == _POPPLER_FUNCTION_TYPE_STITCHING) {
+ auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func);
+ const double *bounds = stitchingFunc->getBounds();
+ const double *encode = stitchingFunc->getEncode();
+@@ -1200,7 +1200,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh
+ for ( int i = 0 ; i < num_funcs ; i++ ) {
+ svgGetShadingColor(shading, bounds[i + 1], &color);
+ // Add stops
+- if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn
++ if (stitchingFunc->getFunc(i)->getType() == _POPPLER_FUNCTION_TYPE_EXPONENTIAL) {
+ double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
+ if (expE > 1.0) {
+ expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1
+--
+GitLab
+
diff --git a/graphics/inkscape/patches/3_96ca7a6.patch b/graphics/inkscape/patches/3_96ca7a6.patch
new file mode 100644
index 0000000000..bb2764032c
--- /dev/null
+++ b/graphics/inkscape/patches/3_96ca7a6.patch
@@ -0,0 +1,64 @@
+From 96ca7a6c215aa14336b52753f56244dc8796ec43 Mon Sep 17 00:00:00 2001
+From: Heiko Becker <mail@heiko-becker.de>
+Date: Fri, 3 May 2024 14:52:00 +0200
+Subject: [PATCH] Fix build with poppler >= 24.05.0
+
+GooString::hasUnicodeMarkerLE and GooString::hasUnicodeMarker were
+rename and moved to UTF.h [1][2]
+
+[1] https://gitlab.freedesktop.org/poppler/poppler/-/commit/98fabb298b0e8eaef9193bbce68c99c85473a314
+[2] https://gitlab.freedesktop.org/poppler/poppler/-/commit/1f06dca08c32ed18c3030530d98a0e30d41dd7a2
+---
+ src/extension/internal/pdfinput/poppler-transition-api.h | 9 +++++++++
+ src/extension/internal/pdfinput/poppler-utils.cpp | 6 ++++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
+index 58aa1ec921d..481aefadf46 100644
+--- a/src/extension/internal/pdfinput/poppler-transition-api.h
++++ b/src/extension/internal/pdfinput/poppler-transition-api.h
+@@ -13,6 +13,15 @@
+ #define SEEN_POPPLER_TRANSITION_API_H
+
+ #include <glib/poppler-features.h>
++#include <poppler/UTF.h>
++
++#if POPPLER_CHECK_VERSION(24, 5, 0)
++#define _POPPLER_HAS_UNICODE_BOM(value) (hasUnicodeByteOrderMark(value->toStr()))
++#define _POPPLER_HAS_UNICODE_BOMLE(value) (hasUnicodeByteOrderMarkLE(value->toStr()))
++#else
++#define _POPPLER_HAS_UNICODE_BOM(value) (value->hasUnicodeMarker())
++#define _POPPLER_HAS_UNICODE_BOMLE(value) (value->hasUnicodeMarkerLE())
++#endif
+
+ #if POPPLER_CHECK_VERSION(24, 3, 0)
+ #define _POPPLER_FUNCTION_TYPE_SAMPLED Function::Type::Sampled
+diff --git a/src/extension/internal/pdfinput/poppler-utils.cpp b/src/extension/internal/pdfinput/poppler-utils.cpp
+index 78d90c66c9d..c02815f64b9 100644
+--- a/src/extension/internal/pdfinput/poppler-utils.cpp
++++ b/src/extension/internal/pdfinput/poppler-utils.cpp
+@@ -12,6 +12,8 @@
+
+ #include "poppler-utils.h"
+
++#include <poppler/UTF.h>
++
+ #include "2geom/affine.h"
+ #include "GfxFont.h"
+ #include "GfxState.h"
+@@ -563,10 +565,10 @@ std::string getDictString(Dict *dict, const char *key)
+ */
+ std::string getString(const GooString *value)
+ {
+- if (value->hasUnicodeMarker()) {
++ if (_POPPLER_HAS_UNICODE_BOM(value)) {
+ return g_convert(value->getCString () + 2, value->getLength () - 2,
+ "UTF-8", "UTF-16BE", NULL, NULL, NULL);
+- } else if (value->hasUnicodeMarkerLE()) {
++ } else if (_POPPLER_HAS_UNICODE_BOMLE(value)) {
+ return g_convert(value->getCString () + 2, value->getLength () - 2,
+ "UTF-8", "UTF-16LE", NULL, NULL, NULL);
+ }
+--
+GitLab
+
diff --git a/graphics/inkscape/patches/4_1798e9c.patch b/graphics/inkscape/patches/4_1798e9c.patch
new file mode 100644
index 0000000000..3c61b19192
--- /dev/null
+++ b/graphics/inkscape/patches/4_1798e9c.patch
@@ -0,0 +1,91 @@
+From 1798e9c13b786f3d077ba0132592c4d5c1d1fb9b Mon Sep 17 00:00:00 2001
+From: Tavmjong Bah <tavmjong@free.fr>
+Date: Tue, 26 Sep 2023 19:23:27 +0000
+Subject: [PATCH] Up C++ version to C++20.
+
+---
+ CMakeLists.txt | 4 ++--
+ _clang-format | 2 +-
+ src/ui/knot/knot-holder-entity.cpp | 2 +-
+ src/ui/tools/pencil-tool.cpp | 9 ++++++---
+ 4 files changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index fe6b10cda24..de2680bd651 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,9 +18,9 @@ message("Binary Dir: ${CMAKE_CURRENT_BINARY_DIR}")
+ # -----------------------------------------------------------------------------
+ # CMake Configuration
+ # -----------------------------------------------------------------------------
+-set(CMAKE_CXX_STANDARD 17)
++set(CMAKE_CXX_STANDARD 20)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+-# set(CMAKE_CXX_EXTENSIONS OFF) # enforces -std=c++17 instead of -std=gnu++17
++# set(CMAKE_CXX_EXTENSIONS OFF) # enforces -std=c++20 instead of -std=gnu++20
+ # TODO: build currently fails with it as we actually depend on GNU compiler extensions...
+ # mostly use of the non-Standard M_PI et al. TODO: C++20: Use the <numbers> header.
+
+diff --git a/_clang-format b/_clang-format
+index 39396fad65a..48de4d2bd88 100644
+--- a/_clang-format
++++ b/_clang-format
+@@ -103,7 +103,7 @@ SpacesInContainerLiterals: false
+ SpacesInCStyleCastParentheses: false
+ SpacesInParentheses: false
+ SpacesInSquareBrackets: false
+-Standard: c++17
++Standard: c++20
+ StatementMacros: []
+ TypenameMacros: []
+ TabWidth: 4
+diff --git a/src/ui/knot/knot-holder-entity.cpp b/src/ui/knot/knot-holder-entity.cpp
+index 8703f5975f7..add66d2fa29 100644
+--- a/src/ui/knot/knot-holder-entity.cpp
++++ b/src/ui/knot/knot-holder-entity.cpp
+@@ -315,7 +315,7 @@ void PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point co
+ double scale_x = std::clamp(new_extent[X] / _cached_diagonal[X], _cached_min_scale, 1e9);
+ double scale_y = std::clamp(new_extent[Y] / _cached_diagonal[Y], _cached_min_scale, 1e9);
+
+- Affine new_transform = (state & GDK_CONTROL_MASK) ? Scale(lerp(0.5, scale_x, scale_y))
++ Affine new_transform = (state & GDK_CONTROL_MASK) ? Scale((scale_x + scale_y) * 0.5)
+ : Scale(scale_x, scale_y);
+
+ // 2. Calculate offset to keep pattern origin aligned
+diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
+index fd2d08cad0c..7324f7c8515 100644
+--- a/src/ui/tools/pencil-tool.cpp
++++ b/src/ui/tools/pencil-tool.cpp
+@@ -17,7 +17,11 @@
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+-#include <numeric> // For std::accumulate
++#include "pencil-tool.h"
++
++#include <cmath> // std::lerp
++#include <numeric> // std::accumulate
++
+ #include <gdk/gdkkeysyms.h>
+ #include <glibmm/i18n.h>
+
+@@ -26,7 +30,6 @@
+ #include <2geom/sbasis-to-bezier.h>
+ #include <2geom/svg-path-parser.h>
+
+-#include "pencil-tool.h"
+
+ #include "context-fns.h"
+ #include "desktop.h"
+@@ -806,7 +809,7 @@ void PencilTool::_addFreehandPoint(Geom::Point const &p, guint /*state*/, bool l
+ min = max;
+ }
+ double dezoomify_factor = 0.05 * 1000 / _desktop->current_zoom();
+- double const pressure_shrunk = pressure * (max - min) + min; // C++20 -> use std::lerp()
++ double const pressure_shrunk = std::lerp(min, max, pressure);
+ double pressure_computed = std::abs(pressure_shrunk * dezoomify_factor);
+ double pressure_computed_scaled = std::abs(pressure_computed * _desktop->getDocument()->getDocumentScale().inverse()[Geom::X]);
+ if (p != p_array[_npoints - 1]) {
+--
+GitLab
+