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