gnu: mupdf: Fix CVE-2017-{14685,14686,14687}.
[jackhill/guix/guix.git] / gnu / packages / pdf.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
6 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
7 ;;; Coypright © 2016 ng0 <ng0@we.make.ritual.n0.is>
8 ;;; Coypright © 2016 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Coypright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Coypright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
11 ;;; Coypright © 2016 Julien Lepiller <julien@lepiller.eu>
12 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
13 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
14 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
15 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
16 ;;;
17 ;;; This file is part of GNU Guix.
18 ;;;
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
23 ;;;
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
28 ;;;
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32 (define-module (gnu packages pdf)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix utils)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system python)
40 #:use-module (guix build-system trivial)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages base)
44 #:use-module (gnu packages bash)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages game-development)
48 #:use-module (gnu packages ghostscript)
49 #:use-module (gnu packages gnupg)
50 #:use-module (gnu packages databases)
51 #:use-module (gnu packages djvu)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages backup)
54 #:use-module (gnu packages lesstif)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages xdisorg)
57 #:use-module (gnu packages imagemagick)
58 #:use-module (gnu packages gl)
59 #:use-module (gnu packages photo)
60 #:use-module (gnu packages image)
61 #:use-module (gnu packages pkg-config)
62 #:use-module (gnu packages qt)
63 #:use-module (gnu packages xorg)
64 #:use-module (gnu packages gnome)
65 #:use-module (gnu packages glib)
66 #:use-module (gnu packages gtk)
67 #:use-module (gnu packages lua)
68 #:use-module (gnu packages curl)
69 #:use-module (gnu packages pcre)
70 #:use-module (gnu packages perl)
71 #:use-module (gnu packages python)
72 #:use-module (gnu packages sdl)
73 #:use-module (gnu packages tls)
74 #:use-module (srfi srfi-1))
75
76 (define-public poppler
77 (package
78 (name "poppler")
79 (version "0.59.0")
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "https://poppler.freedesktop.org/poppler-"
83 version ".tar.xz"))
84 (sha256
85 (base32
86 "0hcnghliyr8pr887qza18qfgaclw5jr889g1cjcglkni9jr2dmm3"))))
87 (build-system gnu-build-system)
88 ;; FIXME:
89 ;; use libcurl: no
90 (inputs `(("fontconfig" ,fontconfig)
91 ("freetype" ,freetype)
92 ("libjpeg" ,libjpeg)
93 ("libpng" ,libpng)
94 ("libtiff" ,libtiff)
95 ("lcms" ,lcms)
96 ("openjpeg-1" ,openjpeg-1) ; prefers openjpeg-1
97 ("zlib" ,zlib)
98
99 ;; To build poppler-glib (as needed by Evince), we need Cairo and
100 ;; GLib. But of course, that Cairo must not depend on Poppler.
101 ("cairo" ,(package (inherit cairo)
102 (inputs (alist-delete "poppler"
103 (package-inputs cairo)))))
104 ("glib" ,glib)))
105 (native-inputs
106 `(("pkg-config" ,pkg-config)
107 ("glib" ,glib "bin") ; glib-mkenums, etc.
108 ("gobject-introspection" ,gobject-introspection)))
109 (arguments
110 `(#:tests? #f ; no test data provided with the tarball
111 #:configure-flags
112 '("--enable-xpdf-headers" ; to install header files
113 "--enable-zlib"
114
115 ;; Saves 8 MiB of .a files.
116 "--disable-static")
117 #:phases
118 (modify-phases %standard-phases
119 (add-before 'configure 'setenv
120 (lambda _
121 (setenv "CPATH"
122 (string-append (assoc-ref %build-inputs "openjpeg-1")
123 "/include/openjpeg-1.5"
124 ":" (or (getenv "CPATH") "")))
125 #t)))))
126 (synopsis "PDF rendering library")
127 (description
128 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
129 (license license:gpl2+)
130 (home-page "https://poppler.freedesktop.org/")))
131
132 (define-public poppler-qt4
133 (package (inherit poppler)
134 (name "poppler-qt4")
135 (inputs `(("qt-4" ,qt-4)
136 ,@(package-inputs poppler)))
137 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
138
139 (define-public poppler-qt5
140 (package (inherit poppler)
141 (name "poppler-qt5")
142 (inputs `(("qtbase" ,qtbase)
143 ,@(package-inputs poppler)))
144 (arguments
145 (substitute-keyword-arguments (package-arguments poppler)
146 ((#:configure-flags flags)
147 `(cons "CXXFLAGS=-std=gnu++11" ,flags))))
148 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
149
150 (define-public python-poppler-qt4
151 (package
152 (name "python-poppler-qt4")
153 (version "0.24.0")
154 (source
155 (origin
156 (method url-fetch)
157 (uri (string-append "https://pypi.python.org/packages/source/p"
158 "/python-poppler-qt4/python-poppler-qt4-"
159 version ".tar.gz"))
160 (sha256
161 (base32
162 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
163 (build-system python-build-system)
164 (arguments
165 `(#:phases
166 (modify-phases %standard-phases
167 (add-after
168 'unpack 'patch-poppler-include-paths
169 (lambda _
170 (substitute* (find-files "." "poppler-.*\\.sip")
171 (("qt4/poppler-.*\\.h" header)
172 (string-append "poppler/" header)))
173 #t)))))
174 (native-inputs
175 `(("pkg-config" ,pkg-config)))
176 (inputs
177 `(("python-sip" ,python-sip)
178 ("python-pyqt-4" ,python-pyqt-4)
179 ("poppler-qt4" ,poppler-qt4)))
180 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
181 (synopsis "Python bindings for Poppler-Qt4")
182 (description
183 "This package provides Python bindings for the Qt4 interface of the
184 Poppler PDF rendering library.")
185 (license license:lgpl2.1+)))
186
187 (define-public python-poppler-qt5
188 (package
189 (name "python-poppler-qt5")
190 (version "0.24.2")
191 (source
192 (origin
193 (method url-fetch)
194 (uri (pypi-uri "python-poppler-qt5" version))
195 (sha256
196 (base32
197 "0l69llw1fzwz8y90q0qp9q5pifbrqjjbwii7di54dwghw5fc6w1r"))))
198 (build-system python-build-system)
199 (arguments
200 `(;; There are no tests. The check phase just causes a rebuild.
201 #:tests? #f
202 #:phases
203 (modify-phases %standard-phases
204 (replace 'build
205 (lambda* (#:key inputs #:allow-other-keys)
206 (substitute* "setup.py"
207 ;; This check always fails, so disable it.
208 (("if not check_qtxml\\(\\)")
209 "if True")
210 ;; Enable C++11, which is needed because of Qt5.
211 (("\\*\\*ext_args" line)
212 (string-append "extra_compile_args=['-std=gnu++11'], " line)))
213 ;; We need to pass an extra flag here. This cannot be in
214 ;; configure-flags because it should not be passed for the
215 ;; installation phase.
216 ((@@ (guix build python-build-system) call-setuppy)
217 "build_ext" (list (string-append "--pyqt-sip-dir="
218 (assoc-ref inputs "python-pyqt")
219 "/share/sip")) #t))))))
220 (native-inputs
221 `(("pkg-config" ,pkg-config)))
222 (inputs
223 `(("python-sip" ,python-sip)
224 ("python-pyqt" ,python-pyqt)
225 ("poppler-qt5" ,poppler-qt5)
226 ("qtbase" ,qtbase)))
227 (home-page "https://pypi.python.org/pypi/python-poppler-qt5")
228 (synopsis "Python bindings for Poppler-Qt5")
229 (description
230 "This package provides Python bindings for the Qt5 interface of the
231 Poppler PDF rendering library.")
232 (license license:lgpl2.1+)))
233
234 (define-public libharu
235 (package
236 (name "libharu")
237 (version "2.3.0")
238 (source (origin
239 (method url-fetch)
240 (uri (string-append "https://github.com/libharu/libharu/archive/"
241 "RELEASE_"
242 (string-join (string-split version #\.) "_")
243 ".tar.gz"))
244 (file-name (string-append name "-" version ".tar.gz"))
245 (sha256
246 (base32
247 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
248 (build-system gnu-build-system)
249 (arguments
250 `(#:configure-flags
251 (list (string-append "--with-zlib="
252 (assoc-ref %build-inputs "zlib"))
253 (string-append "--with-png="
254 (assoc-ref %build-inputs "libpng")))
255 #:phases
256 (modify-phases %standard-phases
257 (add-after 'unpack 'autogen
258 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
259 (inputs
260 `(("zlib" ,zlib)
261 ("libpng" ,libpng)))
262 (native-inputs
263 `(("autoconf" ,autoconf)
264 ("automake" ,automake)
265 ("libtool" ,libtool)))
266 (home-page "http://libharu.org/")
267 (synopsis "Library for generating PDF files")
268 (description
269 "libHaru is a library for generating PDF files. libHaru does not support
270 reading and editing of existing PDF files.")
271 (license license:zlib)))
272
273 (define-public xpdf
274 (package
275 (name "xpdf")
276 (version "3.04")
277 (source (origin
278 (method url-fetch)
279 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
280 version ".tar.gz"))
281 (sha256 (base32
282 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
283 (build-system gnu-build-system)
284 (inputs `(("freetype" ,freetype)
285 ("gs-fonts" ,gs-fonts)
286 ("lesstif" ,lesstif)
287 ("libpaper" ,libpaper)
288 ("libx11" ,libx11)
289 ("libxext" ,libxext)
290 ("libxp" ,libxp)
291 ("libxpm" ,libxpm)
292 ("libxt" ,libxt)
293 ("libpng" ,libpng)
294 ("zlib" ,zlib)))
295 (arguments
296 `(#:tests? #f ; there is no check target
297 #:parallel-build? #f ; build fails randomly on 8-way machines
298 #:configure-flags
299 (list (string-append "--with-freetype2-includes="
300 (assoc-ref %build-inputs "freetype")
301 "/include/freetype2"))
302 #:phases
303 (modify-phases %standard-phases
304 (replace 'install
305 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
306 (let* ((install (assoc-ref %standard-phases 'install))
307 (out (assoc-ref outputs "out"))
308 (xpdfrc (string-append out "/etc/xpdfrc"))
309 (gs-fonts (assoc-ref inputs "gs-fonts")))
310 (apply install args)
311 (substitute* xpdfrc
312 (("/usr/local/share/ghostscript/fonts")
313 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
314 (("#fontFile") "fontFile")))
315 #t)))))
316 (synopsis "Viewer for PDF files based on the Motif toolkit")
317 (description
318 "Xpdf is a viewer for Portable Document Format (PDF) files.")
319 (license license:gpl3) ; or gpl2, but not gpl2+
320 (home-page "http://www.foolabs.com/xpdf/")))
321
322 (define-public zathura-cb
323 (package
324 (name "zathura-cb")
325 (version "0.1.6")
326 (source (origin
327 (method url-fetch)
328 (uri
329 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
330 version ".tar.gz"))
331 (sha256
332 (base32
333 "1fim4mpm8l2g3msj1vg70ks3c9lrwllv3yh4jv8l9f8k3r19b3l8"))))
334 (native-inputs `(("pkg-config" ,pkg-config)))
335 (propagated-inputs `(("girara" ,girara)))
336 (inputs `(("libarchive" ,libarchive)
337 ("gtk+" ,gtk+)
338 ("zathura" ,zathura)))
339 (build-system gnu-build-system)
340 (arguments
341 `(#:make-flags (list (string-append "PREFIX=" %output)
342 (string-append "PLUGINDIR=" %output "/lib/zathura")
343 "CC=gcc")
344 #:tests? #f ; Package does not contain tests.
345 #:phases
346 (modify-phases %standard-phases (delete 'configure))))
347 (home-page "https://pwmt.org/projects/zathura-cb/")
348 (synopsis "Comic book support for zathura (libarchive backend)")
349 (description "The zathura-cb plugin adds comic book support to zathura
350 using libarchive.")
351 (license license:zlib)))
352
353 (define-public zathura-ps
354 (package
355 (name "zathura-ps")
356 (version "0.2.4")
357 (source (origin
358 (method url-fetch)
359 (uri
360 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
361 version ".tar.gz"))
362 (sha256
363 (base32
364 "1nxbl0glnzpan78fhdfzhkcd0cikcvrkzf9m56mb0pvnwzlwg7zv"))))
365 (native-inputs `(("pkg-config" ,pkg-config)))
366 (propagated-inputs `(("girara" ,girara)))
367 (inputs `(("libspectre" ,libspectre)
368 ("gtk+" ,gtk+)
369 ("zathura" ,zathura)))
370 (build-system gnu-build-system)
371 (arguments
372 `(#:make-flags (list (string-append "PREFIX=" %output)
373 (string-append "PLUGINDIR=" %output "/lib/zathura")
374 "CC=gcc")
375 #:tests? #f ; Package does not contain tests.
376 #:phases
377 (modify-phases %standard-phases (delete 'configure))))
378 (home-page "https://pwmt.org/projects/zathura-ps/")
379 (synopsis "PS support for zathura (libspectre backend)")
380 (description "The zathura-ps plugin adds PS support to zathura
381 using libspectre.")
382 (license license:zlib)))
383
384 (define-public zathura-djvu
385 (package
386 (name "zathura-djvu")
387 (version "0.2.6")
388 (source (origin
389 (method url-fetch)
390 (uri
391 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
392 version ".tar.gz"))
393 (sha256
394 (base32
395 "0py0ra44f65cg064xzds0qr6vnglj2a5bwhnbwa0dyh2nyizdzmf"))))
396 (native-inputs `(("pkg-config" ,pkg-config)))
397 (propagated-inputs `(("girara" ,girara)))
398 (inputs
399 `(("djvulibre" ,djvulibre)
400 ("gtk+" ,gtk+)
401 ("zathura" ,zathura)))
402 (build-system gnu-build-system)
403 (arguments
404 `(#:make-flags (list (string-append "PREFIX=" %output)
405 (string-append "PLUGINDIR=" %output "/lib/zathura")
406 "CC=gcc")
407 #:tests? #f ; Package does not contain tests.
408 #:phases
409 (modify-phases %standard-phases (delete 'configure))))
410 (home-page "https://pwmt.org/projects/zathura-djvu/")
411 (synopsis "DjVu support for zathura (DjVuLibre backend)")
412 (description "The zathura-djvu plugin adds DjVu support to zathura
413 using the DjVuLibre library.")
414 (license license:zlib)))
415
416 (define-public zathura-pdf-mupdf
417 (package
418 (name "zathura-pdf-mupdf")
419 (version "0.3.1")
420 (source (origin
421 (method url-fetch)
422 (uri
423 (string-append "https://pwmt.org/projects/zathura-pdf-mupdf"
424 "/download/zathura-pdf-mupdf-" version ".tar.gz"))
425 (sha256
426 (base32
427 "06zqn8z6a0hfsx3s1kzqvqzb73afgcl6z5r062sxv7kv570fvffr"))))
428 (native-inputs `(("pkg-config" ,pkg-config)))
429 (propagated-inputs `(("girara" ,girara)))
430 (inputs
431 `(("gtk+" ,gtk+)
432 ("jbig2dec" ,jbig2dec)
433 ("libjpeg" ,libjpeg)
434 ("mupdf" ,mupdf)
435 ("openjpeg" ,openjpeg)
436 ("openssl" ,openssl)
437 ("zathura" ,zathura)))
438 (build-system gnu-build-system)
439 (arguments
440 `(#:make-flags (list (string-append "PREFIX=" %output)
441 (string-append "PLUGINDIR=" %output "/lib/zathura")
442 "CC=gcc")
443 #:tests? #f ;No tests.
444 #:phases (modify-phases %standard-phases (delete 'configure))))
445 (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
446 (synopsis "PDF support for zathura (mupdf backend)")
447 (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
448 by using the @code{mupdf} rendering library.")
449 (license license:zlib)))
450
451 (define-public zathura-pdf-poppler
452 (package
453 (name "zathura-pdf-poppler")
454 (version "0.2.7")
455 (source (origin
456 (method url-fetch)
457 (uri
458 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
459 version ".tar.gz"))
460 (sha256
461 (base32
462 "1h43sgxpsbrsnn5z19661642plzhpv6b0y3f4kyzshv1rr6lwplq"))))
463 (native-inputs `(("pkg-config" ,pkg-config)))
464 (propagated-inputs `(("girara" ,girara)))
465 (inputs
466 `(("poppler" ,poppler)
467 ("gtk+" ,gtk+)
468 ("zathura" ,zathura)
469 ("cairo" ,cairo)))
470 (build-system gnu-build-system)
471 (arguments
472 `(#:make-flags (list (string-append "PREFIX=" %output)
473 (string-append "PLUGINDIR=" %output "/lib/zathura")
474 "CC=gcc")
475 #:tests? #f ; Package does not include tests.
476 #:phases
477 (modify-phases %standard-phases (delete 'configure))))
478 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
479 (synopsis "PDF support for zathura (poppler backend)")
480 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
481 by using the poppler rendering engine.")
482 (license license:zlib)))
483
484 (define-public zathura
485 (package
486 (name "zathura")
487 (version "0.3.7")
488 (source (origin
489 (method url-fetch)
490 (uri
491 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
492 version ".tar.gz"))
493 (sha256
494 (base32
495 "1w0g74dq4z2vl3f99s2gkaqrb5pskgzig10qhbxj4gq9yj4zzbr2"))
496 (patches (search-patches
497 "zathura-plugindir-environment-variable.patch"))))
498 (native-inputs `(("pkg-config" ,pkg-config)
499 ("gettext" ,gettext-minimal)))
500 (inputs `(("girara" ,girara)
501 ("sqlite" ,sqlite)
502 ("gtk+" ,gtk+)))
503 (native-search-paths
504 (list (search-path-specification
505 (variable "ZATHURA_PLUGIN_PATH")
506 (files '("lib/zathura")))))
507 (build-system gnu-build-system)
508 (arguments
509 `(#:make-flags
510 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
511 "CC=gcc" "COLOR=0")
512 #:tests? #f ; Tests fail: "Gtk cannot open display".
513 #:test-target "test"
514 #:phases
515 (modify-phases %standard-phases (delete 'configure))))
516 (home-page "https://pwmt.org/projects/zathura/")
517 (synopsis "Lightweight keyboard-driven PDF viewer")
518 (description "Zathura is a customizable document viewer. It provides a
519 minimalistic interface and an interface that mainly focuses on keyboard
520 interaction.")
521 (license license:zlib)))
522
523 (define-public podofo
524 (package
525 (name "podofo")
526 (version "0.9.5")
527 (source (origin
528 (method url-fetch)
529 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
530 "/podofo-" version ".tar.gz"))
531 (sha256
532 (base32
533 "012kgfx5j5n6w4zkc1d290d2cwjk60jhzsjlr2x19g3yi75q2jc5"))))
534 (build-system cmake-build-system)
535 (inputs ; TODO: Add cppunit for tests
536 `(("lua" ,lua-5.1)
537 ("libpng" ,libpng)
538 ("openssl" ,openssl)
539 ("fontconfig" ,fontconfig)
540 ("libtiff" ,libtiff)
541 ("libjpeg" ,libjpeg-8)
542 ("freetype" ,freetype)
543 ("zlib" ,zlib)))
544 (arguments
545 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
546 "-DPODOFO_BUILD_STATIC=ON")
547 #:phases
548 (modify-phases %standard-phases
549 (add-before 'configure 'patch
550 (lambda* (#:key inputs #:allow-other-keys)
551 (let ((freetype (assoc-ref inputs "freetype")))
552 ;; Look for freetype include files in the correct place.
553 (substitute* "cmake/modules/FindFREETYPE.cmake"
554 (("/usr/local") freetype)))
555 #t)))))
556 (home-page "http://podofo.sourceforge.net")
557 (synopsis "Tools to work with the PDF file format")
558 (description
559 "PoDoFo is a C++ library and set of command-line tools to work with the
560 PDF file format. It can parse PDF files and load them into memory, and makes
561 it easy to modify them and write the changes to disk. It is primarily useful
562 for applications that wish to do lower level manipulation of PDF, such as
563 extracting content or merging files.")
564 (license license:lgpl2.0+)))
565
566 (define-public mupdf
567 (package
568 (name "mupdf")
569 (version "1.11")
570 (source
571 (origin
572 (method url-fetch)
573 (uri (string-append "http://mupdf.com/downloads/archive/"
574 name "-" version "-source.tar.gz"))
575 (sha256
576 (base32
577 "02phamcchgsmvjnb3ir7r5sssvx9fcrscn297z73b82n1jl79510"))
578 (patches (search-patches "mupdf-build-with-openjpeg-2.1.patch"
579 "mupdf-CVE-2017-14685.patch"
580 "mupdf-CVE-2017-14686.patch"
581 "mupdf-CVE-2017-14687.patch"
582 "mupdf-CVE-2017-15587.patch"))
583 (modules '((guix build utils)))
584 (snippet
585 ;; Delete all the bundled libraries except for mujs, which is
586 ;; developed by the same team as mupdf and has no releases.
587 ;; TODO Package mujs and don't use the bundled copy.
588 '(for-each delete-file-recursively
589 '("thirdparty/curl"
590 "thirdparty/freetype"
591 "thirdparty/glfw"
592 "thirdparty/harfbuzz"
593 "thirdparty/jbig2dec"
594 "thirdparty/libjpeg"
595 "thirdparty/openjpeg"
596 "thirdparty/zlib")))))
597 (build-system gnu-build-system)
598 (inputs
599 `(("curl" ,curl)
600 ("freetype" ,freetype)
601 ("harfbuzz" ,harfbuzz)
602 ("jbig2dec" ,jbig2dec)
603 ("libjpeg" ,libjpeg)
604 ("libx11" ,libx11)
605 ("libxext" ,libxext)
606 ("openjpeg" ,openjpeg)
607 ("openssl" ,openssl)
608 ("zlib" ,zlib)))
609 (native-inputs
610 `(("pkg-config" ,pkg-config)))
611 (arguments
612 '(#:tests? #f ; no check target
613 #:make-flags (list "CC=gcc"
614 "XCFLAGS=-fpic"
615 (string-append "prefix=" (assoc-ref %outputs "out")))
616 #:phases (modify-phases %standard-phases
617 (delete 'configure))))
618 (home-page "http://mupdf.com")
619 (synopsis "Lightweight PDF viewer and toolkit")
620 (description
621 "MuPDF is a C library that implements a PDF and XPS parsing and
622 rendering engine. It is used primarily to render pages into bitmaps,
623 but also provides support for other operations such as searching and
624 listing the table of contents and hyperlinks.
625
626 The library ships with a rudimentary X11 viewer, and a set of command
627 line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
628 and examining the file structure (pdfshow).")
629 (license license:agpl3+)))
630
631 (define-public qpdf
632 (package
633 (name "qpdf")
634 (version "6.0.0")
635 (source (origin
636 (method url-fetch)
637 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
638 "/qpdf-" version ".tar.gz"))
639 (sha256
640 (base32
641 "0csj2p2gkxrc0rk8ykymlsdgfas96vzf1dip3y1x7z1q9plwgzd9"))
642 (modules '((guix build utils)))
643 (snippet
644 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
645 ;; dependency on Perl.
646 '(substitute* "qpdf/fix-qdf"
647 (("#!/usr/bin/env perl")
648 "\
649 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
650 & eval 'exec perl -wS \"$0\" $argv:q'
651 if 0;\n")))))
652 (build-system gnu-build-system)
653 (arguments
654 `(#:disallowed-references (,perl)
655 #:phases
656 (modify-phases %standard-phases
657 (add-before 'configure 'patch-paths
658 (lambda _
659 (substitute* "make/libtool.mk"
660 (("SHELL=/bin/bash")
661 (string-append "SHELL=" (which "bash"))))
662 (substitute* (append
663 '("qtest/bin/qtest-driver")
664 (find-files "." "\\.test"))
665 (("/usr/bin/env") (which "env"))))))))
666 (native-inputs
667 `(("pkg-config" ,pkg-config)
668 ("perl" ,perl)))
669 (propagated-inputs
670 `(("pcre" ,pcre)))
671 (inputs
672 `(("zlib" ,zlib)))
673 (synopsis "Command-line tools and library for transforming PDF files")
674 (description
675 "QPDF is a command-line program that does structural, content-preserving
676 transformations on PDF files. It could have been called something like
677 pdf-to-pdf. It includes support for merging and splitting PDFs and to
678 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
679 program capable of converting PDF into other formats.")
680 (license license:clarified-artistic)
681 (home-page "http://qpdf.sourceforge.net/")))
682
683 (define-public xournal
684 (package
685 (name "xournal")
686 (version "0.4.8")
687 (source
688 (origin
689 (method url-fetch)
690 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
691 "/xournal-" version ".tar.gz"))
692 (sha256
693 (base32
694 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
695 (build-system gnu-build-system)
696 (inputs
697 `(("gtk" ,gtk+-2)
698 ("pango" ,pango)
699 ("poppler" ,poppler)
700 ("glib" ,glib)
701 ("libgnomecanvas" ,libgnomecanvas)))
702 (native-inputs
703 `(("pkg-config" ,pkg-config)))
704 (home-page "http://xournal.sourceforge.net/")
705 (synopsis "Notetaking using a stylus")
706 (description
707 "Xournal is an application for notetaking, sketching, keeping a journal
708 using a stylus.")
709 (license license:gpl2+)))
710
711 (define-public python-reportlab
712 (package
713 (name "python-reportlab")
714 (version "3.3.0")
715 (source (origin
716 (method url-fetch)
717 (uri (pypi-uri "reportlab" version))
718 (sha256
719 (base32
720 "0rz2pg04wnzjjm2f5a8ik9v8s54mv4xrjhv5liqjijqv6awh12gl"))))
721 (build-system python-build-system)
722 (arguments
723 '(;; FIXME: There is one test failure, but it does not cause the
724 ;; build to fail. No time to investigate right now.
725 #:test-target "tests"))
726 (propagated-inputs
727 `(("python-pillow" ,python-pillow)))
728 (home-page "http://www.reportlab.com")
729 (synopsis "Python library for generating PDFs and graphics")
730 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
731 of rich PDF documents, and also creation of charts in a variety of bitmap and
732 vector formats.")
733 (license license:bsd-3)))
734
735 (define-public python2-reportlab
736 (package-with-python2 python-reportlab))
737
738 (define-public impressive
739 (package
740 (name "impressive")
741 (version "0.11.1")
742 (source (origin
743 (method url-fetch)
744 (uri (string-append
745 "mirror://sourceforge/impressive/Impressive/"
746 version "/Impressive-" version ".tar.gz"))
747 (sha256
748 (base32
749 "0b3rmy6acp2vmf5nill3aknxvr9a5aawk1vnphkah61anxp62gsr"))))
750 (build-system python-build-system)
751
752 ;; TODO: Add dependency on pdftk.
753 (inputs `(("python2-pygame" ,python2-pygame)
754 ("python2-pillow" ,python2-pillow)
755 ("sdl" ,sdl)
756 ("xpdf" ,xpdf)))
757
758 (arguments
759 `(#:python ,python-2
760 #:phases (modify-phases %standard-phases
761 (delete 'build)
762 (delete 'configure)
763 (delete 'check)
764 (replace 'install
765 (lambda* (#:key inputs outputs #:allow-other-keys)
766 ;; There's no 'setup.py' so install things manually.
767 (let* ((out (assoc-ref outputs "out"))
768 (bin (string-append out "/bin"))
769 (man1 (string-append out "/share/man/man1"))
770 (sdl (assoc-ref inputs "sdl"))
771 (xpdf (assoc-ref inputs "xpdf")))
772 (mkdir-p bin)
773 (copy-file "impressive.py"
774 (string-append bin "/impressive"))
775 (wrap-program (string-append bin "/impressive")
776 `("LIBRARY_PATH" ":" prefix ;for ctypes
777 (,(string-append sdl "/lib")))
778 `("PATH" ":" prefix ;for pdftoppm
779 (,(string-append xpdf "/bin"))))
780 (install-file "impressive.1" man1)
781 #t))))))
782 (home-page "http://impressive.sourceforge.net")
783 (synopsis "PDF presentation tool with visual effects")
784 (description
785 "Impressive is a tool to display PDF files that provides visual effects
786 such as smooth alpha-blended slide transitions. It provides additional tools
787 such as zooming, highlighting an area of the screen, and a tool to navigate
788 the PDF pages.")
789 (license license:gpl2)))
790
791 (define-public fbida
792 (package
793 (name "fbida")
794 (version "2.12")
795 (home-page "https://www.kraxel.org/blog/linux/fbida/")
796 (source (origin
797 (method url-fetch)
798 (uri (string-append "https://www.kraxel.org/releases/fbida/"
799 name "-" version ".tar.gz"))
800 (sha256
801 (base32
802 "0bw224vb7jh0lrqaf4jgxk48xglvxs674qcpj5y0axyfbh896cfk"))))
803 (build-system gnu-build-system)
804 (arguments
805 '(#:phases
806 (modify-phases %standard-phases
807 (add-after 'unpack 'patch-ldconfig
808 (lambda _
809 (substitute* "mk/Autoconf.mk"
810 (("/sbin/ldconfig -p") "echo lib")) #t))
811 (delete 'configure))
812 #:tests? #f
813 #:make-flags (list "CC=gcc"
814 (string-append "prefix=" (assoc-ref %outputs "out")))))
815 (inputs `(("libjpeg" ,libjpeg)
816 ("curl" ,curl)
817 ("libtiff" ,libtiff)
818 ("libudev" ,eudev)
819 ("libwebp" ,libwebp)
820 ("libdrm" ,libdrm)
821 ("imagemagick" ,imagemagick)
822 ("giflib" ,giflib)
823 ("glib" ,glib)
824 ("cairo-xcb" ,cairo-xcb)
825 ("freetype" ,freetype)
826 ("fontconfig" ,fontconfig)
827 ("libexif" ,libexif)
828 ("mesa" ,mesa)
829 ("libepoxy" ,libepoxy)
830 ("libpng" ,libpng)
831 ("poppler" ,poppler)))
832 (native-inputs `(("pkg-config" ,pkg-config)))
833 (synopsis "Framebuffer and drm-based image viewer")
834 (description
835 "fbida contains a few applications for viewing and editing images on
836 the framebuffer.")
837
838 (license license:gpl2+)))
839
840 (define-public pdf2svg
841 (package
842 (name "pdf2svg")
843 (version "0.2.3")
844 (source (origin
845 (method url-fetch)
846 (uri (string-append
847 "https://github.com/dawbarton/pdf2svg/archive/v"
848 version ".tar.gz"))
849 (file-name (string-append name "-" version ".tar.gz"))
850 (sha256
851 (base32
852 "12pa1pajirnlrkz2il3h4l30lc2prryk1qr132jk6z9y1c3qdcag"))))
853 (build-system gnu-build-system)
854 (inputs
855 `(("cairo" ,cairo)
856 ("poppler" ,poppler)))
857 (native-inputs
858 `(("pkg-config" ,pkg-config)))
859 (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
860 (synopsis "PDF to SVG converter")
861 (description "@command{pdf2svg} is a simple command-line PDF to SVG
862 converter using the Poppler and Cairo libraries.")
863 (license license:gpl2+)))
864
865 (define-public python-pypdf2
866 (package
867 (name "python-pypdf2")
868 (version "1.26.0")
869 (source (origin
870 (method url-fetch)
871 (uri (pypi-uri "PyPDF2" version))
872 (sha256
873 (base32
874 "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
875 (build-system python-build-system)
876 (arguments
877 `(#:phases
878 (modify-phases %standard-phases
879 (add-after
880 'unpack 'patch-test-suite
881 (lambda _
882 ;; The text-file needs to be opened in binary mode for Python 3,
883 ;; so patch in the "b"
884 (substitute* "Tests/tests.py"
885 (("pdftext_file = open\\(.* 'crazyones.txt'\\), 'r" line)
886 (string-append line "b")))
887 #t))
888 (replace 'check
889 (lambda _
890 (zero? (system* "python" "-m" "unittest" "Tests.tests")))))))
891 (home-page "http://mstamy2.github.com/PyPDF2")
892 (synopsis "Pure Python PDF toolkit")
893 (description "PyPDF2 is a pure Python PDF library capable of:
894
895 @enumerate
896 @item extracting document information (title, author, …)
897 @item splitting documents page by page
898 @item merging documents page by page
899 @item cropping pages
900 @item merging multiple pages into a single page
901 @item encrypting and decrypting PDF files
902 @end enumerate
903
904 By being pure Python, it should run on any Python platform without any
905 dependencies on external libraries. It can also work entirely on
906 @code{StringIO} objects rather than file streams, allowing for PDF
907 manipulation in memory. It is therefore a useful tool for websites that
908 manage or manipulate PDFs.")
909 (license license:bsd-3)))
910
911 (define-public python2-pypdf2
912 (package-with-python2 python-pypdf2))
913
914 (define-public python2-pypdf
915 (package
916 (name "python2-pypdf")
917 (version "1.13")
918 (source (origin
919 (method url-fetch)
920 (uri (pypi-uri "pyPdf" version))
921 (sha256
922 (base32
923 "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s"))))
924 (build-system python-build-system)
925 (arguments
926 `(#:tests? #f ; no tests
927 #:python ,python-2))
928 (home-page "http://pybrary.net/pyPdf/")
929 (synopsis "Pure Python PDF toolkit")
930 (description "PyPDF2 is a pure Python PDF toolkit.
931
932 Note: This module isn't maintained anymore. For new projects please use
933 python-pypdf2 instead.")
934 (license license:bsd-3)))
935
936 (define-public pdfposter
937 (package
938 (name "pdfposter")
939 (version "0.6.0")
940 (source (origin
941 (method url-fetch)
942 (uri (pypi-uri "pdftools.pdfposter" version ".tar.bz2"))
943 (sha256
944 (base32
945 "1i9jqawf279va089ykicglcq4zlsnwgcnsdzaa8vnm836lqhywma"))))
946 (build-system python-build-system)
947 (arguments
948 `(#:tests? #f ; no test suite, only for visual control
949 #:python ,python-2))
950 (inputs
951 ;; pdfposter 0.6.0 still uses the old pyPdf
952 `(("python2-pypdf" ,python2-pypdf)))
953 (home-page "https://pythonhosted.org/pdftools.pdfposter/")
954 (synopsis "Scale and tile PDF images/pages to print on multiple pages")
955 (description "@command{pdfposter} can be used to create a large poster by
956 building it from multple pages and/or printing it on large media. It expects
957 as input a PDF file, normally printing on a single page. The output is again
958 a PDF file, maybe containing multiple pages together building the poster. The
959 input page will be scaled to obtain the desired size.
960
961 This is much like @command{poster} does for Postscript files, but working with
962 PDF. Since sometimes @command{poster} does not like your files converted from
963 PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
964 (license license:gpl3+)))
965
966 (define-public pdfgrep
967 (package
968 (name "pdfgrep")
969 (version "2.0.1")
970 (source
971 (origin
972 (method url-fetch)
973 (uri (string-append "https://pdfgrep.org/download/"
974 name "-" version ".tar.gz"))
975 (sha256
976 (base32
977 "07llkrkcfjwd3ybai9ad10ybhr0biffcplmy7lw4fb87nd2dfw03"))))
978 (build-system gnu-build-system)
979 (native-inputs
980 `(("pkg-config" ,pkg-config)))
981 (inputs
982 `(("libgcrypt" ,libgcrypt)
983 ("pcre" ,pcre)
984 ("poppler" ,poppler)))
985 (home-page "https://pdfgrep.org")
986 (synopsis "Command-line utility to search text in PDF files")
987 (description
988 "Pdfgrep searches in pdf files for strings matching a regular expression.
989 Support some GNU grep options as file name output, page number output,
990 optional case insensitivity, count occurrences, color highlights and search in
991 multiple files.")
992 (license license:gpl2+)))