new package: inkscape

This commit is contained in:
Tee KOBAYASHI 2022-04-28 12:33:48 +09:00 committed by xtkoba
parent e2caa73c20
commit 6ad472df49
6 changed files with 260 additions and 0 deletions

View File

@ -0,0 +1,33 @@
TERMUX_PKG_HOMEPAGE=https://inkscape.org/
TERMUX_PKG_DESCRIPTION="Free and open source vector graphics editor"
TERMUX_PKG_LICENSE="GPL-3.0-or-later"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.1.2
TERMUX_PKG_SRCURL=https://media.inkscape.org/dl/resources/file/inkscape-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=3ffe54a06d0b25a4cd8b6eb424536ef1ed205be13443a39cd437c8c7b89b96d1
TERMUX_PKG_DEPENDS="atk, boost, double-conversion, fontconfig, freetype, gdk-pixbuf, glib, gsl, gtk3, gtkmm3, harfbuzz, libc++, libcairo, libgc, libice, libiconv, libjpeg-turbo, libpng, libpopt, libsm, libsoup, libx11, libxext, libxml2, libxslt, littlecms, pango, poppler, potrace, readline, zlib"
TERMUX_PKG_BUILD_DEPENDS="boost-headers"
TERMUX_PKG_RECOMMENDS="inkscape-extensions, inkscape-tutorials"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DWITH_GRAPHICS_MAGICK=OFF
-DWITH_GSPELL=OFF
-DWITH_IMAGE_MAGICK=OFF
-DWITH_LIBCDR=OFF
-DWITH_LIBVISIO=OFF
-DWITH_LIBWPG=OFF
"
termux_step_pre_configure() {
CPPFLAGS+=" -DCMS_NO_REGISTER_KEYWORD"
LDFLAGS+=" -Wl,-rpath=$TERMUX_PREFIX/lib/inkscape"
}
termux_step_install_license() {
local license_file="$TERMUX_PREFIX/share/inkscape/doc/COPYING"
if [ ! -e "$license_file" ]; then
termux_error_exit "License file $license_file not found."
fi
local doc_dir="$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME"
mkdir -p "$doc_dir"
ln -sf "$license_file" "$doc_dir"/
}

View File

@ -0,0 +1,50 @@
From a18c57ffff313fd08bc8a44f6b6bf0b01d7e9b75 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>
---
src/extension/internal/pdfinput/pdf-input.cpp | 3 +--
src/extension/internal/pdfinput/poppler-transition-api.h | 6 ++++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 3dabc94ba2..079b0dc713 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -688,8 +688,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();
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 87a19d4c42..50b617c25c 100644
--- 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

View File

@ -0,0 +1,143 @@
From d989cdf1059c78bc3bb6414330242073768d640b 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.
Fixes https://gitlab.com/inkscape/inkscape/-/issues/3387
---
src/extension/internal/pdfinput/pdf-parser.cpp | 14 ++++++++------
.../internal/pdfinput/poppler-transition-api.h | 6 ++++++
src/extension/internal/pdfinput/svg-builder.cpp | 7 +------
src/extension/internal/pdfinput/svg-builder.h | 1 -
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index feecefa043..d6e2ede4f3 100644
--- 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 {
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 50b617c25c..dc9e47e45b 100644
--- 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
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index eede668893..901cc8cddb 100644
--- 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;
@@ -1064,11 +1063,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();
@@ -1213,7 +1209,6 @@ void SvgBuilder::updateFont(GfxState *state) {
sp_repr_css_set_property(_font_style, "writing-mode", "tb");
}
- _current_font = font;
_invalidated_style = true;
}
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h
index fb4e64fa19..e91febd717 100644
--- a/src/extension/internal/pdfinput/svg-builder.h
+++ b/src/extension/internal/pdfinput/svg-builder.h
@@ -204,7 +204,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

View File

@ -0,0 +1,12 @@
TERMUX_SUBPKG_INCLUDE="share/inkscape/extensions"
TERMUX_SUBPKG_DESCRIPTION="Inkscape extensions"
TERMUX_SUBPKG_DEPENDS="python"
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
termux_step_create_subpkg_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "Installing dependencies through pip..."
pip3 install lxml numpy scour
EOF
}

View File

@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="share/inkscape/tutorials"
TERMUX_SUBPKG_DESCRIPTION="Inkscape tutorials"
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true

View File

@ -0,0 +1,19 @@
--- a/src/object/object-set.cpp
+++ b/src/object/object-set.cpp
@@ -16,6 +16,7 @@
#include "box3d.h"
#include "persp3d.h"
#include "preferences.h"
+#include <boost/algorithm/minmax_element.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/range/adaptor/transformed.hpp>
@@ -263,7 +264,7 @@
auto const& n = nodes;
#endif
- return *std::max_element(n.begin(), n.end(), sp_repr_compare_position_bool);
+ return *boost::first_max_element(n.begin(), n.end(), sp_repr_compare_position_bool);
}
void ObjectSet::set(SPObject *object, bool persist_selection_context) {