aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArTourter <artourter@gmail.com>2024-10-18 23:16:17 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-10-20 07:39:56 +0700
commitd84e8063af05e44b83d194a98a6a44ed572fd8cc (patch)
tree20fc9ab00563c5366d71ea3580c43bd6e513373d
parent42d67aabbf32205f02141613c08f6306e84acc3a (diff)
office/pdfpc: Patch to allow compilation with discount3 for -current
Signed-off-by: ArTourter <artourter@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--office/pdfpc/08e66b9d432e9598c1ee9a78b2355728036ae1a1.patch99
-rw-r--r--office/pdfpc/18beaecbbcc066e0d4c889b3aa3ecaa7351f7768.patch33
-rw-r--r--office/pdfpc/pdfpc.SlackBuild14
3 files changed, 140 insertions, 6 deletions
diff --git a/office/pdfpc/08e66b9d432e9598c1ee9a78b2355728036ae1a1.patch b/office/pdfpc/08e66b9d432e9598c1ee9a78b2355728036ae1a1.patch
new file mode 100644
index 000000000000..4522c796b548
--- /dev/null
+++ b/office/pdfpc/08e66b9d432e9598c1ee9a78b2355728036ae1a1.patch
@@ -0,0 +1,99 @@
+From 08e66b9d432e9598c1ee9a78b2355728036ae1a1 Mon Sep 17 00:00:00 2001
+From: Michal Sojka <michal.sojka@cvut.cz>
+Date: Wed, 17 Apr 2024 20:42:20 +0200
+Subject: [PATCH] Allow compiling with markdown3
+
+Currently compilation fails with:
+
+ /build/src/classes/renderer/markdown.c:191:20: error: variable or field 'flags' declared void
+
+According to comment [1], markdown3 introduces backward
+incompatibility with respect to document flags.
+
+This commit adds conditionally compiled code that allows building
+pdfpc with both markdown versions 2 and 3.
+
+The used cmake operator VERSION_GREATER_EQUAL requires cmake 3.7 so we
+bump minimal cmake version requirement.
+
+Fixes #682
+
+[1]: https://github.com/pdfpc/pdfpc/issues/682#issuecomment-1931300154
+---
+ CMakeLists.txt | 2 +-
+ src/CMakeLists.txt | 4 ++++
+ src/classes/renderer/markdown.vala | 5 +++++
+ src/libmarkdown.vapi | 14 ++++++++++++++
+ 4 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 605128ab..01062146 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ project("pdfpc" C)
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.7)
+
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index c2b15491..43f1b1eb 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -32,6 +32,10 @@ if (MDVIEW OR REST)
+ pkg_check_modules(MARKDOWN REQUIRED libmarkdown)
+ endif ()
+
++if ("${MARKDOWN_VERSION}" VERSION_GREATER_EQUAL 3)
++ set(EXTRA_VALA_OPTIONS ${EXTRA_VALA_OPTIONS} -D MARKDOWN3)
++endif ()
++
+ if (MDVIEW)
+ pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
+ set(MDVIEW_PACKAGES webkit2gtk-4.0)
+diff --git a/src/classes/renderer/markdown.vala b/src/classes/renderer/markdown.vala
+index 3964af82..ac1e3eea 100644
+--- a/src/classes/renderer/markdown.vala
++++ b/src/classes/renderer/markdown.vala
+@@ -23,7 +23,12 @@
+ namespace pdfpc.Renderer {
+ public class MD {
+ public static string render(string? text = "", bool plain_text = false) {
++#if MARKDOWN3
++ var flags = new Markdown.DocumentFlags();
++ flags.set(Markdown.DocumentFlag.NO_EXT);
++#else
+ Markdown.DocumentFlags flags = Markdown.DocumentFlags.NO_EXT;
++#endif
+
+ string html;
+ if (text != "" && plain_text) {
+diff --git a/src/libmarkdown.vapi b/src/libmarkdown.vapi
+index f762f173..e90c8660 100644
+--- a/src/libmarkdown.vapi
++++ b/src/libmarkdown.vapi
+@@ -95,9 +95,23 @@ namespace Markdown
+ public void ref_prefix (string prefix);
+ }
+
++#if MARKDOWN3
++ [Compact]
++ [CCode (cname = "mkd_flag_t", free_function = "mkd_free_flags")]
++ public class DocumentFlags {
++ [CCode (cname = "mkd_flags")]
++ public DocumentFlags();
++ [CCode (cname = "mkd_set_flag_num")]
++ public void set (DocumentFlag flag);
++ }
++
++ [CCode (cprefix = "MKD_")]
++ public enum DocumentFlag
++#else
+ [Flags]
+ [CCode (cname = "mkd_flag_t", cprefix = "MKD_")]
+ public enum DocumentFlags
++#endif
+ {
+ NOLINKS,
+ NOIMAGE,
diff --git a/office/pdfpc/18beaecbbcc066e0d4c889b3aa3ecaa7351f7768.patch b/office/pdfpc/18beaecbbcc066e0d4c889b3aa3ecaa7351f7768.patch
new file mode 100644
index 000000000000..62fe29de5d61
--- /dev/null
+++ b/office/pdfpc/18beaecbbcc066e0d4c889b3aa3ecaa7351f7768.patch
@@ -0,0 +1,33 @@
+From 18beaecbbcc066e0d4c889b3aa3ecaa7351f7768 Mon Sep 17 00:00:00 2001
+From: Evgeny Stambulchik <fnevgeny@gmail.com>
+Date: Tue, 25 Apr 2023 16:11:25 +0300
+Subject: [PATCH] Create Lists of nullable types
+
+---
+ src/classes/drawings/drawing_commands.vala | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/classes/drawings/drawing_commands.vala b/src/classes/drawings/drawing_commands.vala
+index 77e56e6d..c305a8c5 100644
+--- a/src/classes/drawings/drawing_commands.vala
++++ b/src/classes/drawings/drawing_commands.vala
+@@ -54,8 +54,8 @@ namespace pdfpc {
+ }
+
+ public void clear() {
+- this.drawing_commands = new List<DrawingCommand>();
+- this.redo_commands = new List<DrawingCommand>();
++ this.drawing_commands = new List<DrawingCommand?>();
++ this.redo_commands = new List<DrawingCommand?>();
+ }
+
+ public void add_line(bool is_eraser,
+@@ -70,7 +70,7 @@ namespace pdfpc {
+
+ // After adding a new line you can no longer redo the old
+ // path.
+- this.redo_commands = new List<DrawingCommand>(); // clear
++ this.redo_commands = new List<DrawingCommand?>(); // clear
+
+ bool new_path = true;
+ double epsilon = 1e-4; // Less than 0.1 pixel for a 1000x1000 img
diff --git a/office/pdfpc/pdfpc.SlackBuild b/office/pdfpc/pdfpc.SlackBuild
index 22b539837256..29134fc3683a 100644
--- a/office/pdfpc/pdfpc.SlackBuild
+++ b/office/pdfpc/pdfpc.SlackBuild
@@ -2,7 +2,7 @@
# Slackware build script for pdfpc
-# Copyright 2018-2021 Gregory J. L. Tourte <artourter@gmail.com>
+# Copyright 2018-2024 Gregory J. L. Tourte <artourter@gmail.com>
# Copyright 2013 Markus Hutmacher <email removed>
#
# Redistribution and use of this script, with or without modification, is
@@ -27,7 +27,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=pdfpc
VERSION=${VERSION:-4.6.0}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -76,10 +76,11 @@ cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
- -o -perm 511 \) -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
- -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+ -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
+
+patch -p 1 < $CWD/08e66b9d432e9598c1ee9a78b2355728036ae1a1.patch
+patch -p 1 < $CWD/18beaecbbcc066e0d4c889b3aa3ecaa7351f7768.patch
mkdir -p build
cd build
@@ -89,6 +90,7 @@ cd build
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_MANDIR=/usr/man \
-DCMAKE_BUILD_TYPE=Release \
+ -Wno-dev \
..
make
make install DESTDIR=$PKG