diff options
-rw-r--r-- | office/fbpdf/fbpdf.SlackBuild | 19 | ||||
-rw-r--r-- | office/fbpdf/mupdf-1.7a.diff | 65 |
2 files changed, 79 insertions, 5 deletions
diff --git a/office/fbpdf/fbpdf.SlackBuild b/office/fbpdf/fbpdf.SlackBuild index 02891669f2a46..33b522be1a67a 100644 --- a/office/fbpdf/fbpdf.SlackBuild +++ b/office/fbpdf/fbpdf.SlackBuild @@ -10,7 +10,7 @@ PRGNAM=fbpdf VERSION=${VERSION:-20140822} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -57,9 +57,13 @@ find -L . \ # This patch has been sent upstream. In my opinion, fbpdf is needlessly # difficult to use without it. +# ...a year later, and upstream never responded to my email (not even to +# say "no"). It's staying here though. [ "${PRISTINE:-no}" != "yes" ] && \ patch -p1 < $CWD/navigation.diff +# mupdf API keeps changing + sed -i \ -e 's,-lmupdf -lmujs,`pkg-config --libs mupdf`,' \ -e 's,-lopenjpeg,-lopenjp2,' \ @@ -72,11 +76,16 @@ make ${PRGNAM}2 fbdjvu install -s -m0755 ${PRGNAM}2 $PKG/usr/bin install -s -m0755 fbdjvu $PKG/usr/bin -# autodetect mupdf. -pkg-config --exists mupdf && \ - make clean && \ - make $PRGNAM && \ +# autodetect mupdf, apply patch if needed. +if pkg-config --exists mupdf; then + MUPDFVER="$( pkg-config --modversion mupdf 2>/dev/null | \ + sed 's,^[0-9]*\.\([0-9][0-9]*\).*,\1,' )" + [ "$MUPDFVER" != "" -a "$MUPDFVER" -gt "6" ] && + patch -p1 < $CWD/mupdf-1.7a.diff + make clean + make $PRGNAM install -s -m0755 $PRGNAM $PKG/usr/bin +fi # man page written for this build. mkdir -p $PKG/usr/man/man1 diff --git a/office/fbpdf/mupdf-1.7a.diff b/office/fbpdf/mupdf-1.7a.diff new file mode 100644 index 0000000000000..b51d4141c3d4d --- /dev/null +++ b/office/fbpdf/mupdf-1.7a.diff @@ -0,0 +1,65 @@ +diff -Naur fbpdf-20140822/mupdf.c fbpdf-20140822.patched/mupdf.c +--- fbpdf-20140822/mupdf.c 2014-08-21 21:12:00.000000000 -0400 ++++ fbpdf-20140822.patched/mupdf.c 2015-09-12 03:24:40.000000000 -0400 +@@ -23,11 +23,11 @@ + int h, w; + int x, y; + +- if (!(page = fz_load_page(doc->pdf, p - 1))) ++ if (!(page = fz_load_page(doc->ctx, doc->pdf, p - 1))) + return 1; + fz_rotate(&ctm, rotate); + fz_pre_scale(&ctm, (float) zoom / 10, (float) zoom / 10); +- fz_bound_page(doc->pdf, page, &rect); ++ fz_bound_page(doc->ctx, page, &rect); + fz_transform_rect(&rect, &ctm); + fz_round_rect(&bbox, &rect); + w = MIN_(*cols, rect.x1 - rect.x0); +@@ -37,8 +37,8 @@ + fz_clear_pixmap_with_value(doc->ctx, pix, 0xff); + + dev = fz_new_draw_device(doc->ctx, pix); +- fz_run_page(doc->pdf, page, dev, &ctm, NULL); +- fz_free_device(dev); ++ fz_run_page(doc->ctx, page, dev, &ctm, NULL); ++ fz_drop_device(doc->ctx, dev); + + for (y = 0; y < h; y++) { + int xs = y * *cols + (*cols - w) / 2; +@@ -50,7 +50,7 @@ + } + } + fz_drop_pixmap(doc->ctx, pix); +- fz_free_page(doc->pdf, page); ++ fz_drop_page(doc->ctx, page); + *cols = w; + *rows = h; + return 0; +@@ -58,7 +58,7 @@ + + int doc_pages(struct doc *doc) + { +- return fz_count_pages(doc->pdf); ++ return fz_count_pages(doc->ctx, doc->pdf); + } + + struct doc *doc_open(char *path) +@@ -69,7 +69,7 @@ + fz_try (doc->ctx) { + doc->pdf = fz_open_document(doc->ctx, path); + } fz_catch (doc->ctx) { +- fz_free_context(doc->ctx); ++ fz_drop_context(doc->ctx); + free(doc); + return NULL; + } +@@ -78,7 +78,7 @@ + + void doc_close(struct doc *doc) + { +- fz_close_document(doc->pdf); +- fz_free_context(doc->ctx); ++ fz_drop_document(doc->ctx, doc->pdf); ++ fz_drop_context(doc->ctx); + free(doc); + } |