[arch-commits] Commit in zathura-pdf-mupdf/repos (6 files)

Johannes Löthberg demize at archlinux.org
Tue Dec 6 14:43:33 UTC 2016


    Date: Tuesday, December 6, 2016 @ 14:43:33
  Author: demize
Revision: 198210

archrelease: copy trunk to community-i686, community-x86_64

Added:
  zathura-pdf-mupdf/repos/community-i686/PKGBUILD
    (from rev 198209, zathura-pdf-mupdf/trunk/PKGBUILD)
  zathura-pdf-mupdf/repos/community-i686/mupdf-1.9.patch
    (from rev 198209, zathura-pdf-mupdf/trunk/mupdf-1.9.patch)
  zathura-pdf-mupdf/repos/community-x86_64/PKGBUILD
    (from rev 198209, zathura-pdf-mupdf/trunk/PKGBUILD)
  zathura-pdf-mupdf/repos/community-x86_64/mupdf-1.9.patch
    (from rev 198209, zathura-pdf-mupdf/trunk/mupdf-1.9.patch)
Deleted:
  zathura-pdf-mupdf/repos/community-i686/mupdf-1.10.patch
  zathura-pdf-mupdf/repos/community-x86_64/mupdf-1.10.patch

-----------------------------------+
 community-i686/PKGBUILD           |   37 ++++
 community-i686/mupdf-1.10.patch   |  287 ------------------------------------
 community-i686/mupdf-1.9.patch    |  151 ++++++++++++++++++
 community-x86_64/PKGBUILD         |   37 ++++
 community-x86_64/mupdf-1.10.patch |  287 ------------------------------------
 community-x86_64/mupdf-1.9.patch  |  151 ++++++++++++++++++
 6 files changed, 376 insertions(+), 574 deletions(-)

Copied: zathura-pdf-mupdf/repos/community-i686/PKGBUILD (from rev 198209, zathura-pdf-mupdf/trunk/PKGBUILD)
===================================================================
--- community-i686/PKGBUILD	                        (rev 0)
+++ community-i686/PKGBUILD	2016-12-06 14:43:33 UTC (rev 198210)
@@ -0,0 +1,37 @@
+# $Id$
+# Maintainer: Johannes Löthberg <johannes at kyriasis.com>
+# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
+# Contributor: Sergej Pupykin <pupykin.s+arch at gmail.com>
+# Contributor: Moritz Lipp <mlq at pwmt.org>
+
+pkgname=zathura-pdf-mupdf
+pkgver=0.3.0
+pkgrel=6
+
+pkgdesc="PDF support for Zathura (MuPDF backend)"
+url="https://pwmt.org/projects/zathura-pdf-mupdf/"
+arch=('i686' 'x86_64')
+license=('zlib')
+
+conflicts=('zathura-pdf-poppler')
+
+depends=('zathura' 'jbig2dec' 'openjpeg2' 'cairo' 'desktop-file-utils')
+makedepends=('libmupdf')
+
+source=(https://pwmt.org/projects/zathura/plugins/download/zathura-pdf-mupdf-$pkgver.tar.gz
+        mupdf-1.9.patch)
+sha1sums=('ae0be41ea7c75b8ddc083fe01f1366673ea9751a'
+          'f26adb3a7c69cf7a2e957d211e8faffe79c923c7')
+
+prepare() {
+  patch -d zathura-pdf-mupdf-$pkgver -Np1 < mupdf-1.9.patch
+}
+
+build() {
+  make -C zathura-pdf-mupdf-$pkgver MUPDF_LIB="-lmupdf -lmupdfthird"
+}
+
+package(){
+  make -C zathura-pdf-mupdf-$pkgver DESTDIR="$pkgdir" install
+  install -Dm0644 zathura-pdf-mupdf-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}

Deleted: community-i686/mupdf-1.10.patch
===================================================================
--- community-i686/mupdf-1.10.patch	2016-12-06 14:41:50 UTC (rev 198209)
+++ community-i686/mupdf-1.10.patch	2016-12-06 14:43:33 UTC (rev 198210)
@@ -1,287 +0,0 @@
-From 518fd77c351fa1bac37679e195dc14fa76c8e895 Mon Sep 17 00:00:00 2001
-From: Moritz Lipp <mlq at pwmt.org>
-Date: Thu, 24 Nov 2016 00:51:45 +0100
-Subject: [PATCH] Make compatible to mupdf 1.10
-
----
- document.c |  1 -
- image.c    |  2 +-
- index.c    | 68 ++++++++++++++++++++++----------------------------------------------
- links.c    | 64 ++++++++++++++++++----------------------------------------------
- page.c     |  4 +++-
- render.c   |  6 +++---
- utils.c    |  2 +-
- 7 files changed, 48 insertions(+), 99 deletions(-)
-
-diff --git a/document.c b/document.c
-index 8d0aae4..7f9f244 100644
---- a/document.c
-+++ b/document.c
-@@ -3,7 +3,6 @@
- #define _POSIX_C_SOURCE 1
- 
- #include <mupdf/fitz.h>
--#include <mupdf/xps.h>
- #include <mupdf/pdf.h>
- 
- #include <glib-2.0/glib.h>
-diff --git a/image.c b/image.c
-index 8f6912b..b938e5c 100644
---- a/image.c
-+++ b/image.c
-@@ -93,7 +93,7 @@ pdf_page_image_get_cairo(zathura_page_t* page, mupdf_page_t* mupdf_page,
-   fz_pixmap* pixmap = NULL;
-   cairo_surface_t* surface = NULL;
- 
--  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
-+  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, NULL, NULL, 0, 0);
-   if (pixmap == NULL) {
-     goto error_free;
-   }
-diff --git a/index.c b/index.c
-index 8b8f8a5..1d1ea8d 100644
---- a/index.c
-+++ b/index.c
-@@ -6,7 +6,8 @@
- 
- #include "plugin.h"
- 
--static void build_index(fz_outline* outline, girara_tree_node_t* root);
-+static void build_index(fz_context* ctx, fz_document* document, fz_outline*
-+    outline, girara_tree_node_t* root);
- 
- girara_tree_node_t*
- pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupdf_document, zathura_error_t* error)
-@@ -29,7 +30,7 @@ pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupd
- 
-   /* generate index */
-   girara_tree_node_t* root = girara_node_new(zathura_index_element_new("ROOT"));
--  build_index(outline, root);
-+  build_index(mupdf_document->ctx, mupdf_document->document, outline, root);
- 
-   /* free outline */
-   fz_drop_outline(mupdf_document->ctx, outline);
-@@ -38,7 +39,7 @@ pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupd
- }
- 
- static void
--build_index(fz_outline* outline, girara_tree_node_t* root)
-+build_index(fz_context* ctx, fz_document* document, fz_outline* outline, girara_tree_node_t* root)
- {
-   if (outline == NULL || root == NULL) {
-     return;
-@@ -50,49 +51,24 @@ build_index(fz_outline* outline, girara_tree_node_t* root)
-     zathura_link_type_t type               = ZATHURA_LINK_INVALID;
-     zathura_rectangle_t rect               = { .x1 = 0, .y1 = 0, .x2 = 0, .y2 = 0 };
- 
--    switch (outline->dest.kind) {
--      case FZ_LINK_NONE:
--        type = ZATHURA_LINK_NONE;
--        break;
--      case FZ_LINK_URI:
-+    if (fz_is_external_link(ctx, outline->uri) == 1) {
-+      if (strstr(outline->uri, "file://") == outline->uri) {
-+        type         = ZATHURA_LINK_GOTO_REMOTE;
-+        target.value = outline->uri;
-+      } else {
-         type         = ZATHURA_LINK_URI;
--        target.value = outline->dest.ld.uri.uri;
--        break;
--      case FZ_LINK_GOTO:
--        type                    = ZATHURA_LINK_GOTO_DEST;
--        target.page_number      = outline->dest.ld.gotor.page;
--        target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
--        target.left             = 0;
--        target.top              = 0;
--        target.scale            = 0.0;
--        {
--          int gflags = outline->dest.ld.gotor.flags;
--          if (gflags & fz_link_flag_l_valid) {
--            target.left = outline->dest.ld.gotor.lt.x;
--          }
--          if (gflags & fz_link_flag_t_valid) {
--            target.top = outline->dest.ld.gotor.lt.y;
--          }
--          /* if (gflags & fz_link_flag_r_is_zoom) { */
--          /*   target.scale = outline->dest.ld.gotor.rb.x; */
--          /* } */
--        }
--        break;
--      case FZ_LINK_LAUNCH:
--        type = ZATHURA_LINK_LAUNCH;
--        target.value = outline->dest.ld.launch.file_spec;
--        break;
--      case FZ_LINK_NAMED:
--        type = ZATHURA_LINK_NAMED;
--        target.value = outline->dest.ld.named.named;
--        break;
--      case FZ_LINK_GOTOR:
--        type = ZATHURA_LINK_GOTO_REMOTE;
--        target.value = outline->dest.ld.gotor.file_spec;
--        break;
--      default:
--        outline = outline->next; // TODO: Don't skip unknown type
--        continue;
-+        target.value = outline->uri;
-+      }
-+    } else {
-+      float x = 0;
-+      float y = 0;
-+
-+      type                    = ZATHURA_LINK_GOTO_DEST;
-+      target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
-+      target.page_number      = fz_resolve_link(ctx, document, outline->uri, &x, &y);
-+      target.left  = x;
-+      target.top   = y;
-+      target.scale = 0.0;
-     }
- 
-     index_element->link = zathura_link_new(type, rect, target);
-@@ -104,7 +80,7 @@ build_index(fz_outline* outline, girara_tree_node_t* root)
-     girara_tree_node_t* node = girara_node_append_data(root, index_element);
- 
-     if (outline->down != NULL) {
--      build_index(outline->down, node);
-+      build_index(ctx, document, outline->down, node);
-     }
- 
-     outline = outline->next;
-diff --git a/links.c b/links.c
-index a947802..7423af2 100644
---- a/links.c
-+++ b/links.c
-@@ -43,59 +43,31 @@ pdf_page_links_get(zathura_page_t* page, mupdf_page_t* mupdf_page, zathura_error
-     zathura_link_type_t type     = ZATHURA_LINK_INVALID;
-     zathura_link_target_t target = { 0 };
- 
--    char* buffer = NULL;
--    switch (link->dest.kind) {
--      case FZ_LINK_NONE:
--        type = ZATHURA_LINK_NONE;
--        break;
--      case FZ_LINK_URI:
-+    if (fz_is_external_link(mupdf_document->ctx, link->uri) == 1) {
-+      if (strstr(link->uri, "file://") == link->uri) {
-+        type         = ZATHURA_LINK_GOTO_REMOTE;
-+        target.value = link->uri;
-+      } else {
-         type         = ZATHURA_LINK_URI;
--        target.value = link->dest.ld.uri.uri;
--        break;
--      case FZ_LINK_GOTO:
--        type                    = ZATHURA_LINK_GOTO_DEST;
--        target.page_number      = link->dest.ld.gotor.page;
--        target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
--        target.left             = 0;
--        target.top              = 0;
--        target.scale            = 0.0;
--        {
--          int gflags = link->dest.ld.gotor.flags;
--          if (gflags & fz_link_flag_l_valid) {
--            target.left = link->dest.ld.gotor.lt.x;
--          }
--          if (gflags & fz_link_flag_t_valid) {
--            target.top = link->dest.ld.gotor.lt.y;
--          }
--          /* if (gflags & fz_link_flag_r_is_zoom) { */
--          /*   target.scale = link->dest.ld.gotor.rb.x; */
--          /* } */
--        }
--        break;
--      case FZ_LINK_LAUNCH:
--        type = ZATHURA_LINK_LAUNCH;
--        target.value = link->dest.ld.launch.file_spec;
--        break;
--      case FZ_LINK_NAMED:
--        type = ZATHURA_LINK_NAMED;
--        target.value = link->dest.ld.named.named;
--        break;
--      case FZ_LINK_GOTOR:
--        type = ZATHURA_LINK_GOTO_REMOTE;
--        target.value = link->dest.ld.gotor.file_spec;
--        break;
--      default:
--        continue;
-+        target.value = link->uri;
-+      }
-+    } else {
-+      float x = 0;
-+      float y = 0;
-+
-+      type                    = ZATHURA_LINK_GOTO_DEST;
-+      target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
-+      target.page_number      = fz_resolve_link(mupdf_document->ctx,
-+          mupdf_document->document, link->uri, &x, &y);
-+      target.left  = x;
-+      target.top   = y;
-+      target.scale = 0.0;
-     }
- 
-     zathura_link_t* zathura_link = zathura_link_new(type, position, target);
-     if (zathura_link != NULL) {
-       girara_list_append(list, zathura_link);
-     }
--
--    if (buffer != NULL) {
--      g_free(buffer);
--    }
-   }
- 
-   return list;
-diff --git a/page.c b/page.c
-index 219fc2a..5302cb5 100644
---- a/page.c
-+++ b/page.c
-@@ -43,7 +43,9 @@ pdf_page_init(zathura_page_t* page)
-   /* setup text */
-   mupdf_page->extracted_text = false;
- 
--  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
-+  fz_rect mediabox;
-+  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx,
-+      fz_bound_page(mupdf_page->ctx, mupdf_page->page, &mediabox));
-   if (mupdf_page->text == NULL) {
-     goto error_free;
-   }
-diff --git a/render.c b/render.c
-index 2a92a23..00adb83 100644
---- a/render.c
-+++ b/render.c
-@@ -20,7 +20,7 @@ pdf_page_render_to_buffer(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_
-     return ZATHURA_ERROR_UNKNOWN;
-   }
- 
--  fz_display_list* display_list = fz_new_display_list(mupdf_page->ctx);
-+  fz_display_list* display_list = fz_new_display_list(mupdf_page->ctx, NULL);
-   fz_device* device             = fz_new_list_device(mupdf_page->ctx, display_list);
- 
-   fz_try (mupdf_document->ctx) {
-@@ -37,10 +37,10 @@ pdf_page_render_to_buffer(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_
-   fz_rect rect = { .x1 = page_width, .y1 = page_height };
- 
-   fz_colorspace* colorspace = fz_device_bgr(mupdf_document->ctx);
--  fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx, colorspace, &irect, image);
-+  fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx, colorspace, &irect, 1, image);
-   fz_clear_pixmap_with_value(mupdf_page->ctx, pixmap, 0xFF);
- 
--  device = fz_new_draw_device(mupdf_page->ctx, pixmap);
-+  device = fz_new_draw_device(mupdf_page->ctx, NULL, pixmap);
-   fz_run_display_list(mupdf_page->ctx, display_list, device, &fz_identity, &rect, NULL);
-   fz_drop_device(mupdf_page->ctx, device);
- 
-diff --git a/utils.c b/utils.c
-index a4b9320..648187a 100644
---- a/utils.c
-+++ b/utils.c
-@@ -14,7 +14,7 @@ mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_pa
-   fz_device* text_device = NULL;
- 
-   fz_try (mupdf_page->ctx) {
--    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
-+    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text, NULL);
- 
-     /* Disable FZ_IGNORE_IMAGE to collect image blocks */
-     fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);
---
-libgit2 0.24.0
-

Copied: zathura-pdf-mupdf/repos/community-i686/mupdf-1.9.patch (from rev 198209, zathura-pdf-mupdf/trunk/mupdf-1.9.patch)
===================================================================
--- community-i686/mupdf-1.9.patch	                        (rev 0)
+++ community-i686/mupdf-1.9.patch	2016-12-06 14:43:33 UTC (rev 198210)
@@ -0,0 +1,151 @@
+From 368e80b59a7b2f330ad9bd7de45c350c6fbb2209 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail at eworm.de>
+Date: Mon, 18 Apr 2016 15:23:07 +0200
+Subject: [PATCH 1/1] update API for mupdf 1.9
+
+Signed-off-by: Christian Hesse <mail at eworm.de>
+---
+ AUTHORS    | 1 +
+ config.mk  | 2 +-
+ document.c | 6 +++---
+ image.c    | 2 +-
+ page.c     | 8 ++++----
+ plugin.h   | 4 ++--
+ search.c   | 2 +-
+ utils.c    | 2 +-
+ 8 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index f5f8430..371ebf1 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -5,5 +5,6 @@ Sebastian Ramacher <s.ramacher at gmx.at>
+ 
+ Other contributors are (in alphabetical order):
+ 
++Christian Hesse <mail at eworm.de>
+ Pavel Borzenkov <pavel.borzenkov at gmail.com>
+ William Skeith <wes at cs.ccny.cuny.edu>
+diff --git a/config.mk b/config.mk
+index cba8d40..6407ae6 100644
+--- a/config.mk
++++ b/config.mk
+@@ -32,7 +32,7 @@ endif
+ OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
+ OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
+ 
+-MUPDF_LIB ?= -lmupdf -lmujs
++MUPDF_LIB ?= -lmupdf -lmupdfthird
+ 
+ INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
+ LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
+diff --git a/document.c b/document.c
+index 873866c..548f4ff 100644
+--- a/document.c
++++ b/document.c
+@@ -109,12 +109,12 @@ pdf_document_save_as(zathura_document_t* document, mupdf_document_t*
+   }
+ 
+   fz_try (mupdf_document->ctx) {
+-    /* fz_write_document claims to accepts NULL as third argument but doesn't.
++    /* pdf_save_document claims to accepts NULL as third argument but doesn't.
+      * pdf_write_document does not check if the third arguments is NULL for some
+      * options. */
+ 
+-    fz_write_options opts = { 0 }; /* just use the default options */
+-    fz_write_document(mupdf_document->ctx, mupdf_document->document, (char*) path, &opts);
++    pdf_write_options opts = { 0 }; /* just use the default options */
++    pdf_save_document(mupdf_document->ctx, (pdf_document*) mupdf_document->document, (char*) path, &opts);
+   } fz_catch (mupdf_document->ctx) {
+     return ZATHURA_ERROR_UNKNOWN;
+   }
+diff --git a/image.c b/image.c
+index 97d4143..8f6912b 100644
+--- a/image.c
++++ b/image.c
+@@ -93,7 +93,7 @@ pdf_page_image_get_cairo(zathura_page_t* page, mupdf_page_t* mupdf_page,
+   fz_pixmap* pixmap = NULL;
+   cairo_surface_t* surface = NULL;
+ 
+-  pixmap = fz_new_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
++  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
+   if (pixmap == NULL) {
+     goto error_free;
+   }
+diff --git a/page.c b/page.c
+index beb0351..219fc2a 100644
+--- a/page.c
++++ b/page.c
+@@ -43,12 +43,12 @@ pdf_page_init(zathura_page_t* page)
+   /* setup text */
+   mupdf_page->extracted_text = false;
+ 
+-  mupdf_page->text = fz_new_text_page(mupdf_page->ctx);
++  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
+   if (mupdf_page->text == NULL) {
+     goto error_free;
+   }
+ 
+-  mupdf_page->sheet = fz_new_text_sheet(mupdf_page->ctx);
++  mupdf_page->sheet = fz_new_stext_sheet(mupdf_page->ctx);
+   if (mupdf_page->sheet == NULL) {
+     goto error_free;
+   }
+@@ -74,11 +74,11 @@ pdf_page_clear(zathura_page_t* page, mupdf_page_t* mupdf_page)
+ 
+   if (mupdf_page != NULL) {
+     if (mupdf_page->text != NULL) {
+-      fz_drop_text_page(mupdf_page->ctx, mupdf_page->text);
++      fz_drop_stext_page(mupdf_page->ctx, mupdf_page->text);
+     }
+ 
+     if (mupdf_page->sheet != NULL) {
+-      fz_drop_text_sheet(mupdf_page->ctx, mupdf_page->sheet);
++      fz_drop_stext_sheet(mupdf_page->ctx, mupdf_page->sheet);
+     }
+ 
+     if (mupdf_page->page != NULL) {
+diff --git a/plugin.h b/plugin.h
+index f2fb4a0..84c5e53 100644
+--- a/plugin.h
++++ b/plugin.h
+@@ -21,8 +21,8 @@ typedef struct mupdf_page_s
+ {
+   fz_page* page; /**< Reference to the mupdf page */
+   fz_context* ctx; /**< Context */
+-  fz_text_sheet* sheet; /**< Text sheet */
+-  fz_text_page* text; /**< Page text */
++  fz_stext_sheet* sheet; /**< Text sheet */
++  fz_stext_page* text; /**< Page text */
+   fz_rect bbox; /**< Bbox */
+   bool extracted_text; /**< If text has already been extracted */
+ } mupdf_page_t;
+diff --git a/search.c b/search.c
+index 3a9fad4..c672b9f 100644
+--- a/search.c
++++ b/search.c
+@@ -40,7 +40,7 @@ pdf_page_search_text(zathura_page_t* page, mupdf_page_t* mupdf_page, const char*
+   }
+ 
+   fz_rect* hit_bbox = fz_malloc_array(mupdf_page->ctx, N_SEARCH_RESULTS, sizeof(fz_rect));
+-  int num_results = fz_search_text_page(mupdf_page->ctx, mupdf_page->text,
++  int num_results = fz_search_stext_page(mupdf_page->ctx, mupdf_page->text,
+       (char*) text, hit_bbox, N_SEARCH_RESULTS);
+ 
+   for (int i = 0; i < num_results; i++) {
+diff --git a/utils.c b/utils.c
+index 4a003b9..a4b9320 100644
+--- a/utils.c
++++ b/utils.c
+@@ -14,7 +14,7 @@ mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_pa
+   fz_device* text_device = NULL;
+ 
+   fz_try (mupdf_page->ctx) {
+-    text_device = fz_new_text_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
++    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
+ 
+     /* Disable FZ_IGNORE_IMAGE to collect image blocks */
+     fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);
+-- 
+2.8.0
+

Copied: zathura-pdf-mupdf/repos/community-x86_64/PKGBUILD (from rev 198209, zathura-pdf-mupdf/trunk/PKGBUILD)
===================================================================
--- community-x86_64/PKGBUILD	                        (rev 0)
+++ community-x86_64/PKGBUILD	2016-12-06 14:43:33 UTC (rev 198210)
@@ -0,0 +1,37 @@
+# $Id$
+# Maintainer: Johannes Löthberg <johannes at kyriasis.com>
+# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
+# Contributor: Sergej Pupykin <pupykin.s+arch at gmail.com>
+# Contributor: Moritz Lipp <mlq at pwmt.org>
+
+pkgname=zathura-pdf-mupdf
+pkgver=0.3.0
+pkgrel=6
+
+pkgdesc="PDF support for Zathura (MuPDF backend)"
+url="https://pwmt.org/projects/zathura-pdf-mupdf/"
+arch=('i686' 'x86_64')
+license=('zlib')
+
+conflicts=('zathura-pdf-poppler')
+
+depends=('zathura' 'jbig2dec' 'openjpeg2' 'cairo' 'desktop-file-utils')
+makedepends=('libmupdf')
+
+source=(https://pwmt.org/projects/zathura/plugins/download/zathura-pdf-mupdf-$pkgver.tar.gz
+        mupdf-1.9.patch)
+sha1sums=('ae0be41ea7c75b8ddc083fe01f1366673ea9751a'
+          'f26adb3a7c69cf7a2e957d211e8faffe79c923c7')
+
+prepare() {
+  patch -d zathura-pdf-mupdf-$pkgver -Np1 < mupdf-1.9.patch
+}
+
+build() {
+  make -C zathura-pdf-mupdf-$pkgver MUPDF_LIB="-lmupdf -lmupdfthird"
+}
+
+package(){
+  make -C zathura-pdf-mupdf-$pkgver DESTDIR="$pkgdir" install
+  install -Dm0644 zathura-pdf-mupdf-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}

Deleted: community-x86_64/mupdf-1.10.patch
===================================================================
--- community-x86_64/mupdf-1.10.patch	2016-12-06 14:41:50 UTC (rev 198209)
+++ community-x86_64/mupdf-1.10.patch	2016-12-06 14:43:33 UTC (rev 198210)
@@ -1,287 +0,0 @@
-From 518fd77c351fa1bac37679e195dc14fa76c8e895 Mon Sep 17 00:00:00 2001
-From: Moritz Lipp <mlq at pwmt.org>
-Date: Thu, 24 Nov 2016 00:51:45 +0100
-Subject: [PATCH] Make compatible to mupdf 1.10
-
----
- document.c |  1 -
- image.c    |  2 +-
- index.c    | 68 ++++++++++++++++++++++----------------------------------------------
- links.c    | 64 ++++++++++++++++++----------------------------------------------
- page.c     |  4 +++-
- render.c   |  6 +++---
- utils.c    |  2 +-
- 7 files changed, 48 insertions(+), 99 deletions(-)
-
-diff --git a/document.c b/document.c
-index 8d0aae4..7f9f244 100644
---- a/document.c
-+++ b/document.c
-@@ -3,7 +3,6 @@
- #define _POSIX_C_SOURCE 1
- 
- #include <mupdf/fitz.h>
--#include <mupdf/xps.h>
- #include <mupdf/pdf.h>
- 
- #include <glib-2.0/glib.h>
-diff --git a/image.c b/image.c
-index 8f6912b..b938e5c 100644
---- a/image.c
-+++ b/image.c
-@@ -93,7 +93,7 @@ pdf_page_image_get_cairo(zathura_page_t* page, mupdf_page_t* mupdf_page,
-   fz_pixmap* pixmap = NULL;
-   cairo_surface_t* surface = NULL;
- 
--  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
-+  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, NULL, NULL, 0, 0);
-   if (pixmap == NULL) {
-     goto error_free;
-   }
-diff --git a/index.c b/index.c
-index 8b8f8a5..1d1ea8d 100644
---- a/index.c
-+++ b/index.c
-@@ -6,7 +6,8 @@
- 
- #include "plugin.h"
- 
--static void build_index(fz_outline* outline, girara_tree_node_t* root);
-+static void build_index(fz_context* ctx, fz_document* document, fz_outline*
-+    outline, girara_tree_node_t* root);
- 
- girara_tree_node_t*
- pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupdf_document, zathura_error_t* error)
-@@ -29,7 +30,7 @@ pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupd
- 
-   /* generate index */
-   girara_tree_node_t* root = girara_node_new(zathura_index_element_new("ROOT"));
--  build_index(outline, root);
-+  build_index(mupdf_document->ctx, mupdf_document->document, outline, root);
- 
-   /* free outline */
-   fz_drop_outline(mupdf_document->ctx, outline);
-@@ -38,7 +39,7 @@ pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupd
- }
- 
- static void
--build_index(fz_outline* outline, girara_tree_node_t* root)
-+build_index(fz_context* ctx, fz_document* document, fz_outline* outline, girara_tree_node_t* root)
- {
-   if (outline == NULL || root == NULL) {
-     return;
-@@ -50,49 +51,24 @@ build_index(fz_outline* outline, girara_tree_node_t* root)
-     zathura_link_type_t type               = ZATHURA_LINK_INVALID;
-     zathura_rectangle_t rect               = { .x1 = 0, .y1 = 0, .x2 = 0, .y2 = 0 };
- 
--    switch (outline->dest.kind) {
--      case FZ_LINK_NONE:
--        type = ZATHURA_LINK_NONE;
--        break;
--      case FZ_LINK_URI:
-+    if (fz_is_external_link(ctx, outline->uri) == 1) {
-+      if (strstr(outline->uri, "file://") == outline->uri) {
-+        type         = ZATHURA_LINK_GOTO_REMOTE;
-+        target.value = outline->uri;
-+      } else {
-         type         = ZATHURA_LINK_URI;
--        target.value = outline->dest.ld.uri.uri;
--        break;
--      case FZ_LINK_GOTO:
--        type                    = ZATHURA_LINK_GOTO_DEST;
--        target.page_number      = outline->dest.ld.gotor.page;
--        target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
--        target.left             = 0;
--        target.top              = 0;
--        target.scale            = 0.0;
--        {
--          int gflags = outline->dest.ld.gotor.flags;
--          if (gflags & fz_link_flag_l_valid) {
--            target.left = outline->dest.ld.gotor.lt.x;
--          }
--          if (gflags & fz_link_flag_t_valid) {
--            target.top = outline->dest.ld.gotor.lt.y;
--          }
--          /* if (gflags & fz_link_flag_r_is_zoom) { */
--          /*   target.scale = outline->dest.ld.gotor.rb.x; */
--          /* } */
--        }
--        break;
--      case FZ_LINK_LAUNCH:
--        type = ZATHURA_LINK_LAUNCH;
--        target.value = outline->dest.ld.launch.file_spec;
--        break;
--      case FZ_LINK_NAMED:
--        type = ZATHURA_LINK_NAMED;
--        target.value = outline->dest.ld.named.named;
--        break;
--      case FZ_LINK_GOTOR:
--        type = ZATHURA_LINK_GOTO_REMOTE;
--        target.value = outline->dest.ld.gotor.file_spec;
--        break;
--      default:
--        outline = outline->next; // TODO: Don't skip unknown type
--        continue;
-+        target.value = outline->uri;
-+      }
-+    } else {
-+      float x = 0;
-+      float y = 0;
-+
-+      type                    = ZATHURA_LINK_GOTO_DEST;
-+      target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
-+      target.page_number      = fz_resolve_link(ctx, document, outline->uri, &x, &y);
-+      target.left  = x;
-+      target.top   = y;
-+      target.scale = 0.0;
-     }
- 
-     index_element->link = zathura_link_new(type, rect, target);
-@@ -104,7 +80,7 @@ build_index(fz_outline* outline, girara_tree_node_t* root)
-     girara_tree_node_t* node = girara_node_append_data(root, index_element);
- 
-     if (outline->down != NULL) {
--      build_index(outline->down, node);
-+      build_index(ctx, document, outline->down, node);
-     }
- 
-     outline = outline->next;
-diff --git a/links.c b/links.c
-index a947802..7423af2 100644
---- a/links.c
-+++ b/links.c
-@@ -43,59 +43,31 @@ pdf_page_links_get(zathura_page_t* page, mupdf_page_t* mupdf_page, zathura_error
-     zathura_link_type_t type     = ZATHURA_LINK_INVALID;
-     zathura_link_target_t target = { 0 };
- 
--    char* buffer = NULL;
--    switch (link->dest.kind) {
--      case FZ_LINK_NONE:
--        type = ZATHURA_LINK_NONE;
--        break;
--      case FZ_LINK_URI:
-+    if (fz_is_external_link(mupdf_document->ctx, link->uri) == 1) {
-+      if (strstr(link->uri, "file://") == link->uri) {
-+        type         = ZATHURA_LINK_GOTO_REMOTE;
-+        target.value = link->uri;
-+      } else {
-         type         = ZATHURA_LINK_URI;
--        target.value = link->dest.ld.uri.uri;
--        break;
--      case FZ_LINK_GOTO:
--        type                    = ZATHURA_LINK_GOTO_DEST;
--        target.page_number      = link->dest.ld.gotor.page;
--        target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
--        target.left             = 0;
--        target.top              = 0;
--        target.scale            = 0.0;
--        {
--          int gflags = link->dest.ld.gotor.flags;
--          if (gflags & fz_link_flag_l_valid) {
--            target.left = link->dest.ld.gotor.lt.x;
--          }
--          if (gflags & fz_link_flag_t_valid) {
--            target.top = link->dest.ld.gotor.lt.y;
--          }
--          /* if (gflags & fz_link_flag_r_is_zoom) { */
--          /*   target.scale = link->dest.ld.gotor.rb.x; */
--          /* } */
--        }
--        break;
--      case FZ_LINK_LAUNCH:
--        type = ZATHURA_LINK_LAUNCH;
--        target.value = link->dest.ld.launch.file_spec;
--        break;
--      case FZ_LINK_NAMED:
--        type = ZATHURA_LINK_NAMED;
--        target.value = link->dest.ld.named.named;
--        break;
--      case FZ_LINK_GOTOR:
--        type = ZATHURA_LINK_GOTO_REMOTE;
--        target.value = link->dest.ld.gotor.file_spec;
--        break;
--      default:
--        continue;
-+        target.value = link->uri;
-+      }
-+    } else {
-+      float x = 0;
-+      float y = 0;
-+
-+      type                    = ZATHURA_LINK_GOTO_DEST;
-+      target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
-+      target.page_number      = fz_resolve_link(mupdf_document->ctx,
-+          mupdf_document->document, link->uri, &x, &y);
-+      target.left  = x;
-+      target.top   = y;
-+      target.scale = 0.0;
-     }
- 
-     zathura_link_t* zathura_link = zathura_link_new(type, position, target);
-     if (zathura_link != NULL) {
-       girara_list_append(list, zathura_link);
-     }
--
--    if (buffer != NULL) {
--      g_free(buffer);
--    }
-   }
- 
-   return list;
-diff --git a/page.c b/page.c
-index 219fc2a..5302cb5 100644
---- a/page.c
-+++ b/page.c
-@@ -43,7 +43,9 @@ pdf_page_init(zathura_page_t* page)
-   /* setup text */
-   mupdf_page->extracted_text = false;
- 
--  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
-+  fz_rect mediabox;
-+  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx,
-+      fz_bound_page(mupdf_page->ctx, mupdf_page->page, &mediabox));
-   if (mupdf_page->text == NULL) {
-     goto error_free;
-   }
-diff --git a/render.c b/render.c
-index 2a92a23..00adb83 100644
---- a/render.c
-+++ b/render.c
-@@ -20,7 +20,7 @@ pdf_page_render_to_buffer(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_
-     return ZATHURA_ERROR_UNKNOWN;
-   }
- 
--  fz_display_list* display_list = fz_new_display_list(mupdf_page->ctx);
-+  fz_display_list* display_list = fz_new_display_list(mupdf_page->ctx, NULL);
-   fz_device* device             = fz_new_list_device(mupdf_page->ctx, display_list);
- 
-   fz_try (mupdf_document->ctx) {
-@@ -37,10 +37,10 @@ pdf_page_render_to_buffer(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_
-   fz_rect rect = { .x1 = page_width, .y1 = page_height };
- 
-   fz_colorspace* colorspace = fz_device_bgr(mupdf_document->ctx);
--  fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx, colorspace, &irect, image);
-+  fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx, colorspace, &irect, 1, image);
-   fz_clear_pixmap_with_value(mupdf_page->ctx, pixmap, 0xFF);
- 
--  device = fz_new_draw_device(mupdf_page->ctx, pixmap);
-+  device = fz_new_draw_device(mupdf_page->ctx, NULL, pixmap);
-   fz_run_display_list(mupdf_page->ctx, display_list, device, &fz_identity, &rect, NULL);
-   fz_drop_device(mupdf_page->ctx, device);
- 
-diff --git a/utils.c b/utils.c
-index a4b9320..648187a 100644
---- a/utils.c
-+++ b/utils.c
-@@ -14,7 +14,7 @@ mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_pa
-   fz_device* text_device = NULL;
- 
-   fz_try (mupdf_page->ctx) {
--    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
-+    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text, NULL);
- 
-     /* Disable FZ_IGNORE_IMAGE to collect image blocks */
-     fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);
---
-libgit2 0.24.0
-

Copied: zathura-pdf-mupdf/repos/community-x86_64/mupdf-1.9.patch (from rev 198209, zathura-pdf-mupdf/trunk/mupdf-1.9.patch)
===================================================================
--- community-x86_64/mupdf-1.9.patch	                        (rev 0)
+++ community-x86_64/mupdf-1.9.patch	2016-12-06 14:43:33 UTC (rev 198210)
@@ -0,0 +1,151 @@
+From 368e80b59a7b2f330ad9bd7de45c350c6fbb2209 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail at eworm.de>
+Date: Mon, 18 Apr 2016 15:23:07 +0200
+Subject: [PATCH 1/1] update API for mupdf 1.9
+
+Signed-off-by: Christian Hesse <mail at eworm.de>
+---
+ AUTHORS    | 1 +
+ config.mk  | 2 +-
+ document.c | 6 +++---
+ image.c    | 2 +-
+ page.c     | 8 ++++----
+ plugin.h   | 4 ++--
+ search.c   | 2 +-
+ utils.c    | 2 +-
+ 8 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index f5f8430..371ebf1 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -5,5 +5,6 @@ Sebastian Ramacher <s.ramacher at gmx.at>
+ 
+ Other contributors are (in alphabetical order):
+ 
++Christian Hesse <mail at eworm.de>
+ Pavel Borzenkov <pavel.borzenkov at gmail.com>
+ William Skeith <wes at cs.ccny.cuny.edu>
+diff --git a/config.mk b/config.mk
+index cba8d40..6407ae6 100644
+--- a/config.mk
++++ b/config.mk
+@@ -32,7 +32,7 @@ endif
+ OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
+ OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
+ 
+-MUPDF_LIB ?= -lmupdf -lmujs
++MUPDF_LIB ?= -lmupdf -lmupdfthird
+ 
+ INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
+ LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
+diff --git a/document.c b/document.c
+index 873866c..548f4ff 100644
+--- a/document.c
++++ b/document.c
+@@ -109,12 +109,12 @@ pdf_document_save_as(zathura_document_t* document, mupdf_document_t*
+   }
+ 
+   fz_try (mupdf_document->ctx) {
+-    /* fz_write_document claims to accepts NULL as third argument but doesn't.
++    /* pdf_save_document claims to accepts NULL as third argument but doesn't.
+      * pdf_write_document does not check if the third arguments is NULL for some
+      * options. */
+ 
+-    fz_write_options opts = { 0 }; /* just use the default options */
+-    fz_write_document(mupdf_document->ctx, mupdf_document->document, (char*) path, &opts);
++    pdf_write_options opts = { 0 }; /* just use the default options */
++    pdf_save_document(mupdf_document->ctx, (pdf_document*) mupdf_document->document, (char*) path, &opts);
+   } fz_catch (mupdf_document->ctx) {
+     return ZATHURA_ERROR_UNKNOWN;
+   }
+diff --git a/image.c b/image.c
+index 97d4143..8f6912b 100644
+--- a/image.c
++++ b/image.c
+@@ -93,7 +93,7 @@ pdf_page_image_get_cairo(zathura_page_t* page, mupdf_page_t* mupdf_page,
+   fz_pixmap* pixmap = NULL;
+   cairo_surface_t* surface = NULL;
+ 
+-  pixmap = fz_new_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
++  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
+   if (pixmap == NULL) {
+     goto error_free;
+   }
+diff --git a/page.c b/page.c
+index beb0351..219fc2a 100644
+--- a/page.c
++++ b/page.c
+@@ -43,12 +43,12 @@ pdf_page_init(zathura_page_t* page)
+   /* setup text */
+   mupdf_page->extracted_text = false;
+ 
+-  mupdf_page->text = fz_new_text_page(mupdf_page->ctx);
++  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
+   if (mupdf_page->text == NULL) {
+     goto error_free;
+   }
+ 
+-  mupdf_page->sheet = fz_new_text_sheet(mupdf_page->ctx);
++  mupdf_page->sheet = fz_new_stext_sheet(mupdf_page->ctx);
+   if (mupdf_page->sheet == NULL) {
+     goto error_free;
+   }
+@@ -74,11 +74,11 @@ pdf_page_clear(zathura_page_t* page, mupdf_page_t* mupdf_page)
+ 
+   if (mupdf_page != NULL) {
+     if (mupdf_page->text != NULL) {
+-      fz_drop_text_page(mupdf_page->ctx, mupdf_page->text);
++      fz_drop_stext_page(mupdf_page->ctx, mupdf_page->text);
+     }
+ 
+     if (mupdf_page->sheet != NULL) {
+-      fz_drop_text_sheet(mupdf_page->ctx, mupdf_page->sheet);
++      fz_drop_stext_sheet(mupdf_page->ctx, mupdf_page->sheet);
+     }
+ 
+     if (mupdf_page->page != NULL) {
+diff --git a/plugin.h b/plugin.h
+index f2fb4a0..84c5e53 100644
+--- a/plugin.h
++++ b/plugin.h
+@@ -21,8 +21,8 @@ typedef struct mupdf_page_s
+ {
+   fz_page* page; /**< Reference to the mupdf page */
+   fz_context* ctx; /**< Context */
+-  fz_text_sheet* sheet; /**< Text sheet */
+-  fz_text_page* text; /**< Page text */
++  fz_stext_sheet* sheet; /**< Text sheet */
++  fz_stext_page* text; /**< Page text */
+   fz_rect bbox; /**< Bbox */
+   bool extracted_text; /**< If text has already been extracted */
+ } mupdf_page_t;
+diff --git a/search.c b/search.c
+index 3a9fad4..c672b9f 100644
+--- a/search.c
++++ b/search.c
+@@ -40,7 +40,7 @@ pdf_page_search_text(zathura_page_t* page, mupdf_page_t* mupdf_page, const char*
+   }
+ 
+   fz_rect* hit_bbox = fz_malloc_array(mupdf_page->ctx, N_SEARCH_RESULTS, sizeof(fz_rect));
+-  int num_results = fz_search_text_page(mupdf_page->ctx, mupdf_page->text,
++  int num_results = fz_search_stext_page(mupdf_page->ctx, mupdf_page->text,
+       (char*) text, hit_bbox, N_SEARCH_RESULTS);
+ 
+   for (int i = 0; i < num_results; i++) {
+diff --git a/utils.c b/utils.c
+index 4a003b9..a4b9320 100644
+--- a/utils.c
++++ b/utils.c
+@@ -14,7 +14,7 @@ mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t* mupdf_pa
+   fz_device* text_device = NULL;
+ 
+   fz_try (mupdf_page->ctx) {
+-    text_device = fz_new_text_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
++    text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
+ 
+     /* Disable FZ_IGNORE_IMAGE to collect image blocks */
+     fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);
+-- 
+2.8.0
+



More information about the arch-commits mailing list