summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/mupdf-build-with-openjpeg-2.1.patch38
-rw-r--r--gnu/packages/pdf.scm26
3 files changed, 59 insertions, 6 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index eab58f6223..515ca352a8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -681,6 +681,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/mplayer2-theora-fix.patch		\
   %D%/packages/patches/module-init-tools-moduledir.patch	\
   %D%/packages/patches/mumps-build-parallelism.patch		\
+  %D%/packages/patches/mupdf-build-with-openjpeg-2.1.patch	\
   %D%/packages/patches/mupdf-CVE-2016-6265.patch		\
   %D%/packages/patches/mupdf-CVE-2016-6525.patch		\
   %D%/packages/patches/mupen64plus-ui-console-notice.patch	\
diff --git a/gnu/packages/patches/mupdf-build-with-openjpeg-2.1.patch b/gnu/packages/patches/mupdf-build-with-openjpeg-2.1.patch
new file mode 100644
index 0000000000..cd8136b701
--- /dev/null
+++ b/gnu/packages/patches/mupdf-build-with-openjpeg-2.1.patch
@@ -0,0 +1,38 @@
+Make it possible to build MuPDF with OpenJPEG 2.1, which is the latest
+release series and contains many important bug fixes.
+
+Patch adapted from Debian:
+
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745246
+
+And related to this upstream commit:
+
+http://git.ghostscript.com/?p=mupdf.git;a=commit;h=f88bfe2e62dbadb96d4f52d7aa025f0a516078da
+
+diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c
+index 6b92e5c..72dea50 100644
+--- a/source/fitz/load-jpx.c
++++ b/source/fitz/load-jpx.c
+@@ -1,13 +1,5 @@
+ #include "mupdf/fitz.h"
+ 
+-/* Without the definition of OPJ_STATIC, compilation fails on windows
+- * due to the use of __stdcall. We believe it is required on some
+- * linux toolchains too. */
+-#define OPJ_STATIC
+-#ifndef _MSC_VER
+-#define OPJ_HAVE_STDINT_H
+-#endif
+-
+ #include <openjpeg.h>
+ 
+ static void fz_opj_error_callback(const char *msg, void *client_data)
+@@ -117,7 +109,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs
+ 	opj_stream_set_read_function(stream, fz_opj_stream_read);
+ 	opj_stream_set_skip_function(stream, fz_opj_stream_skip);
+ 	opj_stream_set_seek_function(stream, fz_opj_stream_seek);
+-	opj_stream_set_user_data(stream, &sb);
++	opj_stream_set_user_data(stream, &sb, NULL);
+ 	/* Set the length to avoid an assert */
+ 	opj_stream_set_user_data_length(stream, size);
+ 
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 74e89070b8..98cc92e5a8 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -53,6 +53,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages javascript)
   #:use-module (srfi srfi-1))
 
 (define-public poppler
@@ -466,29 +467,42 @@ extracting content or merging files.")
 (define-public mupdf
   (package
     (name "mupdf")
-    (version "1.8")
+    (version "1.9a")
     (source
       (origin
         (method url-fetch)
         (uri (string-append "http://mupdf.com/downloads/archive/"
                             name "-" version "-source.tar.gz"))
         (sha256
-          (base32 "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2"))
-        (patches (search-patches "mupdf-CVE-2016-6265.patch"
+         (base32
+          "1k64pdapyj8a336jw3j61fhn0rp4q6az7d0dqp9r5n3d9rgwa5c0"))
+        (patches (search-patches "mupdf-build-with-openjpeg-2.1.patch"
+                                 "mupdf-CVE-2016-6265.patch"
                                  "mupdf-CVE-2016-6525.patch"))
         (modules '((guix build utils)))
         (snippet
-            ;; Don't build the bundled-in third party libraries.
-            '(delete-file-recursively "thirdparty"))))
+            ;; Delete all the bundled libraries except for mujs, which is
+            ;; developed by the same team as mupdf and has no releases.
+            ;; TODO Package mujs and don't use the bundled copy.
+            '(for-each delete-file-recursively
+                       '("thirdparty/curl"
+                         "thirdparty/freetype"
+                         "thirdparty/glfw"
+                         "thirdparty/harfbuzz"
+                         "thirdparty/jbig2dec"
+                         "thirdparty/jpeg"
+                         "thirdparty/openjpeg"
+                         "thirdparty/zlib")))))
     (build-system gnu-build-system)
     (inputs
       `(("curl" ,curl)
         ("freetype" ,freetype)
+        ("harfbuzz" ,harfbuzz)
         ("jbig2dec" ,jbig2dec)
         ("libjpeg" ,libjpeg)
         ("libx11" ,libx11)
         ("libxext" ,libxext)
-        ("openjpeg" ,openjpeg-2.0)
+        ("openjpeg" ,openjpeg)
         ("openssl" ,openssl)
         ("zlib" ,zlib)))
     (native-inputs