pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
zathura-pdf-mupdf: Import zathura-pdf-mupdf-0.3.3 as wip/zathura-pdf-mupdf
Module Name: pkgsrc-wip
Committed By: Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By: leot
Date: Thu Sep 27 12:50:52 2018 +0200
Changeset: a352763d1233835153e3c82f124d8bcf0e58acf2
Modified Files:
Makefile
Added Files:
zathura-pdf-mupdf/DESCR
zathura-pdf-mupdf/Makefile
zathura-pdf-mupdf/PLIST
zathura-pdf-mupdf/TODO
zathura-pdf-mupdf/distinfo
zathura-pdf-mupdf/patches/patch-document.c
zathura-pdf-mupdf/patches/patch-meson.build
zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_page.c
zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_render.c
zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_search.c
zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_utils.c
Log Message:
zathura-pdf-mupdf: Import zathura-pdf-mupdf-0.3.3 as wip/zathura-pdf-mupdf
The zathura-pdf-mupdf plugin adds PDF support to zathura by using the
mupdf rendering library.
Based on print/zathura-pdf-mupdf and intended to be used to update it.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=a352763d1233835153e3c82f124d8bcf0e58acf2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
Makefile | 1 +
zathura-pdf-mupdf/DESCR | 2 +
zathura-pdf-mupdf/Makefile | 31 +++++++++++++++
zathura-pdf-mupdf/PLIST | 4 ++
zathura-pdf-mupdf/TODO | 6 +++
zathura-pdf-mupdf/distinfo | 12 ++++++
zathura-pdf-mupdf/patches/patch-document.c | 25 ++++++++++++
zathura-pdf-mupdf/patches/patch-meson.build | 15 +++++++
.../patches/patch-zathura-pdf-mupdf_page.c | 23 +++++++++++
.../patches/patch-zathura-pdf-mupdf_render.c | 46 ++++++++++++++++++++++
.../patches/patch-zathura-pdf-mupdf_search.c | 31 +++++++++++++++
.../patches/patch-zathura-pdf-mupdf_utils.c | 18 +++++++++
12 files changed, 214 insertions(+)
diffs:
diff --git a/Makefile b/Makefile
index f8f5486284..2bb594fa53 100644
--- a/Makefile
+++ b/Makefile
@@ -4857,6 +4857,7 @@ SUBDIR+= ypbind-mt
SUBDIR+= ypserv
SUBDIR+= zapping
SUBDIR+= zathura
+SUBDIR+= zathura-pdf-mupdf
SUBDIR+= zbackup
SUBDIR+= zbar
SUBDIR+= zenity
diff --git a/zathura-pdf-mupdf/DESCR b/zathura-pdf-mupdf/DESCR
new file mode 100644
index 0000000000..3c71cd55c5
--- /dev/null
+++ b/zathura-pdf-mupdf/DESCR
@@ -0,0 +1,2 @@
+The zathura-pdf-mupdf plugin adds PDF support to zathura by using the
+mupdf rendering library.
diff --git a/zathura-pdf-mupdf/Makefile b/zathura-pdf-mupdf/Makefile
new file mode 100644
index 0000000000..5980a1d0dc
--- /dev/null
+++ b/zathura-pdf-mupdf/Makefile
@@ -0,0 +1,31 @@
+# $NetBSD: Makefile,v 1.27 2018/08/16 18:55:09 adam Exp $
+#
+
+DISTNAME= zathura-pdf-mupdf-0.3.3
+CATEGORIES= print
+MASTER_SITES= https://pwmt.org/projects/zathura/plugins/download/
+EXTRACT_SUFX= .tar.xz
+
+MAINTAINER= leot%NetBSD.org@localhost
+HOMEPAGE= https://pwmt.org/projects/zathura-pdf-mupdf/
+COMMENT= Add PDF support to zathura using mupdf rendering engine
+LICENSE= zlib
+
+CONFLICTS+= zathura-pdf-poppler-[0-9]*
+
+USE_TOOLS+= pkg-config
+
+#TOOL_DEPENDS+= gettext-tools>=0.15:../../devel/gettext-tools
+#TOOL_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
+
+CPPFLAGS+= -D_XOPEN_SOURCE=600
+
+MAKE_ENV+= MUPDF_LIB="-lmupdf"
+
+.include "../../devel/py-meson/build.mk"
+.include "../../graphics/cairo/buildlink3.mk"
+.include "../../wip/mupdf/buildlink3.mk"
+.include "../../wip/zathura/buildlink3.mk"
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../x11/gtk3/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/zathura-pdf-mupdf/PLIST b/zathura-pdf-mupdf/PLIST
new file mode 100644
index 0000000000..29e85f9432
--- /dev/null
+++ b/zathura-pdf-mupdf/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD$
+lib/zathura/libpdf-mupdf.so
+share/applications/org.pwmt.zathura-pdf-mupdf.desktop
+share/metainfo/org.pwmt.zathura-pdf-mupdf.metainfo.xml
diff --git a/zathura-pdf-mupdf/TODO b/zathura-pdf-mupdf/TODO
new file mode 100644
index 0000000000..ade1c78979
--- /dev/null
+++ b/zathura-pdf-mupdf/TODO
@@ -0,0 +1,6 @@
+Fail at run time with:
+
+ % zathura
+ error: Could not load plugin '/usr/pkg/lib/zathura/libpdf-mupdf.so' (/usr/pkg/lib/libmupdf.so.0: Undefined PLT symbol "opj_stream_set_user_data" (symnum = 83)).
+
+Investigate that!
diff --git a/zathura-pdf-mupdf/distinfo b/zathura-pdf-mupdf/distinfo
new file mode 100644
index 0000000000..b2c7f4c5b0
--- /dev/null
+++ b/zathura-pdf-mupdf/distinfo
@@ -0,0 +1,12 @@
+$NetBSD: distinfo,v 1.8 2018/01/07 13:01:32 leot Exp $
+
+SHA1 (zathura-pdf-mupdf-0.3.3.tar.xz) = a9165f6aec134de86d6ee5c1a2ed5f1aa8f7d0b3
+RMD160 (zathura-pdf-mupdf-0.3.3.tar.xz) = e66539794f0fb5cc341c485164142eceb3815f89
+SHA512 (zathura-pdf-mupdf-0.3.3.tar.xz) = cac3ccf4f85c689d44095966fbee84efac76d7c72915a06a85da272663eb3f11b053baf06a24e79e2fc89a57d05fa2f3c1df199e9e1415a3bfa65f3309227faf
+Size (zathura-pdf-mupdf-0.3.3.tar.xz) = 7880 bytes
+SHA1 (patch-document.c) = b7d3c8c23148f7eb5f034586c2da4995a5cf2b5d
+SHA1 (patch-meson.build) = 44b4760c088089b963982fad598f9f27b985c695
+SHA1 (patch-zathura-pdf-mupdf_page.c) = 396873c5bfd9597587ca2f8c4881ce4ad2d47777
+SHA1 (patch-zathura-pdf-mupdf_render.c) = 121f5b7c1264f67466aa9676e499b7a8636483d5
+SHA1 (patch-zathura-pdf-mupdf_search.c) = 9d21523e2768436fe2e00bc4765d21643d996c0c
+SHA1 (patch-zathura-pdf-mupdf_utils.c) = d6bcc73150f691816ccf6578be71ee7319f8024b
diff --git a/zathura-pdf-mupdf/patches/patch-document.c b/zathura-pdf-mupdf/patches/patch-document.c
new file mode 100644
index 0000000000..3bde10d3ff
--- /dev/null
+++ b/zathura-pdf-mupdf/patches/patch-document.c
@@ -0,0 +1,25 @@
+$NetBSD: patch-document.c,v 1.4 2017/01/31 10:12:02 leot Exp $
+
+- Correct the glib-2.0 include header file path.
+- Port to mupdf-1.14.0
+
+--- zathura-pdf-mupdf/document.c.orig 2018-03-17 19:47:01.000000000 +0000
++++ zathura-pdf-mupdf/document.c
+@@ -3,7 +3,7 @@
+ #include <mupdf/fitz.h>
+ #include <mupdf/pdf.h>
+
+-#include <glib-2.0/glib.h>
++#include <glib.h>
+
+ #include "plugin.h"
+
+@@ -138,7 +138,7 @@ pdf_document_get_information(zathura_doc
+
+ fz_try (mupdf_document->ctx) {
+ pdf_obj* trailer = pdf_trailer(mupdf_document->ctx, (pdf_document*) mupdf_document->document);
+- pdf_obj* info_dict = pdf_dict_get(mupdf_document->ctx, trailer, PDF_NAME_Info);
++ pdf_obj* info_dict = pdf_dict_get(mupdf_document->ctx, trailer, PDF_NAME(Info));
+
+ /* get string values */
+ typedef struct info_value_s {
diff --git a/zathura-pdf-mupdf/patches/patch-meson.build b/zathura-pdf-mupdf/patches/patch-meson.build
new file mode 100644
index 0000000000..1a1e4bcd6b
--- /dev/null
+++ b/zathura-pdf-mupdf/patches/patch-meson.build
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Adjust library name of mupdf-third for mupdf>=1.14.0.
+
+--- meson.build.orig 2018-03-17 19:47:01.000000000 +0000
++++ meson.build
+@@ -20,7 +20,7 @@ girara = dependency('girara-gtk3')
+ glib = dependency('glib-2.0')
+ cairo = dependency('cairo')
+ mupdf = cc.find_library('mupdf')
+-mupdfthird = cc.find_library('mupdfthird')
++mupdfthird = cc.find_library('mupdf-third')
+
+ build_dependencies = [zathura, girara, glib, cairo, mupdf, mupdfthird]
+
diff --git a/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_page.c b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_page.c
new file mode 100644
index 0000000000..d469ce4b31
--- /dev/null
+++ b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_page.c
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Port to mupdf-1.14.0
+
+--- zathura-pdf-mupdf/page.c.orig 2018-03-17 19:47:01.000000000 +0000
++++ zathura-pdf-mupdf/page.c
+@@ -30,14 +30,13 @@ pdf_page_init(zathura_page_t* page)
+ goto error_free;
+ }
+
+- fz_bound_page(mupdf_document->ctx, (fz_page*) mupdf_page->page, &mupdf_page->bbox);
++ fz_bound_page(mupdf_document->ctx, (fz_page*) mupdf_page->page);
+
+ /* setup text */
+ mupdf_page->extracted_text = false;
+
+- fz_rect mediabox;
+ mupdf_page->text = fz_new_stext_page(mupdf_page->ctx,
+- fz_bound_page(mupdf_page->ctx, mupdf_page->page, &mediabox));
++ fz_bound_page(mupdf_page->ctx, mupdf_page->page));
+ if (mupdf_page->text == NULL) {
+ goto error_free;
+ }
diff --git a/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_render.c b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_render.c
new file mode 100644
index 0000000000..6c5933c8ac
--- /dev/null
+++ b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_render.c
@@ -0,0 +1,46 @@
+$NetBSD$
+
+Port to mupdf-1.14.0
+
+--- zathura-pdf-mupdf/render.c.orig 2018-03-17 19:47:01.000000000 +0000
++++ zathura-pdf-mupdf/render.c
+@@ -18,13 +18,15 @@ pdf_page_render_to_buffer(mupdf_document
+ return ZATHURA_ERROR_UNKNOWN;
+ }
+
+- fz_display_list* display_list = fz_new_display_list(mupdf_page->ctx, NULL);
++ fz_irect irect = { .x1 = page_width, .y1 = page_height };
++ fz_rect rect = { .x1 = page_width, .y1 = page_height };
++
++ fz_display_list* display_list = fz_new_display_list(mupdf_page->ctx, rect);
+ fz_device* device = fz_new_list_device(mupdf_page->ctx, display_list);
+
+ fz_try (mupdf_document->ctx) {
+- fz_matrix m;
+- fz_scale(&m, scalex, scaley);
+- fz_run_page(mupdf_document->ctx, mupdf_page->page, device, &m, NULL);
++ fz_scale(scalex, scaley);
++ fz_run_page(mupdf_document->ctx, mupdf_page->page, device, fz_identity, NULL);
+ } fz_catch (mupdf_document->ctx) {
+ return ZATHURA_ERROR_UNKNOWN;
+ }
+@@ -32,16 +34,13 @@ pdf_page_render_to_buffer(mupdf_document
+ fz_close_device(mupdf_page->ctx, device);
+ fz_drop_device(mupdf_page->ctx, device);
+
+- fz_irect irect = { .x1 = page_width, .y1 = page_height };
+- fz_rect rect = { .x1 = page_width, .y1 = page_height };
+-
+ fz_colorspace* colorspace = fz_device_bgr(mupdf_document->ctx);
+ fz_separations* seps= fz_page_separations(mupdf_page->ctx, mupdf_page->page);
+- fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx, colorspace, &irect, seps, 1, image);
++ fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx, colorspace, irect, seps, 1, image);
+ fz_clear_pixmap_with_value(mupdf_page->ctx, pixmap, 0xFF);
+
+- device = fz_new_draw_device(mupdf_page->ctx, NULL, pixmap);
+- fz_run_display_list(mupdf_page->ctx, display_list, device, &fz_identity, &rect, NULL);
++ device = fz_new_draw_device(mupdf_page->ctx, fz_identity, pixmap);
++ fz_run_display_list(mupdf_page->ctx, display_list, device, fz_identity, rect, NULL);
+ fz_close_device(mupdf_page->ctx, device);
+ fz_drop_device(mupdf_page->ctx, device);
+
diff --git a/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_search.c b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_search.c
new file mode 100644
index 0000000000..6f53e1a6ac
--- /dev/null
+++ b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_search.c
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Port to mupdf-1.14.0
+
+--- zathura-pdf-mupdf/search.c.orig 2018-03-17 19:47:01.000000000 +0000
++++ zathura-pdf-mupdf/search.c
+@@ -39,17 +39,19 @@ pdf_page_search_text(zathura_page_t* pag
+ mupdf_page_extract_text(mupdf_document, mupdf_page);
+ }
+
+- fz_rect* hit_bbox = fz_malloc_array(mupdf_page->ctx, N_SEARCH_RESULTS, sizeof(fz_rect));
++ fz_quad* hit_bbox = fz_malloc_array(mupdf_page->ctx, N_SEARCH_RESULTS, sizeof(fz_quad));
+ int num_results = fz_search_stext_page(mupdf_page->ctx, mupdf_page->text,
+ text, hit_bbox, N_SEARCH_RESULTS);
+
++ fz_rect r;
+ for (int i = 0; i < num_results; i++) {
+ zathura_rectangle_t* rectangle = g_malloc0(sizeof(zathura_rectangle_t));
+
+- rectangle->x1 = hit_bbox[i].x0;
+- rectangle->x2 = hit_bbox[i].x1;
+- rectangle->y1 = hit_bbox[i].y0;
+- rectangle->y2 = hit_bbox[i].y1;
++ r = fz_rect_from_quad(hit_bbox[i]);
++ rectangle->x1 = r.x0;
++ rectangle->x2 = r.x1;
++ rectangle->y1 = r.y0;
++ rectangle->y2 = r.y1;
+
+ girara_list_append(list, rectangle);
+ }
diff --git a/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_utils.c b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_utils.c
new file mode 100644
index 0000000000..11e47ef99a
--- /dev/null
+++ b/zathura-pdf-mupdf/patches/patch-zathura-pdf-mupdf_utils.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Port to mupdf-1.14.0
+
+--- zathura-pdf-mupdf/utils.c.orig 2018-03-17 19:47:01.000000000 +0000
++++ zathura-pdf-mupdf/utils.c
+@@ -17,9 +17,8 @@ mupdf_page_extract_text(mupdf_document_t
+ /* Disable FZ_DONT_INTERPOLATE_IMAGES to collect image blocks */
+ fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_DONT_INTERPOLATE_IMAGES);
+
+- fz_matrix ctm;
+- fz_scale(&ctm, 1.0, 1.0);
+- fz_run_page(mupdf_page->ctx, mupdf_page->page, text_device, &ctm, NULL);
++ fz_scale(1.0, 1.0);
++ fz_run_page(mupdf_page->ctx, mupdf_page->page, text_device, fz_identity, NULL);
+ } fz_always (mupdf_document->ctx) {
+ fz_close_device(mupdf_page->ctx, text_device);
+ fz_drop_device(mupdf_page->ctx, text_device);
Home |
Main Index |
Thread Index |
Old Index