aboutsummaryrefslogtreecommitdiff
path: root/office/sioyek
diff options
context:
space:
mode:
authorAlexander Verbovetsky <alik@ejik.org>2024-09-14 09:02:40 +0900
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-09-14 23:36:46 +0700
commiteffb74c728e24b8725a3aaac9e4fccc285a35306 (patch)
treed783f9dc38c097f6a1935c1951d80034f767b448 /office/sioyek
parent7a79e40d8af50f1c2e16c9838885459411b75d85 (diff)
office/sioyek: Added (pdf viewer).
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'office/sioyek')
-rw-r--r--office/sioyek/README53
-rw-r--r--office/sioyek/doinst.sh3
-rw-r--r--office/sioyek/mupdf-0.23.0.patch77
-rw-r--r--office/sioyek/sioyek.SlackBuild104
-rw-r--r--office/sioyek/sioyek.info10
-rw-r--r--office/sioyek/slack-desc19
6 files changed, 266 insertions, 0 deletions
diff --git a/office/sioyek/README b/office/sioyek/README
new file mode 100644
index 0000000000000..9edca23e406b8
--- /dev/null
+++ b/office/sioyek/README
@@ -0,0 +1,53 @@
+Sioyek is a PDF viewer with a focus on technical books and research
+papers. It uses the mupdf rendering library.
+
+Searchable
+ Quickly search your previously opened documents, table of contents,
+ bookmarks, and highlights. Sioyek can even generate the table of
+ contents if the document doesn't have one!
+
+Smart Jump
+ You can preview or jump to references (e.g. bibliography, figures,
+ equations, etc.) even when the document doesn't have links. You can
+ also search references in google scholar with one click!
+
+Portals
+ You can create portals from parts of documents to other parts which
+ are displayed in a second window. So when you are reading a paragraph
+ that is talking about a figure, table, algorithm, theorem, etc. you
+ don't have to keep jumping between the two locations.
+
+Marks and Bookmarks
+ Mark locations with one-character symbols and then quickly jump back
+ to them. You can also create bookmarks which are like marks, but use a
+ descriptive text instead of a symbol and can be searched.
+
+Highlights
+ Sioyek can highlight text with different colors. They are searchable!
+
+Command Palette
+ Discover sioyek commands and shortcuts using the searchable command
+ palette.
+
+Keyboard Focused
+ While sioyek fully supports many mouse actions, it is still possible
+ to use sioyek only using a keyboard. This includes functionality such
+ as text selection too!
+
+Synctex
+ Sioyek autoreloads the document so you can preview the changes as you
+ edit the latex file. You can also jump between the corresponding
+ locations in PDF and latex files with one click.
+
+Ruler
+ Use a visual ruler to highlight the line currently being read. It
+ reduces eye strain and combined with smart jump feature can create
+ previews and portals without needing to click on the reference!
+
+Configurable
+ Sioyek is highly configurable. You can change all the keybinds and
+ adjust the behavior of the application.
+
+Extensible
+ You can extend sioyek using external commands and scripts. For example
+ you can add OCR, translation, and text to speech to sioyek.
diff --git a/office/sioyek/doinst.sh b/office/sioyek/doinst.sh
new file mode 100644
index 0000000000000..5fb28930db0b9
--- /dev/null
+++ b/office/sioyek/doinst.sh
@@ -0,0 +1,3 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
diff --git a/office/sioyek/mupdf-0.23.0.patch b/office/sioyek/mupdf-0.23.0.patch
new file mode 100644
index 0000000000000..4fdabaa454617
--- /dev/null
+++ b/office/sioyek/mupdf-0.23.0.patch
@@ -0,0 +1,77 @@
+Bug: https://github.com/ahrm/sioyek/issues/804
+Patch taken from Alpine:
+https://git.alpinelinux.org/aports/tree/community/sioyek/mupdf-0.23.0.patch
+
+diff --git a/pdf_viewer/document_view.cpp b/pdf_viewer/document_view.cpp
+index f48d05e..0bc3855 100644
+--- a/pdf_viewer/document_view.cpp
++++ b/pdf_viewer/document_view.cpp
+@@ -1121,7 +1121,7 @@ std::vector<DocumentPos> DocumentView::find_line_definitions() {
+
+ std::optional<PdfLink> pdf_link = current_document->get_link_in_page_rect(get_center_page_number(), line_rects[line_index]);
+ if (pdf_link.has_value()) {
+- auto parsed_uri = parse_uri(mupdf_context, pdf_link.value().uri);
++ auto parsed_uri = parse_uri(mupdf_context, current_document->doc, pdf_link.value().uri);
+ result.push_back({ parsed_uri.page - 1, parsed_uri.x, parsed_uri.y });
+ return result;
+ }
+diff --git a/pdf_viewer/main_widget.cpp b/pdf_viewer/main_widget.cpp
+index 19b568b..335a93f 100644
+--- a/pdf_viewer/main_widget.cpp
++++ b/pdf_viewer/main_widget.cpp
+@@ -170,7 +170,7 @@ void MainWidget::set_overview_position(int page, float offset) {
+
+ void MainWidget::set_overview_link(PdfLink link) {
+
+- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri);
++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri);
+ if (page >= 1) {
+ set_overview_position(page - 1, offset_y);
+ }
+@@ -3178,7 +3178,7 @@ void MainWidget::handle_pending_text_command(std::wstring text) {
+ open_web_url(utf8_decode(selected_link->uri));
+ }
+ else{
+- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri);
++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, selected_link->uri);
+ long_jump_to_destination(page-1, offset_y);
+ }
+ }
+@@ -3863,7 +3863,7 @@ void MainWidget::handle_link_click(const PdfLink& link) {
+ return;
+ }
+
+- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri);
++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri);
+
+ // convert one indexed page to zero indexed page
+ page--;
+diff --git a/pdf_viewer/utils.cpp b/pdf_viewer/utils.cpp
+index 22d4265..3150e66 100644
+--- a/pdf_viewer/utils.cpp
++++ b/pdf_viewer/utils.cpp
+@@ -116,8 +116,9 @@ bool rects_intersect(fz_rect rect1, fz_rect rect2) {
+ return range_intersects(rect1.x0, rect1.x1, rect2.x0, rect2.x1) && range_intersects(rect1.y0, rect1.y1, rect2.y0, rect2.y1);
+ }
+
+-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri) {
+- fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str());
++ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri) {
++ pdf_document* doc = pdf_document_from_fz_document(mupdf_context, fz_doc);
++ fz_link_dest dest = pdf_resolve_link_dest(mupdf_context, doc, uri.c_str());
+ return { dest.loc.page + 1, dest.x, dest.y };
+ }
+
+diff --git a/pdf_viewer/utils.h b/pdf_viewer/utils.h
+index 2a12211..643b030 100644
+--- a/pdf_viewer/utils.h
++++ b/pdf_viewer/utils.h
+@@ -55,7 +55,7 @@ void get_flat_toc(const std::vector<TocNode*>& roots, std::vector<std::wstring>&
+ int mod(int a, int b);
+ bool range_intersects(float range1_start, float range1_end, float range2_start, float range2_end);
+ bool rects_intersect(fz_rect rect1, fz_rect rect2);
+-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri);
++ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri);
+ char get_symbol(int key, bool is_shift_pressed, const std::vector<char>&special_symbols);
+
+ template<typename T>
diff --git a/office/sioyek/sioyek.SlackBuild b/office/sioyek/sioyek.SlackBuild
new file mode 100644
index 0000000000000..5ffb8fb49096d
--- /dev/null
+++ b/office/sioyek/sioyek.SlackBuild
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# Slackware build script for sioyek
+
+# Copyright 2024, Alexander Verbovetsky, Moscow, Russia
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=sioyek
+VERSION=${VERSION:-2.0.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+elif [ "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+
+patch -p1 < $CWD/mupdf-0.23.0.patch
+sed -i 's/-lmupdf-threads//' pdf_viewer_build_config.pro
+sed -i 's|//\(#define LINUX_STANDARD_PATHS\)|\1|' pdf_viewer/main.cpp
+
+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 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./build_linux.sh
+
+install -Dsm755 build/sioyek -t $PKG/usr/bin
+install -Dm644 resources/sioyek-icon-linux.png -t $PKG/usr/share/pixmaps
+install -Dm644 resources/$PRGNAM.desktop -t $PKG/usr/share/applications
+install -Dm644 build/shaders/* -t $PKG/usr/share/$PRGNAM/shaders
+install -Dm644 build/keys.config build/prefs.config -t $PKG/etc/$PRGNAM
+install -Dm644 build/tutorial.pdf -t $PKG/usr/share/$PRGNAM
+mkdir -p $PKG/usr/man/man1
+gzip -9 -c resources/sioyek.1 > $PKG/usr/man/man1/sioyek.1.gz
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+ln -s /usr/share/sioyek/tutorial.pdf $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/office/sioyek/sioyek.info b/office/sioyek/sioyek.info
new file mode 100644
index 0000000000000..455fe05816944
--- /dev/null
+++ b/office/sioyek/sioyek.info
@@ -0,0 +1,10 @@
+PRGNAM="sioyek"
+VERSION="2.0.0"
+HOMEPAGE="https://sioyek.info"
+DOWNLOAD="https://github.com/ahrm/sioyek/archive/v2.0.0/sioyek-2.0.0.tar.gz"
+MD5SUM="f57b4056c03422f01b98a88fa1b13671"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="mupdf"
+MAINTAINER="Alexander Verbovetsky"
+EMAIL="alik@ejik.org"
diff --git a/office/sioyek/slack-desc b/office/sioyek/slack-desc
new file mode 100644
index 0000000000000..4cfa728583655
--- /dev/null
+++ b/office/sioyek/slack-desc
@@ -0,0 +1,19 @@
+# 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------------------------------------------------------|
+sioyek: sioyek (PDF viewer)
+sioyek:
+sioyek: Sioyek is a PDF viewer with a focus on technical books and research
+sioyek: papers. It uses the mupdf rendering library.
+sioyek:
+sioyek: Sioyek features include searchablity, smart jumping, portals, marks
+sioyek: and bookmarks, text highlighting, a discoverable command palette,
+sioyek: keyboard focusing, synctex, ruler, configurability, extensibility.
+sioyek:
+sioyek: Homepage: https://sioyek.info
+sioyek: