Added inkscape and dependancies

This commit is contained in:
dslm4515
2022-05-14 21:19:35 -05:00
parent af16c76bb6
commit fe09ae44a8
10 changed files with 451 additions and 19 deletions

View File

@ -0,0 +1,40 @@
#! /bin/bash
# double-conversion
# Source: https://github.com/google/double-conversion/archive/v3.1.5.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: NONE
# Optional: NONE
cmake -B OUT -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib -DBUILD_SHARED_LIBS=ON \
read -p "Compile?" && make -j2 -C OUT &&
sudo -S make DESTDIR=$BUILD -C OUT install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
double-conversion: double-conversion
double-conversion:
double-conversion: Binary-decimal and decimal-binary routines for IEEE doubles
double-conversion:
double-conversion: https://github.com/google/double-conversion
double-conversion:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/double-conversion-3.1.5-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*

44
build-scripts/gc.build Normal file
View File

@ -0,0 +1,44 @@
#! /bin/bash
# gc
# Source: https://github.com/ivmai/bdwgc/releases/download/v8.2.0/gc-8.2.0.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: NONE
# Optional: NONE
cp -vf ../files/config.sub-musl config.sub && \
cp -vf ../files/config.guess-musl config.guess && \
export CFLAGS="$CFLAGS -D_GNU_SOURCE -DNO_GETCONTEXT -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR" && \
./configure --prefix=/usr --datadir=/usr/share/doc/gc --enable-static --enable-cplusplus $BT
read -p "Compile?" && make -j2 &&
unset CFLAGS
sudo -S make DESTDIR=$BUILD install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
gc: gc
gc:
gc: garbage collector for C and C++
gc:
gc: https://hboehm.info/gc/
gc:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/gc-8.2.0-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*

View File

@ -0,0 +1,49 @@
#! /bin/bash
# inkscape
# Source: https://media.inkscape.org/dl/resources/file/inkscape-1.1.2.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: harfbuzz pango cairo fontconfig gsl libsoup2 gc lcms2
# Required: double-conversion libjpeg-turbo libpng potrace gtkmm3
# Required: poppler
# Recommended: boost dbus
# Optional: libwpg librevenge libvisio libcdr
patch -Np1 -i ../patches/inkscape-alpine/fix-Werror.patch && \
patch -Np1 -i ../patches/inkscape-alpine/poppler-22.03.patch && \
# Disable support for poppler, breaks build.
export CXXFLAGS="$CXXFLAGS -std=c++11" && \
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True -DBUILD_TESTING=OFF \
-DDENABLE_POPPLER=OFF -DENABLE_POPPLER_CAIRO=OFF && \
read -p "Compile?" && ninja -j2 -C build &&
sudo -S DESTDIR=$BUILD ninja -C build install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
inkscape: inkscape
inkscape:
inkscape: A vector-based drawing program - svg compliant.
inkscape:
inkscape: https://inkscape.org
inkscape:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/inkscape-1.1.2-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*

View File

@ -1,19 +0,0 @@
#! /bin/bash
# Poppler 0.79.0
# source: https://poppler.freedesktop.org/poppler-0.79.0.tar.xz
# source: https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz
mkdir build &&
cd build &&
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
-DENABLE_CPP=ON \
-DENABLE_GLIB=ON \
-DENABLE_GOBJECT_INTROSPECTION=ON \
-DENABLE_QT5=ON -DENABLE_UTILS=ON \
..
read -p "Compile? " && make -j2 &&
read -p "Install? " && sudo -S porg -lp poppler-0.79.0 "make install"

View File

@ -0,0 +1,45 @@
#! /bin/bash
# poppler
# Source: https://poppler.freedesktop.org/poppler-22.05.0.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: cmake fontconfig gobject-introspection lcms
# Required: libjpeg-turbo libpng libxml libtiff
# Recommended: NONE
# Optional: openjpeg Qt5 boost
patch -Np1 -i ../patches/poppler-alpine/dont-enforce-build-type.patch && \
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON -DBUILD_QT5_TESTS=OFF \
-DENABLE_QT5=OFF -DENABLE_BOOST=OFF
read -p "Compile?" && ninja -j2 -C build &&
sudo -S DESTDIR=$BUILD ninja -C build install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
poppler: Poppler
poppler:
poppler: PDF rendering library based on xpdf 3.0
poppler:
poppler: https://poppler.freedesktop.org
poppler:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/poppler-22.05.0-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*

View File

@ -0,0 +1,39 @@
#! /bin/bash
# potrace
# Source: http://potrace.sourceforge.net/download/1.16/potrace-1.16.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: NONE
# Optional: NONE
./configure --prefix=/usr --mandir=/usr/share/man --with-libpotrace $BT && \
read -p "Compile?" && make -j2 &&
sudo -S make DESTDIR=$BUILD install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
potrace: potrace
potrace:
potrace: Utility for tracing a bitmaps
potrace:
potrace: http://potrace.sourceforge.net/
potrace:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/potrace-1.16-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*

View File

@ -0,0 +1,13 @@
Fix -Werror flags, build fails with them
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -32,8 +32,6 @@
# Errors for common mistakes
list(APPEND INKSCAPE_CXX_FLAGS "-fstack-protector-strong")
-list(APPEND INKSCAPE_CXX_FLAGS "-Werror=format") # e.g.: printf("%s", std::string("foo"))
-list(APPEND INKSCAPE_CXX_FLAGS "-Werror=format-security") # e.g.: printf(variable);
list(APPEND INKSCAPE_CXX_FLAGS "-Wno-switch") # See !849 for discussion
list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-Og") # -Og for _FORTIFY_SOURCE. One could add -Weffc++ here to see approx. 6000 warnings
list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-Wcomment")

View File

@ -0,0 +1,51 @@
Patch-Source: https://gitlab.com/inkscape/inkscape/-/commit/a18c57ffff313fd08bc8a44f6b6bf0b01d7e9b75
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,144 @@
Patch-Source: https://gitlab.com/inkscape/inkscape/-/commit/d989cdf1059c78bc3bb6414330242073768d640b
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,26 @@
diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index 2aed028..fdbe318 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -75,21 +75,6 @@ if(WIN32)
"${CMAKE_INSTALL_PREFIX}/bin" )
endif(WIN32)
-if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
- set(CMAKE_BUILD_TYPE RelWithDebInfo)
-endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-
-string(TOUPPER "${CMAKE_BUILD_TYPE}" _CMAKE_BUILD_TYPE_UPPER)
-set(_known_build_types RELWITHDEBINFO;RELEASE;DEBUG;DEBUGFULL;PROFILE)
-# We override CMAKE_CXX_FLAGS_${_CMAKE_BUILD_TYPE_UPPER} below. If the user
-# selects a CMAKE_BUILD_TYPE that is not handled by the logic below, we will
-# end up dropping the previous flags (e.g. those set in a cross-compilation
-# CMake toolchain file). To avoid surprising compilation errors, we emit an
-# error in that case, so that the user can handle the passed CMAKE_BUILD_TYPE
-# in the compiler flags logic below.
-if (NOT "${_CMAKE_BUILD_TYPE_UPPER}" IN_LIST _known_build_types)
- message(FATAL_ERROR "Unsupported CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
-endif()
set(_save_cflags "${CMAKE_C_FLAGS}")
set(_save_cxxflags "${CMAKE_CXX_FLAGS}")