Date: Tuesday, April 11, 2023 @ 15:10:48
  Author: antiz
Revision: 1444676

upgpkg: zathura-pdf-mupdf 0.4.0-3: Add a temporary patch to fix the 'resolve 
link destination' upstream issue (#33)

Added:
  zathura-pdf-mupdf/trunk/resolve_link_destination.patch
Modified:
  zathura-pdf-mupdf/trunk/PKGBUILD

--------------------------------+
 PKGBUILD                       |   13 +++++++++---
 resolve_link_destination.patch |   42 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-04-11 14:53:16 UTC (rev 1444675)
+++ PKGBUILD    2023-04-11 15:10:48 UTC (rev 1444676)
@@ -6,7 +6,7 @@
 
 pkgname=zathura-pdf-mupdf
 pkgver=0.4.0
-pkgrel=2
+pkgrel=3
 
 pkgdesc="PDF support for Zathura (MuPDF backend) (Supports PDF, ePub, and 
OpenXPS)"
 url="https://pwmt.org/projects/zathura-pdf-mupdf/";
@@ -19,14 +19,21 @@
 makedepends=('libmupdf' 'meson' 'ninja' 'git')
 
 
source=(zathura-pdf-mupdf-$pkgver.tar.gz::https://pwmt.org/projects/zathura-pdf-mupdf/download/zathura-pdf-mupdf-$pkgver.tar.xz
-        0001-Remove-mupdf-linking-detection.patch)
+        0001-Remove-mupdf-linking-detection.patch
+        resolve_link_destination.patch)
 
 sha256sums=('8c1c575678a1cd45b007bdf12328527f0aef6184103e0965459a4202e9ee925d'
-            '8b51563a782a7dea38711335354bf65e2303b06bfecacf9cc060ecfc7b0851b8')
+            '8b51563a782a7dea38711335354bf65e2303b06bfecacf9cc060ecfc7b0851b8'
+            '322fba688c30b18d80c4d834b53e3cb643d5b77143acf72a36252802e3d03e9d')
 
 prepare() {
   cd zathura-pdf-mupdf-$pkgver
   patch -p1 <"$srcdir"/0001-Remove-mupdf-linking-detection.patch
+  
+  # Temporary fix for the "resolving link destination" issue with mupdf 1.21.X 
(while waiting for it to be included in a new release)
+  # https://git.pwmt.org/pwmt/zathura-pdf-mupdf/-/issues/33
+  # https://git.pwmt.org/pwmt/zathura-pdf-mupdf/-/merge_requests/9
+  patch -Np1 <"$srcdir"/resolve_link_destination.patch
 }
 
 build() {

Added: resolve_link_destination.patch
===================================================================
--- resolve_link_destination.patch                              (rev 0)
+++ resolve_link_destination.patch      2023-04-11 15:10:48 UTC (rev 1444676)
@@ -0,0 +1,42 @@
+--- zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/index.c  2022-11-27 
16:51:05.000000000 +0100
++++ zathura-pdf-mupdf/zathura-pdf-mupdf/index.c        2023-04-11 
16:19:41.839932951 +0200
+@@ -2,6 +2,7 @@
+ 
+ #include <girara/datastructures.h>
+ 
++#include "math.h"
+ #include "plugin.h"
+ 
+ static void build_index(fz_context* ctx, fz_document* document, fz_outline*
+@@ -70,8 +71,8 @@
+       type                    = ZATHURA_LINK_GOTO_DEST;
+       target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
+       target.page_number      = fz_page_number_from_location (ctx, document, 
location);
+-      target.left  = x;
+-      target.top   = y;
++      if (!isnan(x)) target.left  = x;
++      if (!isnan(y)) target.top   = y;
+       target.zoom  = 0.0;
+     }
+ 
+--- zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/links.c  2022-11-27 
16:51:05.000000000 +0100
++++ zathura-pdf-mupdf/zathura-pdf-mupdf/links.c        2023-04-11 
16:19:41.839932951 +0200
+@@ -3,6 +3,7 @@
+ #include <glib.h>
+ 
+ #include "plugin.h"
++#include "math.h"
+ 
+ girara_list_t*
+ pdf_page_links_get(zathura_page_t* page, void* data, zathura_error_t* error)
+@@ -59,8 +60,8 @@
+       type                    = ZATHURA_LINK_GOTO_DEST;
+       target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
+       target.page_number      = fz_page_number_from_location 
(mupdf_document->ctx, mupdf_document->document, location);
+-      target.left  = x;
+-      target.top   = y;
++      if (!isnan(x)) target.left  = x;
++      if (!isnan(y)) target.top   = y;
+       target.zoom  = 0.0;
+     }
+ 

Reply via email to