mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-11-09 04:41:36 +01:00
testing/sioyek: new aport
This commit is contained in:
parent
9bff65bca9
commit
c20336bb82
45
testing/sioyek/APKBUILD
Normal file
45
testing/sioyek/APKBUILD
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
|
||||||
|
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
|
||||||
|
pkgname=sioyek
|
||||||
|
pkgver=1.4.0
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="PDF viewer designed for reading research papers and technical books"
|
||||||
|
url="https://sioyek.info"
|
||||||
|
arch="all !aarch64 !armhf !armv7" # fails to build
|
||||||
|
license="GPL-3.0-only"
|
||||||
|
makedepends="
|
||||||
|
cmd:desktop-file-install
|
||||||
|
mupdf-dev
|
||||||
|
qt5-qt3d-dev
|
||||||
|
qt5-qtbase-dev
|
||||||
|
"
|
||||||
|
subpackages="$pkgname-doc"
|
||||||
|
source="https://github.com/ahrm/sioyek/archive/v$pkgver/sioyek-$pkgver.tar.gz
|
||||||
|
mupdf-1.20.patch
|
||||||
|
fix-mupdf-libs.patch
|
||||||
|
$pkgname.desktop
|
||||||
|
"
|
||||||
|
options="!check" # no tests provided
|
||||||
|
|
||||||
|
build() {
|
||||||
|
qmake-qt5 pdf_viewer_build_config.pro DEFINES+="LINUX_STANDARD_PATHS"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -D -m755 sioyek -t "$pkgdir"/usr/bin/
|
||||||
|
install -D -m644 pdf_viewer/shaders/* -t "$pkgdir"/usr/share/$pkgname/shaders/
|
||||||
|
install -D -m644 pdf_viewer/keys.config pdf_viewer/prefs.config -t "$pkgdir"/etc/$pkgname/
|
||||||
|
install -D -m644 resources/sioyek.1 -t "$pkgdir"/usr/share/man/man1/
|
||||||
|
|
||||||
|
desktop-file-install --dir="$pkgdir/usr/share/applications" "$srcdir"/sioyek.desktop
|
||||||
|
install -D -m644 resources/sioyek-icon-linux.png \
|
||||||
|
"$pkgdir"/usr/share/icons/hicolor/256x256/apps/$pkgname.png
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="
|
||||||
|
4094dc6ddd832e62de0043147bfaa2f2ab0a337af192f78aff7f2f4cc76e1755d8bcb1f46b7677e872701d8e761c4ccfdec4d91e5a84c5e27b19dadfc932587d sioyek-1.4.0.tar.gz
|
||||||
|
1c613ea2883333964e9490a5228a2fd2d2ce70324576f8569d6c1df5aff0530ae520bb939da899cddba15e330e6e58c7f97b62177b7f052ca1fc80ef9aef3030 mupdf-1.20.patch
|
||||||
|
d2b802b75804a0986a2ad39b7609e503655780d96eec18e0f2dd378797f273d055d75265ad949f471b8befa287279be79e8b6215eb2ff63b168b574ca66d0e9c fix-mupdf-libs.patch
|
||||||
|
4ecc56d9a3448f420af502ac0428bb063680f41d99d468ac2a92034d2b107e010914708cbd7e006f524e24fe4e229849fb8e68a60e42f744057c9c02301fad9a sioyek.desktop
|
||||||
|
"
|
||||||
11
testing/sioyek/fix-mupdf-libs.patch
Normal file
11
testing/sioyek/fix-mupdf-libs.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- a/pdf_viewer_build_config.pro
|
||||||
|
+++ b/pdf_viewer_build_config.pro
|
||||||
|
@@ -82,7 +82,7 @@
|
||||||
|
} else {
|
||||||
|
DEFINES += NON_PORTABLE
|
||||||
|
DEFINES += LINUX_STANDARD_PATHS
|
||||||
|
- LIBS += -ldl -lmupdf -lmupdf-third -lgumbo -lharfbuzz -lfreetype -ljbig2dec -ljpeg -lmujs -lopenjp2 -lz
|
||||||
|
+ LIBS += -ldl -lmupdf -lz
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmpty(PREFIX){
|
||||||
125
testing/sioyek/mupdf-1.20.patch
Normal file
125
testing/sioyek/mupdf-1.20.patch
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
Patch-Source: https://aur.archlinux.org/cgit/aur.git/tree/mupdf-1.20.patch?h=sioyek
|
||||||
|
--
|
||||||
|
diff '--color=auto' --unified --recursive --text sioyek-1.4.0-original/pdf_viewer/document.cpp sioyek-1.4.0-patched/pdf_viewer/document.cpp
|
||||||
|
--- sioyek-1.4.0-original/pdf_viewer/document.cpp 2022-07-05 18:02:51.000000000 +0200
|
||||||
|
+++ sioyek-1.4.0-patched/pdf_viewer/document.cpp 2022-07-10 04:31:02.640253312 +0200
|
||||||
|
@@ -542,14 +542,14 @@
|
||||||
|
current_node->title = utf8_decode(root->title);
|
||||||
|
current_node->x = root->x;
|
||||||
|
current_node->y = root->y;
|
||||||
|
- if (root->page == -1) {
|
||||||
|
+ if (root->page.page == -1) {
|
||||||
|
float xp, yp;
|
||||||
|
fz_location loc = fz_resolve_link(context, doc, root->uri, &xp, &yp);
|
||||||
|
int chapter_page = accum_chapter_pages[loc.chapter];
|
||||||
|
current_node->page = chapter_page + loc.page;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
- current_node->page = root->page;
|
||||||
|
+ current_node->page = root->page.page;
|
||||||
|
}
|
||||||
|
convert_toc_tree(root->down, current_node->children);
|
||||||
|
|
||||||
|
diff '--color=auto' --unified --recursive --text sioyek-1.4.0-original/pdf_viewer/document_view.cpp sioyek-1.4.0-patched/pdf_viewer/document_view.cpp
|
||||||
|
--- sioyek-1.4.0-original/pdf_viewer/document_view.cpp 2022-07-05 18:02:51.000000000 +0200
|
||||||
|
+++ sioyek-1.4.0-patched/pdf_viewer/document_view.cpp 2022-07-10 04:31:53.839132616 +0200
|
||||||
|
@@ -1018,7 +1018,7 @@
|
||||||
|
|
||||||
|
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(pdf_link.value().uri);
|
||||||
|
+ auto parsed_uri = parse_uri(mupdf_context, pdf_link.value().uri);
|
||||||
|
DocumentPos res;
|
||||||
|
res.page = parsed_uri.page-1;
|
||||||
|
res.x = parsed_uri.x;
|
||||||
|
diff '--color=auto' --unified --recursive --text sioyek-1.4.0-original/pdf_viewer/main_widget.cpp sioyek-1.4.0-patched/pdf_viewer/main_widget.cpp
|
||||||
|
--- sioyek-1.4.0-original/pdf_viewer/main_widget.cpp 2022-07-05 18:02:51.000000000 +0200
|
||||||
|
+++ sioyek-1.4.0-patched/pdf_viewer/main_widget.cpp 2022-07-10 04:33:51.237849831 +0200
|
||||||
|
@@ -136,7 +136,7 @@
|
||||||
|
|
||||||
|
void MainWidget::set_overview_link(PdfLink link) {
|
||||||
|
|
||||||
|
- auto [page, offset_x, offset_y] = parse_uri(link.uri);
|
||||||
|
+ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri);
|
||||||
|
if (page >= 1) {
|
||||||
|
set_overview_position(page - 1, offset_y);
|
||||||
|
}
|
||||||
|
@@ -2661,7 +2661,7 @@
|
||||||
|
}
|
||||||
|
if ((link_index >= 0) && (link_index < static_cast<int>(visible_page_links.size()))) {
|
||||||
|
auto [selected_page, selected_link] = visible_page_links[link_index];
|
||||||
|
- auto [page, offset_x, offset_y] = parse_uri(selected_link->uri);
|
||||||
|
+ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri);
|
||||||
|
long_jump_to_destination(page-1, offset_y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -3239,7 +3239,7 @@
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- auto [page, offset_x, offset_y] = parse_uri(link.uri);
|
||||||
|
+ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri);
|
||||||
|
|
||||||
|
// convert one indexed page to zero indexed page
|
||||||
|
page--;
|
||||||
|
diff '--color=auto' --unified --recursive --text sioyek-1.4.0-original/pdf_viewer/pdf_renderer.cpp sioyek-1.4.0-patched/pdf_viewer/pdf_renderer.cpp
|
||||||
|
--- sioyek-1.4.0-original/pdf_viewer/pdf_renderer.cpp 2022-07-05 18:02:51.000000000 +0200
|
||||||
|
+++ sioyek-1.4.0-patched/pdf_viewer/pdf_renderer.cpp 2022-07-10 04:34:52.438699545 +0200
|
||||||
|
@@ -315,7 +315,7 @@
|
||||||
|
|
||||||
|
const int max_hits_per_page = 20;
|
||||||
|
fz_quad hitboxes[max_hits_per_page];
|
||||||
|
- int num_results = fz_search_page(mupdf_context, page, utf8_encode(req.search_term).c_str(), hitboxes, max_hits_per_page);
|
||||||
|
+ int num_results = fz_search_page(mupdf_context, page, utf8_encode(req.search_term).c_str(), nullptr, hitboxes, max_hits_per_page);
|
||||||
|
|
||||||
|
if (num_results > 0) {
|
||||||
|
req.search_results_mutex->lock();
|
||||||
|
diff '--color=auto' --unified --recursive --text sioyek-1.4.0-original/pdf_viewer/utils.cpp sioyek-1.4.0-patched/pdf_viewer/utils.cpp
|
||||||
|
--- sioyek-1.4.0-original/pdf_viewer/utils.cpp 2022-07-05 18:02:51.000000000 +0200
|
||||||
|
+++ sioyek-1.4.0-patched/pdf_viewer/utils.cpp 2022-07-10 04:36:36.587440044 +0200
|
||||||
|
@@ -24,6 +24,8 @@
|
||||||
|
#include <qnetworkreply.h>
|
||||||
|
#include <qscreen.h>
|
||||||
|
|
||||||
|
+#include <mupdf/pdf.h>
|
||||||
|
+
|
||||||
|
extern std::wstring LIBGEN_ADDRESS;
|
||||||
|
extern std::wstring GOOGLE_SCHOLAR_ADDRESS;
|
||||||
|
extern std::ofstream LOG_FILE;
|
||||||
|
@@ -106,21 +108,9 @@
|
||||||
|
return range_intersects(rect1.x0, rect1.x1, rect2.x0, rect2.x1) && range_intersects(rect1.y0, rect1.y1, rect2.y0, rect2.y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
-ParsedUri parse_uri(std::string uri) {
|
||||||
|
- int comma_index = -1;
|
||||||
|
-
|
||||||
|
- uri = uri.substr(1, uri.size() - 1);
|
||||||
|
- comma_index = static_cast<int>(uri.find(","));
|
||||||
|
- int page = atoi(uri.substr(0, comma_index ).c_str());
|
||||||
|
-
|
||||||
|
- uri = uri.substr(comma_index+1, uri.size() - comma_index-1);
|
||||||
|
- comma_index = static_cast<int>(uri.find(","));
|
||||||
|
- float offset_x = atof(uri.substr(0, comma_index ).c_str());
|
||||||
|
-
|
||||||
|
- uri = uri.substr(comma_index+1, uri.size() - comma_index-1);
|
||||||
|
- float offset_y = atof(uri.c_str());
|
||||||
|
-
|
||||||
|
- return { page, offset_x, offset_y };
|
||||||
|
+ParsedUri parse_uri(fz_context* mupdf_context, std::string uri) {
|
||||||
|
+ fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str());
|
||||||
|
+ return { dest.loc.page + 1, dest.x, dest.y };
|
||||||
|
}
|
||||||
|
|
||||||
|
char get_symbol(int key, bool is_shift_pressed, const std::vector<char>& special_symbols) {
|
||||||
|
diff '--color=auto' --unified --recursive --text sioyek-1.4.0-original/pdf_viewer/utils.h sioyek-1.4.0-patched/pdf_viewer/utils.h
|
||||||
|
--- sioyek-1.4.0-original/pdf_viewer/utils.h 2022-07-05 18:02:51.000000000 +0200
|
||||||
|
+++ sioyek-1.4.0-patched/pdf_viewer/utils.h 2022-07-10 04:37:43.601270950 +0200
|
||||||
|
@@ -33,7 +33,7 @@
|
||||||
|
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(std::string uri);
|
||||||
|
+ParsedUri parse_uri(fz_context* mupdf_context, std::string uri);
|
||||||
|
char get_symbol(int key, bool is_shift_pressed, const std::vector<char>&special_symbols);
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
11
testing/sioyek/sioyek.desktop
Normal file
11
testing/sioyek/sioyek.desktop
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=Sioyek
|
||||||
|
GenericName=PDF viewer
|
||||||
|
Comment=PDF viewer designed for reading research papers and technical books
|
||||||
|
Exec=sioyek
|
||||||
|
Icon=sioyek
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Categories=Viewer;Graphics;
|
||||||
|
MimeType=application/pdf;application/x-pdf;
|
||||||
|
NoDisplay=true
|
||||||
Loading…
x
Reference in New Issue
Block a user