Skip to content

Commit

Permalink
contrib/inkscape: rebuild against poppler 24.05
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopsykose committed May 10, 2024
1 parent f0a955a commit 7291616
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 17 deletions.
13 changes: 13 additions & 0 deletions contrib/inkscape/patches/cpp20.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
needed for string starts_with in poppler
--
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@
# -----------------------------------------------------------------------------
# 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
# TODO: build currently fails with it as we actually depend on GNU compiler extensions...
14 changes: 0 additions & 14 deletions contrib/inkscape/patches/nodist-2geom.patch

This file was deleted.

66 changes: 66 additions & 0 deletions contrib/inkscape/patches/poppler-24.05.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Patch-Source: https://gitlab.com/inkscape/inkscape/-/merge_requests/6403
--
From 96ca7a6c215aa14336b52753f56244dc8796ec43 Mon Sep 17 00:00:00 2001
From: Heiko Becker <[email protected]>
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

7 changes: 4 additions & 3 deletions contrib/inkscape/template.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
pkgname = "inkscape"
pkgver = "1.3.2"
pkgrel = 5
pkgrel = 6
build_style = "cmake"
configure_args = [
"-D2GEOM_BUILD_SHARED=OFF",
"-DBUILD_SHARED_LIBS=ON",
"-DBUILD_TESTING=OFF",
"-DWITH_INTERNAL_2GEOM=OFF",
"-DWITH_INTERNAL_CAIRO=OFF",
]
hostmakedepends = [
"cmake",
Expand All @@ -15,7 +16,6 @@
"perl",
"pkgconf",
]
# TODO: package lib2geom separately
makedepends = [
"boost-devel",
"double-conversion-devel",
Expand All @@ -26,6 +26,7 @@
"gtk+3-devel",
"gtkmm3.0-devel",
"lcms2-devel",
"lib2geom-devel",
"libcdr-devel",
"libedit-readline-devel",
"libjpeg-turbo-devel",
Expand Down

0 comments on commit 7291616

Please sign in to comment.