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