Fix mupdf (fork)
parent
6845cbac53
commit
22e4ba0907
@ -1,26 +1,23 @@
|
||||
pkgbase = sioyek
|
||||
pkgdesc = PDF viewer for research papers and technical books.
|
||||
pkgbase = sioyek-mupdf-fix
|
||||
pkgdesc = PDF viewer for research papers and technical books
|
||||
pkgver = 2.0.0
|
||||
pkgrel = 3
|
||||
pkgrel = 1
|
||||
url = https://github.com/ahrm/sioyek
|
||||
arch = x86_64
|
||||
license = GPL3
|
||||
depends = freetype2
|
||||
depends = gcc-libs
|
||||
depends = glibc
|
||||
depends = gumbo-parser
|
||||
depends = harfbuzz
|
||||
depends = jbig2dec
|
||||
depends = libglvnd
|
||||
depends = libjpeg-turbo
|
||||
depends = libmupdf
|
||||
depends = openjpeg2
|
||||
depends = qt5-3d
|
||||
makedepends = git
|
||||
makedepends = harfbuzz
|
||||
makedepends = python
|
||||
makedepends = unzip
|
||||
depends = qt5-base
|
||||
depends = zlib
|
||||
source = sioyek-2.0.0.tar.gz::https://github.com/ahrm/sioyek/archive/v2.0.0.tar.gz
|
||||
source = mupdf-1.23.0.patch
|
||||
sha256sums = 92398b6da5e297c59f22cd3c6b562194846f28bc17bb4ae9432869aafeb5df17
|
||||
sha256sums = b04aa1a64eff87a83f7c885bbb92e0a4a2a76e72052c89eb4cfd64fbf1a1ad71
|
||||
depends = qt5-3d
|
||||
depends = glu
|
||||
depends = libxrandr
|
||||
provides = sioyek
|
||||
conflicts = sioyek
|
||||
conflicts = sioyek-git
|
||||
conflicts = sioyek-appimage
|
||||
source = sioyek::git+https://github.com/ahrm/sioyek.git#tag=v2.0.0
|
||||
sha256sums = SKIP
|
||||
|
||||
pkgname = sioyek
|
||||
pkgname = sioyek-mupdf-fix
|
||||
|
@ -0,0 +1,5 @@
|
||||
/*
|
||||
|
||||
!/.gitignore
|
||||
!/PKGBUILD
|
||||
!/.SRCINFO
|
@ -1,48 +1,41 @@
|
||||
# Maintainer: Alexander Seiler <seileralex@gmail.com>
|
||||
pkgname=sioyek
|
||||
# Maintainer: MithicSpirit <rpc01234 at gmail dot com>
|
||||
# Contributor: Alexander Seiler <seileralex@gmail.com>
|
||||
|
||||
_pkgname=sioyek
|
||||
pkgname="$_pkgname-mupdf-fix"
|
||||
pkgver=2.0.0
|
||||
pkgrel=3
|
||||
pkgdesc="PDF viewer for research papers and technical books."
|
||||
pkgrel=1
|
||||
pkgdesc='PDF viewer for research papers and technical books'
|
||||
arch=('x86_64')
|
||||
license=('GPL3')
|
||||
url="https://github.com/ahrm/sioyek"
|
||||
depends=(
|
||||
'freetype2'
|
||||
'gcc-libs'
|
||||
'glibc'
|
||||
'gumbo-parser'
|
||||
'harfbuzz'
|
||||
'jbig2dec'
|
||||
'libglvnd'
|
||||
'libjpeg-turbo'
|
||||
'libmupdf'
|
||||
'openjpeg2'
|
||||
'qt5-3d'
|
||||
'qt5-base'
|
||||
'zlib')
|
||||
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz" "mupdf-1.23.0.patch")
|
||||
sha256sums=('92398b6da5e297c59f22cd3c6b562194846f28bc17bb4ae9432869aafeb5df17' 'b04aa1a64eff87a83f7c885bbb92e0a4a2a76e72052c89eb4cfd64fbf1a1ad71')
|
||||
url="https://github.com/ahrm/$_pkgname"
|
||||
depends=('qt5-base' 'zlib' 'harfbuzz' 'libglvnd' 'glibc' 'gcc-libs')
|
||||
makedepends=('git' 'python' 'unzip' 'qt5-3d' 'glu' 'libxrandr')
|
||||
conflicts=("$_pkgname" "$_pkgname-git" "$_pkgname-appimage")
|
||||
provides=("$_pkgname")
|
||||
source=("$_pkgname::git+https://github.com/ahrm/$_pkgname.git#tag=v$pkgver")
|
||||
sha256sums=(SKIP)
|
||||
|
||||
prepare() {
|
||||
cd "$pkgname-$pkgver"
|
||||
patch --forward --strip=1 --input="${srcdir}/mupdf-1.23.0.patch"
|
||||
sed -i 's/-lmupdf-threads/-lfreetype -lgumbo -ljbig2dec -lopenjp2 -ljpeg/' pdf_viewer_build_config.pro
|
||||
sed -i '/#define LINUX_STANDARD_PATHS/s/\/\///' pdf_viewer/main.cpp
|
||||
cd "$srcdir/$_pkgname"
|
||||
sed -i '/#define LINUX_STANDARD_PATHS/s|^//||' pdf_viewer/main.cpp
|
||||
git submodule update --init --recursive --jobs "$(nproc)"
|
||||
#sed -i 's/-lmupdf-threads/-lfreetype -lgumbo -ljbig2dec -lopenjp2 -ljpeg/' pdf_viewer_build_config.pro
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$pkgname-$pkgver"
|
||||
cd "$srcdir/$_pkgname"
|
||||
./build_linux.sh
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname-$pkgver"
|
||||
install -D build/sioyek -t "$pkgdir/usr/bin/"
|
||||
cd "$srcdir/$_pkgname"
|
||||
install -D "build/$_pkgname" -t "$pkgdir/usr/bin/"
|
||||
install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
|
||||
install -Dm644 resources/sioyek-icon-linux.png -t "$pkgdir/usr/share/icons/"
|
||||
install -Dm644 resources/$pkgname.desktop -t "$pkgdir/usr/share/applications/"
|
||||
install -Dm644 build/shaders/* -t "$pkgdir/usr/share/$pkgname/shaders/"
|
||||
install -Dm644 "resources/$_pkgname-icon-linux.png" -t "$pkgdir/usr/share/icons/"
|
||||
install -Dm644 "resources/$_pkgname.desktop" -t "$pkgdir/usr/share/applications/"
|
||||
install -Dm644 build/shaders/* -t "$pkgdir/usr/share/$_pkgname/shaders/"
|
||||
install -Dm644 -t "$pkgdir/etc/sioyek/" build/keys.config build/prefs.config
|
||||
install -Dm644 -t "$pkgdir/usr/share/man/man1" resources/sioyek.1
|
||||
install -Dm644 -t "$pkgdir/usr/share/sioyek" build/tutorial.pdf
|
||||
install -Dm644 -t "$pkgdir/usr/share/man/man1" "resources/$_pkgname.1"
|
||||
install -Dm644 -t "$pkgdir/usr/share/$_pkgname" build/tutorial.pdf
|
||||
}
|
||||
|
@ -1,73 +0,0 @@
|
||||
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>
|
Loading…
Reference in New Issue