gnu: podofo: Add patch to fix build.
[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, 2018 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
6 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
7 ;;; Copyright © 2016 Nils Gillmann <ng0@n0.is>
8 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
11 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
12 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
13 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
14 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
15 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
16 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
17 ;;;
18 ;;; This file is part of GNU Guix.
19 ;;;
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
24 ;;;
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
29 ;;;
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33 (define-module (gnu packages pdf)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix utils)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system meson)
42 #:use-module (guix build-system python)
43 #:use-module (guix build-system trivial)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages backup)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages bash)
49 #:use-module (gnu packages check)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages curl)
52 #:use-module (gnu packages databases)
53 #:use-module (gnu packages djvu)
54 #:use-module (gnu packages fontutils)
55 #:use-module (gnu packages game-development)
56 #:use-module (gnu packages gettext)
57 #:use-module (gnu packages ghostscript)
58 #:use-module (gnu packages gl)
59 #:use-module (gnu packages glib)
60 #:use-module (gnu packages gnome)
61 #:use-module (gnu packages gnupg)
62 #:use-module (gnu packages gstreamer)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages image)
65 #:use-module (gnu packages imagemagick)
66 #:use-module (gnu packages javascript)
67 #:use-module (gnu packages lesstif)
68 #:use-module (gnu packages linux)
69 #:use-module (gnu packages lua)
70 #:use-module (gnu packages pcre)
71 #:use-module (gnu packages perl)
72 #:use-module (gnu packages photo)
73 #:use-module (gnu packages pkg-config)
74 #:use-module (gnu packages python)
75 #:use-module (gnu packages qt)
76 #:use-module (gnu packages sdl)
77 #:use-module (gnu packages tls)
78 #:use-module (gnu packages xdisorg)
79 #:use-module (gnu packages xorg)
80 #:use-module (srfi srfi-1))
81
82 (define-public poppler
83 (package
84 (name "poppler")
85 (replacement poppler/fixed)
86 (version "0.68.0")
87 (source (origin
88 (method url-fetch)
89 (uri (string-append "https://poppler.freedesktop.org/poppler-"
90 version ".tar.xz"))
91 (sha256
92 (base32
93 "0n0f7mv24lzv9p3dlzakpdhqg7ygcvl6l40grcz95xldzgq083gr"))))
94 (build-system cmake-build-system)
95 ;; FIXME:
96 ;; use libcurl: no
97 (inputs `(("fontconfig" ,fontconfig)
98 ("freetype" ,freetype)
99 ("libjpeg" ,libjpeg-turbo)
100 ("libpng" ,libpng)
101 ("libtiff" ,libtiff)
102 ("lcms" ,lcms)
103 ("openjpeg" ,openjpeg)
104 ("zlib" ,zlib)
105
106 ;; To build poppler-glib (as needed by Evince), we need Cairo and
107 ;; GLib. But of course, that Cairo must not depend on Poppler.
108 ("cairo" ,(package (inherit cairo)
109 (inputs (alist-delete "poppler"
110 (package-inputs cairo)))))))
111 (propagated-inputs
112 ;; As per poppler-cairo and poppler-glib.pc.
113 ;; XXX: Ideally we'd propagate Cairo too, but that would require a
114 ;; different solution to the circular dependency mentioned above.
115 `(("glib" ,glib)))
116 (native-inputs
117 `(("pkg-config" ,pkg-config)
118 ("glib" ,glib "bin") ; glib-mkenums, etc.
119 ("gobject-introspection" ,gobject-introspection)))
120 (arguments
121 `(#:tests? #f ; no test data provided with the tarball
122 #:configure-flags
123 (let* ((out (assoc-ref %outputs "out"))
124 (lib (string-append out "/lib")))
125 (list "-DENABLE_XPDF_HEADERS=ON" ; to install header files
126 "-DENABLE_ZLIB=ON"
127 (string-append "-DCMAKE_INSTALL_LIBDIR=" lib)
128 (string-append "-DCMAKE_INSTALL_RPATH=" lib)))))
129 (synopsis "PDF rendering library")
130 (description
131 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
132 (license license:gpl2+)
133 (home-page "https://poppler.freedesktop.org/")))
134
135 (define poppler/fixed
136 (package
137 (inherit poppler)
138 (source (origin
139 (inherit (package-source poppler))
140 (patches (append (origin-patches (package-source poppler))
141 (search-patches "poppler-CVE-2018-19149.patch")))))))
142
143 (define-public poppler-data
144 (package
145 (name "poppler-data")
146 (version "0.4.9")
147 (source (origin
148 (method url-fetch)
149 (uri (string-append "https://poppler.freedesktop.org/poppler-data"
150 "-" version ".tar.gz"))
151 (sha256
152 (base32
153 "04i0wgdkn5lhda8cyxd1ll4a2p41pwqrwd47n9mdpl7cx5ypx70z"))))
154 (build-system gnu-build-system)
155 (arguments
156 '(#:tests? #f ; no test suite
157 #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
158 #:phases
159 (modify-phases %standard-phases
160 ;; The package only provides some data files, so there is nothing to
161 ;; build.
162 (delete 'configure)
163 (delete 'build))))
164 (synopsis "Poppler encoding files for rendering of CJK and Cyrillic text")
165 (description "This package provides optional encoding files for Poppler.
166 When present, Poppler is able to correctly render CJK and Cyrillic text.")
167 (home-page (package-home-page poppler))
168 ;; See COPYING in the source distribution for more information about
169 ;; the licensing.
170 (license (list license:bsd-3
171 license:gpl2))))
172
173 (define-public poppler-qt4
174 (package/inherit poppler
175 (name "poppler-qt4")
176 (inputs `(("qt-4" ,qt-4)
177 ,@(package-inputs poppler)))
178 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
179
180 (define-public poppler-qt5
181 (package/inherit poppler
182 (name "poppler-qt5")
183 (inputs `(("qtbase" ,qtbase)
184 ,@(package-inputs poppler)))
185 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
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 git-fetch)
240 (uri (git-reference
241 (url "https://github.com/libharu/libharu.git")
242 (commit (string-append
243 "RELEASE_"
244 (string-join (string-split version #\.) "_")))))
245 (file-name (git-file-name name version))
246 (sha256
247 (base32
248 "15s9hswnl3qqi7yh29jyrg0hma2n99haxznvcywmsp8kjqlyg75q"))))
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 (inputs
257 `(("zlib" ,zlib)
258 ("libpng" ,libpng)))
259 (native-inputs
260 `(("autoconf" ,autoconf)
261 ("automake" ,automake)
262 ("libtool" ,libtool)))
263 (home-page "http://libharu.org/")
264 (synopsis "Library for generating PDF files")
265 (description
266 "libHaru is a library for generating PDF files. libHaru does not support
267 reading and editing of existing PDF files.")
268 (license license:zlib)))
269
270 (define-public xpdf
271 (package
272 (name "xpdf")
273 (version "3.04")
274 (source (origin
275 (method url-fetch)
276 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
277 version ".tar.gz"))
278 (sha256 (base32
279 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
280 (build-system gnu-build-system)
281 (inputs `(("freetype" ,freetype)
282 ("gs-fonts" ,gs-fonts)
283 ("lesstif" ,lesstif)
284 ("libpaper" ,libpaper)
285 ("libx11" ,libx11)
286 ("libxext" ,libxext)
287 ("libxp" ,libxp)
288 ("libxpm" ,libxpm)
289 ("libxt" ,libxt)
290 ("libpng" ,libpng)
291 ("zlib" ,zlib)))
292 (arguments
293 `(#:tests? #f ; there is no check target
294 #:parallel-build? #f ; build fails randomly on 8-way machines
295 #:configure-flags
296 (list (string-append "--with-freetype2-includes="
297 (assoc-ref %build-inputs "freetype")
298 "/include/freetype2"))
299 #:phases
300 (modify-phases %standard-phases
301 (replace 'install
302 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
303 (let* ((install (assoc-ref %standard-phases 'install))
304 (out (assoc-ref outputs "out"))
305 (xpdfrc (string-append out "/etc/xpdfrc"))
306 (gs-fonts (assoc-ref inputs "gs-fonts")))
307 (apply install args)
308 (substitute* xpdfrc
309 (("/usr/local/share/ghostscript/fonts")
310 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
311 (("#fontFile") "fontFile")))
312 #t)))))
313 (synopsis "Viewer for PDF files based on the Motif toolkit")
314 (description
315 "Xpdf is a viewer for Portable Document Format (PDF) files.")
316 (license license:gpl3) ; or gpl2, but not gpl2+
317 (home-page "http://www.foolabs.com/xpdf/")))
318
319 (define-public zathura-cb
320 (package
321 (name "zathura-cb")
322 (version "0.1.8")
323 (source (origin
324 (method url-fetch)
325 (uri
326 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
327 version ".tar.xz"))
328 (sha256
329 (base32
330 "1i6cf0vks501cggwvfsl6qb7mdaf3sszdymphimfvnspw810faj5"))))
331 (native-inputs `(("pkg-config" ,pkg-config)))
332 (inputs `(("libarchive" ,libarchive)
333 ("zathura" ,zathura)))
334 (build-system meson-build-system)
335 (arguments
336 `(#:tests? #f ; package does not contain tests
337 #:phases
338 (modify-phases %standard-phases
339 (add-after 'unpack 'patch-plugin-directory
340 ;; Something of a regression in 0.1.8: the new Meson build system
341 ;; now hard-codes an incorrect plugin directory. Fix it.
342 (lambda* (#:key outputs #:allow-other-keys)
343 (substitute* "meson.build"
344 (("(install_dir:).*" _ key)
345 (string-append key
346 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
347 #t)))))
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.6")
358 (source (origin
359 (method url-fetch)
360 (uri
361 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
362 version ".tar.xz"))
363 (sha256
364 (base32
365 "0wygq89nyjrjnsq7vbpidqdsirjm6iq4w2rijzwpk2f83ys8bc3y"))))
366 (native-inputs `(("pkg-config" ,pkg-config)))
367 (inputs `(("libspectre" ,libspectre)
368 ("zathura" ,zathura)))
369 (build-system meson-build-system)
370 (arguments
371 `(#:tests? #f ; package does not contain tests
372 #:phases
373 (modify-phases %standard-phases
374 (add-after 'unpack 'patch-plugin-directory
375 ;; Something of a regression in 0.2.6: the new Meson build system
376 ;; now hard-codes an incorrect plugin directory. Fix it.
377 (lambda* (#:key outputs #:allow-other-keys)
378 (substitute* "meson.build"
379 (("(install_dir:).*" _ key)
380 (string-append key
381 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
382 #t)))))
383 (home-page "https://pwmt.org/projects/zathura-ps/")
384 (synopsis "PS support for zathura (libspectre backend)")
385 (description "The zathura-ps plugin adds PS support to zathura
386 using libspectre.")
387 (license license:zlib)))
388
389 (define-public zathura-djvu
390 (package
391 (name "zathura-djvu")
392 (version "0.2.8")
393 (source (origin
394 (method url-fetch)
395 (uri
396 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
397 version ".tar.xz"))
398 (sha256
399 (base32
400 "0axkv1crdxn0z44whaqp2ibkdqcykhjnxk7qzms0dp1b67an9rnh"))))
401 (native-inputs `(("pkg-config" ,pkg-config)))
402 (inputs
403 `(("djvulibre" ,djvulibre)
404 ("zathura" ,zathura)))
405 (build-system meson-build-system)
406 (arguments
407 `(#:tests? #f ; package does not contain tests
408 #:phases
409 (modify-phases %standard-phases
410 (add-after 'unpack 'patch-plugin-directory
411 ;; Something of a regression in 0.2.8: the new Meson build system
412 ;; now hard-codes an incorrect plugin directory. Fix it.
413 (lambda* (#:key outputs #:allow-other-keys)
414 (substitute* "meson.build"
415 (("(install_dir:).*" _ key)
416 (string-append key
417 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
418 #t)))))
419 (home-page "https://pwmt.org/projects/zathura-djvu/")
420 (synopsis "DjVu support for zathura (DjVuLibre backend)")
421 (description "The zathura-djvu plugin adds DjVu support to zathura
422 using the DjVuLibre library.")
423 (license license:zlib)))
424
425 (define-public zathura-pdf-mupdf
426 (package
427 (name "zathura-pdf-mupdf")
428 (version "0.3.4")
429 (source (origin
430 (method url-fetch)
431 (uri
432 (string-append "https://pwmt.org/projects/zathura-pdf-mupdf"
433 "/download/zathura-pdf-mupdf-" version ".tar.xz"))
434 (sha256
435 (base32
436 "166d5nz47ixzwj4pixsd5fd9qvjf5v34cdqi3p72vr23pswk2hyn"))))
437 (native-inputs `(("pkg-config" ,pkg-config)))
438 (inputs
439 `(("jbig2dec" ,jbig2dec)
440 ("libjpeg" ,libjpeg)
441 ("mupdf" ,mupdf)
442 ("openjpeg" ,openjpeg)
443 ("openssl" ,openssl)
444 ("zathura" ,zathura)))
445 (build-system meson-build-system)
446 (arguments
447 `(#:tests? #f ; package does not contain tests
448 #:configure-flags (list (string-append "-Dplugindir="
449 (assoc-ref %outputs "out")
450 "/lib/zathura"))))
451 (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
452 (synopsis "PDF support for zathura (mupdf backend)")
453 (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
454 by using the @code{mupdf} rendering library.")
455 (license license:zlib)))
456
457 (define-public zathura-pdf-poppler
458 (package
459 (name "zathura-pdf-poppler")
460 (version "0.2.9")
461 (source (origin
462 (method url-fetch)
463 (uri
464 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
465 version ".tar.xz"))
466 (sha256
467 (base32
468 "1p4jcny0jniygns78mcf0nlm298dszh49qpmjmackrm6dq8hc25y"))))
469 (native-inputs `(("pkg-config" ,pkg-config)))
470 (inputs
471 `(("poppler" ,poppler)
472 ("zathura" ,zathura)))
473 (build-system meson-build-system)
474 (arguments
475 `(#:tests? #f ; package does not include tests
476 #:phases
477 (modify-phases %standard-phases
478 (add-after 'unpack 'patch-plugin-directory
479 ;; Something of a regression in 0.2.9: the new Meson build system
480 ;; now hard-codes an incorrect plugin directory. Fix it.
481 (lambda* (#:key outputs #:allow-other-keys)
482 (substitute* "meson.build"
483 (("(install_dir:).*" _ key)
484 (string-append key
485 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
486 #t)))))
487 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
488 (synopsis "PDF support for zathura (poppler backend)")
489 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
490 by using the poppler rendering engine.")
491 (license license:zlib)))
492
493 (define-public zathura
494 (package
495 (name "zathura")
496 (version "0.4.0")
497 (source (origin
498 (method url-fetch)
499 (uri
500 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
501 version ".tar.xz"))
502 (sha256
503 (base32
504 "1j0yah09adv3bsjhhbqra5lambal32svk8fxmf89wwmcqrcr4qma"))
505 (patches (search-patches
506 "zathura-plugindir-environment-variable.patch"))))
507 (native-inputs `(("pkg-config" ,pkg-config)
508 ("gettext" ,gettext-minimal)
509 ("glib:bin" ,glib "bin")
510
511 ;; For building documentation.
512 ("python-sphinx" ,python-sphinx)
513
514 ;; For tests.
515 ("check" ,check)
516 ("xorg-server" ,xorg-server-for-tests)))
517 (inputs `(("sqlite" ,sqlite)))
518 ;; Listed in 'Requires.private' of 'zathura.pc'.
519 (propagated-inputs `(("cairo" ,cairo)
520 ("girara" ,girara)))
521 (native-search-paths
522 (list (search-path-specification
523 (variable "ZATHURA_PLUGIN_PATH")
524 (files '("lib/zathura")))))
525 (build-system meson-build-system)
526 (arguments
527 `(#:phases (modify-phases %standard-phases
528 (add-before 'check 'start-xserver
529 ;; Tests require a running X server.
530 (lambda* (#:key inputs #:allow-other-keys)
531 (let ((xorg-server (assoc-ref inputs "xorg-server"))
532 (display ":1"))
533 (setenv "DISPLAY" display)
534
535 ;; On busy machines, tests may take longer than
536 ;; the default of four seconds.
537 (setenv "CK_DEFAULT_TIMEOUT" "20")
538
539 ;; Don't fail due to missing '/etc/machine-id'.
540 (setenv "DBUS_FATAL_WARNINGS" "0")
541 (zero? (system (string-append xorg-server "/bin/Xvfb "
542 display " &")))))))))
543 (home-page "https://pwmt.org/projects/zathura/")
544 (synopsis "Lightweight keyboard-driven PDF viewer")
545 (description "Zathura is a customizable document viewer. It provides a
546 minimalistic interface and an interface that mainly focuses on keyboard
547 interaction.")
548 (license license:zlib)))
549
550 (define-public podofo
551 (package
552 (name "podofo")
553 (version "0.9.6")
554 (source (origin
555 (method url-fetch)
556 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
557 "/podofo-" version ".tar.gz"))
558 (sha256
559 (base32
560 "0wj0y4zcmj4q79wrn3vv3xq4bb0vhhxs8yifafwy9f2sjm83c5p9"))
561 (patches (search-patches "podofo-cmake-3.12.patch"))))
562 (build-system cmake-build-system)
563 (native-inputs
564 `(("cppunit" ,cppunit)
565 ("pkg-config" ,pkg-config)))
566 (inputs
567 `(("libjpeg" ,libjpeg)
568 ("libtiff" ,libtiff)
569 ("fontconfig" ,fontconfig)
570 ("freetype" ,freetype)
571 ("libpng" ,libpng)
572 ("lua" ,lua-5.1)
573 ("openssl" ,openssl)
574 ("zlib" ,zlib)))
575 (arguments
576 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
577 "-DPODOFO_BUILD_STATIC=ON")
578 #:phases
579 (modify-phases %standard-phases
580 (add-before 'configure 'patch
581 (lambda* (#:key inputs #:allow-other-keys)
582 (let ((freetype (assoc-ref inputs "freetype")))
583 ;; Look for freetype include files in the correct place.
584 (substitute* "cmake/modules/FindFREETYPE.cmake"
585 (("/usr/local") freetype)))
586 #t)))))
587 (home-page "http://podofo.sourceforge.net")
588 (synopsis "Tools to work with the PDF file format")
589 (description
590 "PoDoFo is a C++ library and set of command-line tools to work with the
591 PDF file format. It can parse PDF files and load them into memory, and makes
592 it easy to modify them and write the changes to disk. It is primarily useful
593 for applications that wish to do lower level manipulation of PDF, such as
594 extracting content or merging files.")
595 (license license:lgpl2.0+)))
596
597 (define-public mupdf
598 (package
599 (name "mupdf")
600 (version "1.14.0")
601 (source
602 (origin
603 (method url-fetch)
604 (uri (string-append "https://mupdf.com/downloads/archive/"
605 name "-" version "-source.tar.xz"))
606 (sha256
607 (base32
608 "1psnz02w5p7wc1s1ma7vvjmkjfy641xvsh9ykaqzkk84dflnjgk0"))
609 (modules '((guix build utils)))
610 (snippet
611 ;; We keep lcms2 since it is different than our lcms.
612 '(begin
613 (for-each
614 (lambda (dir)
615 (delete-file-recursively (string-append "thirdparty/" dir)))
616 '("curl" "freeglut" "freetype" "harfbuzz" "jbig2dec"
617 "libjpeg" "mujs" "openjpeg" "zlib"))
618 #t))))
619 (build-system gnu-build-system)
620 (inputs
621 `(("curl" ,curl)
622 ("freeglut" ,freeglut)
623 ("freetype" ,freetype)
624 ("harfbuzz" ,harfbuzz)
625 ("jbig2dec" ,jbig2dec)
626 ("libjpeg" ,libjpeg)
627 ("libx11" ,libx11)
628 ("libxext" ,libxext)
629 ("mujs" ,mujs)
630 ("openjpeg" ,openjpeg)
631 ("openssl" ,openssl)
632 ("zlib" ,zlib)))
633 (native-inputs
634 `(("pkg-config" ,pkg-config)))
635 (arguments
636 '(#:tests? #f ; no check target
637 #:make-flags (list "CC=gcc"
638 "XCFLAGS=-fpic"
639 "USE_SYSTEM_LIBS=yes"
640 "USE_SYSTEM_MUJS=yes"
641 (string-append "prefix=" (assoc-ref %outputs "out")))
642 #:phases (modify-phases %standard-phases
643 (delete 'configure))))
644 (home-page "https://mupdf.com")
645 (synopsis "Lightweight PDF viewer and toolkit")
646 (description
647 "MuPDF is a C library that implements a PDF and XPS parsing and
648 rendering engine. It is used primarily to render pages into bitmaps,
649 but also provides support for other operations such as searching and
650 listing the table of contents and hyperlinks.
651
652 The library ships with a rudimentary X11 viewer, and a set of command
653 line tools for batch rendering @command{pdfdraw}, rewriting files
654 @command{pdfclean}, and examining the file structure @command{pdfshow}.")
655 (license (list license:agpl3+
656 license:bsd-3 ; resources/cmaps
657 license:x11 ; thirdparty/lcms2
658 license:silofl1.1 ; resources/fonts/{han,noto,sil,urw}
659 license:asl2.0)))) ; resources/fonts/droid
660
661 (define-public qpdf
662 (package
663 (name "qpdf")
664 (version "8.2.1")
665 (source (origin
666 (method url-fetch)
667 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
668 "/qpdf-" version ".tar.gz"))
669 (sha256
670 (base32
671 "1jdb0jj72fjdp6xip4m7yz31r5x13zs7h4smnxsycgw3vbmx6igl"))
672 (modules '((guix build utils)))
673 (snippet
674 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
675 ;; dependency on Perl.
676 '(begin
677 (substitute* "qpdf/fix-qdf"
678 (("#!/usr/bin/env perl")
679 "\
680 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
681 & eval 'exec perl -wS \"$0\" $argv:q'
682 if 0;\n"))
683 #t))))
684 (build-system gnu-build-system)
685 (arguments
686 `(#:disallowed-references (,perl)
687 #:phases
688 (modify-phases %standard-phases
689 (add-before 'configure 'patch-paths
690 (lambda _
691 (substitute* "make/libtool.mk"
692 (("SHELL=/bin/bash")
693 (string-append "SHELL=" (which "bash"))))
694 (substitute* (append
695 '("qtest/bin/qtest-driver")
696 (find-files "." "\\.test"))
697 (("/usr/bin/env") (which "env")))
698 #t)))))
699 (native-inputs
700 `(("pkg-config" ,pkg-config)
701 ("perl" ,perl)))
702 (propagated-inputs
703 ;; In Requires.private of libqpdf.pc.
704 `(("libjpeg-turbo" ,libjpeg-turbo)
705 ("zlib" ,zlib)))
706 (synopsis "Command-line tools and library for transforming PDF files")
707 (description
708 "QPDF is a command-line program that does structural, content-preserving
709 transformations on PDF files. It could have been called something like
710 pdf-to-pdf. It includes support for merging and splitting PDFs and to
711 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
712 program capable of converting PDF into other formats.")
713 ;; Prior to the 7.0 release, QPDF was licensed under Artistic 2.0.
714 ;; Users can still choose to use the old license at their option.
715 (license (list license:asl2.0 license:clarified-artistic))
716 (home-page "http://qpdf.sourceforge.net/")))
717
718 (define-public xournal
719 (package
720 (name "xournal")
721 (version "0.4.8.2016")
722 (source
723 (origin
724 (method url-fetch)
725 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
726 "/xournal-" version ".tar.gz"))
727 (sha256
728 (base32
729 "09i88v3wacmx7f96dmq0l3afpyv95lh6jrx16xzm0jd1szdrhn5j"))))
730 (build-system gnu-build-system)
731 (inputs
732 `(("gtk" ,gtk+-2)
733 ("pango" ,pango)
734 ("poppler" ,poppler)
735 ("glib" ,glib)
736 ("libgnomecanvas" ,libgnomecanvas)))
737 (native-inputs
738 `(("pkg-config" ,pkg-config)))
739 (home-page "http://xournal.sourceforge.net/")
740 (synopsis "Notetaking using a stylus")
741 (description
742 "Xournal is an application for notetaking, sketching, keeping a journal
743 using a stylus.")
744 (license license:gpl2+)))
745
746 (define-public python-reportlab
747 (package
748 (name "python-reportlab")
749 (version "3.4.0")
750 (source (origin
751 (method url-fetch)
752 (uri (pypi-uri "reportlab" version))
753 (sha256
754 (base32
755 "0hy304pzsz9lblmk7mrbk2682bi911lxgvzx2kcfpmfzb5gg7sjv"))))
756 (build-system python-build-system)
757 (arguments
758 '(;; FIXME: There is one test failure, but it does not cause the
759 ;; build to fail. No time to investigate right now.
760 #:test-target "tests"))
761 (propagated-inputs
762 `(("python-pillow" ,python-pillow)))
763 (home-page "https://www.reportlab.com")
764 (synopsis "Python library for generating PDFs and graphics")
765 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
766 of rich PDF documents, and also creation of charts in a variety of bitmap and
767 vector formats.")
768 (license license:bsd-3)))
769
770 (define-public python2-reportlab
771 (package-with-python2 python-reportlab))
772
773 (define-public impressive
774 (package
775 (name "impressive")
776 (version "0.11.1")
777 (source (origin
778 (method url-fetch)
779 (uri (string-append
780 "mirror://sourceforge/impressive/Impressive/"
781 version "/Impressive-" version ".tar.gz"))
782 (sha256
783 (base32
784 "0b3rmy6acp2vmf5nill3aknxvr9a5aawk1vnphkah61anxp62gsr"))))
785 (build-system python-build-system)
786
787 ;; TODO: Add dependency on pdftk.
788 (inputs `(("python2-pygame" ,python2-pygame)
789 ("python2-pillow" ,python2-pillow)
790 ("sdl" ,sdl)
791 ("xpdf" ,xpdf)))
792
793 (arguments
794 `(#:python ,python-2
795 #:phases (modify-phases %standard-phases
796 (delete 'build)
797 (delete 'configure)
798 (delete 'check)
799 (replace 'install
800 (lambda* (#:key inputs outputs #:allow-other-keys)
801 ;; There's no 'setup.py' so install things manually.
802 (let* ((out (assoc-ref outputs "out"))
803 (bin (string-append out "/bin"))
804 (man1 (string-append out "/share/man/man1"))
805 (sdl (assoc-ref inputs "sdl"))
806 (xpdf (assoc-ref inputs "xpdf")))
807 (mkdir-p bin)
808 (copy-file "impressive.py"
809 (string-append bin "/impressive"))
810 (wrap-program (string-append bin "/impressive")
811 `("LIBRARY_PATH" ":" prefix ;for ctypes
812 (,(string-append sdl "/lib")))
813 `("PATH" ":" prefix ;for pdftoppm
814 (,(string-append xpdf "/bin"))))
815 (install-file "impressive.1" man1)
816 #t))))))
817 (home-page "http://impressive.sourceforge.net")
818 (synopsis "PDF presentation tool with visual effects")
819 (description
820 "Impressive is a tool to display PDF files that provides visual effects
821 such as smooth alpha-blended slide transitions. It provides additional tools
822 such as zooming, highlighting an area of the screen, and a tool to navigate
823 the PDF pages.")
824 (license license:gpl2)))
825
826 (define-public fbida
827 (package
828 (name "fbida")
829 (version "2.12")
830 (home-page "https://www.kraxel.org/blog/linux/fbida/")
831 (source (origin
832 (method url-fetch)
833 (uri (string-append "https://www.kraxel.org/releases/fbida/"
834 name "-" version ".tar.gz"))
835 (sha256
836 (base32
837 "0bw224vb7jh0lrqaf4jgxk48xglvxs674qcpj5y0axyfbh896cfk"))))
838 (build-system gnu-build-system)
839 (arguments
840 '(#:phases
841 (modify-phases %standard-phases
842 (add-after 'unpack 'patch-ldconfig
843 (lambda _
844 (substitute* "mk/Autoconf.mk"
845 (("/sbin/ldconfig -p") "echo lib")) #t))
846 (delete 'configure))
847 #:tests? #f
848 #:make-flags (list "CC=gcc"
849 (string-append "prefix=" (assoc-ref %outputs "out")))))
850 (inputs `(("libjpeg" ,libjpeg)
851 ("curl" ,curl)
852 ("libtiff" ,libtiff)
853 ("libudev" ,eudev)
854 ("libwebp" ,libwebp)
855 ("libdrm" ,libdrm)
856 ("imagemagick" ,imagemagick)
857 ("giflib" ,giflib)
858 ("glib" ,glib)
859 ("cairo-xcb" ,cairo-xcb)
860 ("freetype" ,freetype)
861 ("fontconfig" ,fontconfig)
862 ("libexif" ,libexif)
863 ("mesa" ,mesa)
864 ("libepoxy" ,libepoxy)
865 ("libpng" ,libpng)
866 ("poppler" ,poppler)))
867 (native-inputs `(("pkg-config" ,pkg-config)))
868 (synopsis "Framebuffer and drm-based image viewer")
869 (description
870 "fbida contains a few applications for viewing and editing images on
871 the framebuffer.")
872
873 (license license:gpl2+)))
874
875 (define-public pdf2svg
876 (package
877 (name "pdf2svg")
878 (version "0.2.3")
879 (source (origin
880 (method url-fetch)
881 (uri (string-append
882 "https://github.com/dawbarton/pdf2svg/archive/v"
883 version ".tar.gz"))
884 (file-name (string-append name "-" version ".tar.gz"))
885 (sha256
886 (base32
887 "12pa1pajirnlrkz2il3h4l30lc2prryk1qr132jk6z9y1c3qdcag"))))
888 (build-system gnu-build-system)
889 (inputs
890 `(("cairo" ,cairo)
891 ("poppler" ,poppler)))
892 (native-inputs
893 `(("pkg-config" ,pkg-config)))
894 (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
895 (synopsis "PDF to SVG converter")
896 (description "@command{pdf2svg} is a simple command-line PDF to SVG
897 converter using the Poppler and Cairo libraries.")
898 (license license:gpl2+)))
899
900 (define-public python-pypdf2
901 (package
902 (name "python-pypdf2")
903 (version "1.26.0")
904 (source (origin
905 (method url-fetch)
906 (uri (pypi-uri "PyPDF2" version))
907 (sha256
908 (base32
909 "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
910 (build-system python-build-system)
911 (arguments
912 `(#:phases
913 (modify-phases %standard-phases
914 (add-after
915 'unpack 'patch-test-suite
916 (lambda _
917 ;; The text-file needs to be opened in binary mode for Python 3,
918 ;; so patch in the "b"
919 (substitute* "Tests/tests.py"
920 (("pdftext_file = open\\(.* 'crazyones.txt'\\), 'r" line)
921 (string-append line "b")))
922 #t))
923 (replace 'check
924 (lambda _
925 (invoke "python" "-m" "unittest" "Tests.tests"))))))
926 (home-page "http://mstamy2.github.com/PyPDF2")
927 (synopsis "Pure Python PDF toolkit")
928 (description "PyPDF2 is a pure Python PDF library capable of:
929
930 @enumerate
931 @item extracting document information (title, author, …)
932 @item splitting documents page by page
933 @item merging documents page by page
934 @item cropping pages
935 @item merging multiple pages into a single page
936 @item encrypting and decrypting PDF files
937 @end enumerate
938
939 By being pure Python, it should run on any Python platform without any
940 dependencies on external libraries. It can also work entirely on
941 @code{StringIO} objects rather than file streams, allowing for PDF
942 manipulation in memory. It is therefore a useful tool for websites that
943 manage or manipulate PDFs.")
944 (license license:bsd-3)))
945
946 (define-public python2-pypdf2
947 (package-with-python2 python-pypdf2))
948
949 (define-public python2-pypdf
950 (package
951 (name "python2-pypdf")
952 (version "1.13")
953 (source (origin
954 (method url-fetch)
955 (uri (pypi-uri "pyPdf" version))
956 (sha256
957 (base32
958 "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s"))))
959 (build-system python-build-system)
960 (arguments
961 `(#:tests? #f ; no tests
962 #:python ,python-2))
963 (home-page "http://pybrary.net/pyPdf/")
964 (synopsis "Pure Python PDF toolkit")
965 (description "PyPDF2 is a pure Python PDF toolkit.
966
967 Note: This module isn't maintained anymore. For new projects please use
968 python-pypdf2 instead.")
969 (license license:bsd-3)))
970
971 (define-public pdfposter
972 (package
973 (name "pdfposter")
974 (version "0.6.0")
975 (source (origin
976 (method url-fetch)
977 (uri (pypi-uri "pdftools.pdfposter" version ".tar.bz2"))
978 (sha256
979 (base32
980 "1i9jqawf279va089ykicglcq4zlsnwgcnsdzaa8vnm836lqhywma"))))
981 (build-system python-build-system)
982 (arguments
983 `(#:tests? #f ; no test suite, only for visual control
984 #:python ,python-2))
985 (inputs
986 ;; pdfposter 0.6.0 still uses the old pyPdf
987 `(("python2-pypdf" ,python2-pypdf)))
988 (home-page "https://pythonhosted.org/pdftools.pdfposter/")
989 (synopsis "Scale and tile PDF images/pages to print on multiple pages")
990 (description "@command{pdfposter} can be used to create a large poster by
991 building it from multple pages and/or printing it on large media. It expects
992 as input a PDF file, normally printing on a single page. The output is again
993 a PDF file, maybe containing multiple pages together building the poster. The
994 input page will be scaled to obtain the desired size.
995
996 This is much like @command{poster} does for Postscript files, but working with
997 PDF. Since sometimes @command{poster} does not like your files converted from
998 PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
999 (license license:gpl3+)))
1000
1001 (define-public pdfgrep
1002 (package
1003 (name "pdfgrep")
1004 (version "2.1.1")
1005 (source
1006 (origin
1007 (method url-fetch)
1008 (uri (string-append "https://pdfgrep.org/download/"
1009 name "-" version ".tar.gz"))
1010 (sha256
1011 (base32
1012 "02qcl5kmr5qzjfc99qpbpfb1890bxlrq3r208gnding51zrmb09c"))))
1013 (build-system gnu-build-system)
1014 (native-inputs
1015 `(("pkg-config" ,pkg-config)))
1016 (inputs
1017 `(("libgcrypt" ,libgcrypt)
1018 ("pcre" ,pcre)
1019 ("poppler" ,poppler)))
1020 (home-page "https://pdfgrep.org")
1021 (synopsis "Command-line utility to search text in PDF files")
1022 (description
1023 "Pdfgrep searches in pdf files for strings matching a regular expression.
1024 Support some GNU grep options as file name output, page number output,
1025 optional case insensitivity, count occurrences, color highlights and search in
1026 multiple files.")
1027 (license license:gpl2+)))
1028
1029 (define-public pdfpc
1030 (package
1031 (name "pdfpc")
1032 (version "4.2.1")
1033 (source
1034 (origin
1035 (method git-fetch)
1036 (uri (git-reference
1037 (url "https://github.com/pdfpc/pdfpc.git")
1038 (commit (string-append "v" version))))
1039 (file-name (git-file-name name version))
1040 (sha256
1041 (base32
1042 "1rmsrpf5vlqhnyyrhq8apndny88ld2qvfjx6258653pqbimv7mx5"))))
1043 (build-system cmake-build-system)
1044 (arguments '(#:tests? #f)) ; no test target
1045 (inputs
1046 `(("cairo" ,cairo)
1047 ("gtk+" ,gtk+)
1048 ("gstreamer" ,gstreamer)
1049 ("gst-plugins-base" ,gst-plugins-base)
1050 ("libgee" ,libgee)
1051 ("poppler" ,poppler)
1052 ("pango" ,pango)
1053 ("vala" ,vala)))
1054 (native-inputs
1055 `(("pkg-config" ,pkg-config)))
1056 (home-page "https://pdfpc.github.io/")
1057 (synopsis "Presenter console with multi-monitor support for PDF files")
1058 (description
1059 "pdfpc is a presentation viewer application which uses multi-monitor
1060 output to provide meta information to the speaker during the presentation. It
1061 is able to show a normal presentation window on one screen, while showing a
1062 more sophisticated overview on the other one providing information like a
1063 picture of the next slide, as well as the left over time till the end of the
1064 presentation. The input files processed by pdfpc are PDF documents.")
1065 (license license:gpl2+)))