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