Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / pdf.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
6 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages pdf)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system cmake)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages fontutils)
34 #:use-module (gnu packages ghostscript)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages djvu)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages backup)
39 #:use-module (gnu packages lesstif)
40 #:use-module (gnu packages image)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages qt)
43 #:use-module (gnu packages xorg)
44 #:use-module (gnu packages gnome)
45 #:use-module (gnu packages glib)
46 #:use-module (gnu packages gtk)
47 #:use-module (gnu packages lua)
48 #:use-module (gnu packages curl)
49 #:use-module (gnu packages pcre)
50 #:use-module (gnu packages perl)
51 #:use-module (gnu packages tls)
52 #:use-module (srfi srfi-1))
53
54 (define-public poppler
55 (package
56 (name "poppler")
57 (version "0.43.0")
58 (source (origin
59 (method url-fetch)
60 (uri (string-append "https://poppler.freedesktop.org/poppler-"
61 version ".tar.xz"))
62 (sha256
63 (base32
64 "0mi4zf0pz3x3fx3ir7szz1n57nywgbpd4mp2r7mvf47f4rmf4867"))))
65 (build-system gnu-build-system)
66 ;; FIXME:
67 ;; use libcurl: no
68 (inputs `(("fontconfig" ,fontconfig)
69 ("freetype" ,freetype)
70 ("libjpeg" ,libjpeg)
71 ("libpng" ,libpng)
72 ("libtiff" ,libtiff)
73 ("lcms" ,lcms)
74 ("openjpeg-1" ,openjpeg-1)
75 ("zlib" ,zlib)
76
77 ;; To build poppler-glib (as needed by Evince), we need Cairo and
78 ;; GLib. But of course, that Cairo must not depend on Poppler.
79 ("cairo" ,(package (inherit cairo)
80 (inputs (alist-delete "poppler"
81 (package-inputs cairo)))))
82 ("glib" ,glib)))
83 (native-inputs
84 `(("pkg-config" ,pkg-config)
85 ("glib" ,glib "bin") ; glib-mkenums, etc.
86 ("gobject-introspection" ,gobject-introspection)))
87 (arguments
88 `(#:tests? #f ; no test data provided with the tarball
89 #:configure-flags
90 '("--enable-xpdf-headers" ; to install header files
91 "--enable-zlib"
92
93 ;; Saves 8 MiB of .a files.
94 "--disable-static")
95 #:phases
96 (alist-cons-before
97 'configure 'setenv
98 (lambda _
99 (setenv "CPATH"
100 (string-append (assoc-ref %build-inputs "openjpeg-1")
101 "/include/openjpeg-1.5"
102 ":" (or (getenv "CPATH") ""))))
103 %standard-phases)))
104 (synopsis "PDF rendering library")
105 (description
106 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
107 (license license:gpl2+)
108 (home-page "http://poppler.freedesktop.org/")))
109
110 (define-public poppler-qt4
111 (package (inherit poppler)
112 (name "poppler-qt4")
113 (inputs `(("qt-4" ,qt-4)
114 ,@(package-inputs poppler)))
115 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
116
117 (define-public poppler-qt5
118 (package (inherit poppler)
119 (name "poppler-qt5")
120 (inputs `(("qt" ,qt)
121 ,@(package-inputs poppler)))
122 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
123
124 (define-public python-poppler-qt4
125 (package
126 (name "python-poppler-qt4")
127 (version "0.24.0")
128 (source
129 (origin
130 (method url-fetch)
131 (uri (string-append "https://pypi.python.org/packages/source/p"
132 "/python-poppler-qt4/python-poppler-qt4-"
133 version ".tar.gz"))
134 (sha256
135 (base32
136 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
137 (build-system python-build-system)
138 (arguments
139 `(#:phases
140 (modify-phases %standard-phases
141 (add-after
142 'unpack 'patch-poppler-include-paths
143 (lambda _
144 (substitute* (find-files "." "poppler-.*\\.sip")
145 (("qt4/poppler-.*\\.h" header)
146 (string-append "poppler/" header)))
147 #t)))))
148 (native-inputs
149 `(("pkg-config" ,pkg-config)))
150 (inputs
151 `(("python-sip" ,python-sip)
152 ("python-pyqt-4" ,python-pyqt-4)
153 ("poppler-qt4" ,poppler-qt4)))
154 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
155 (synopsis "Python bindings for Poppler-Qt4")
156 (description
157 "This package provides Python bindings for the Qt4 interface of the
158 Poppler PDF rendering library.")
159 (license license:lgpl2.1+)))
160
161 (define-public libharu
162 (package
163 (name "libharu")
164 (version "2.3.0")
165 (source (origin
166 (method url-fetch)
167 (uri (string-append "https://github.com/libharu/libharu/archive/"
168 "RELEASE_"
169 (string-join (string-split version #\.) "_")
170 ".tar.gz"))
171 (file-name (string-append name "-" version ".tar.gz"))
172 (sha256
173 (base32
174 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
175 (build-system gnu-build-system)
176 (arguments
177 `(#:configure-flags
178 (list (string-append "--with-zlib="
179 (assoc-ref %build-inputs "zlib"))
180 (string-append "--with-png="
181 (assoc-ref %build-inputs "libpng")))
182 #:phases
183 (modify-phases %standard-phases
184 (add-before 'configure 'autogen
185 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
186 (inputs
187 `(("zlib" ,zlib)
188 ("libpng" ,libpng)))
189 (native-inputs
190 `(("autoconf" ,autoconf)
191 ("automake" ,automake)
192 ("libtool" ,libtool)))
193 (home-page "http://libharu.org/")
194 (synopsis "Library for generating PDF files")
195 (description
196 "libHaru is a library for generating PDF files. libHaru does not support
197 reading and editing of existing PDF files.")
198 (license license:zlib)))
199
200 (define-public xpdf
201 (package
202 (name "xpdf")
203 (version "3.04")
204 (source (origin
205 (method url-fetch)
206 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
207 version ".tar.gz"))
208 (sha256 (base32
209 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
210 (build-system gnu-build-system)
211 (inputs `(("freetype" ,freetype)
212 ("gs-fonts" ,gs-fonts)
213 ("lesstif" ,lesstif)
214 ("libpaper" ,libpaper)
215 ("libx11" ,libx11)
216 ("libxext" ,libxext)
217 ("libxp" ,libxp)
218 ("libxpm" ,libxpm)
219 ("libxt" ,libxt)
220 ("libpng" ,libpng)
221 ("zlib" ,zlib)))
222 (arguments
223 `(#:tests? #f ; there is no check target
224 #:parallel-build? #f ; build fails randomly on 8-way machines
225 #:configure-flags
226 (list (string-append "--with-freetype2-includes="
227 (assoc-ref %build-inputs "freetype")
228 "/include/freetype2"))
229 #:phases
230 (alist-replace
231 'install
232 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
233 (let* ((install (assoc-ref %standard-phases 'install))
234 (out (assoc-ref outputs "out"))
235 (xpdfrc (string-append out "/etc/xpdfrc"))
236 (gs-fonts (assoc-ref inputs "gs-fonts")))
237 (apply install args)
238 (substitute* xpdfrc
239 (("/usr/local/share/ghostscript/fonts")
240 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
241 (("#fontFile") "fontFile"))))
242 %standard-phases)))
243 (synopsis "Viewer for PDF files based on the Motif toolkit")
244 (description
245 "Xpdf is a viewer for Portable Document Format (PDF) files.")
246 (license license:gpl3) ; or gpl2, but not gpl2+
247 (home-page "http://www.foolabs.com/xpdf/")))
248
249 (define-public zathura-cb
250 (package
251 (name "zathura-cb")
252 (version "0.1.4")
253 (source (origin
254 (method url-fetch)
255 (uri
256 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
257 version ".tar.gz"))
258 (sha256
259 (base32
260 "09ln4fpjxmhcq6cw1ka7mdkmca36gyd4gzrynbw3waz0ri0b277j"))))
261 (native-inputs `(("pkg-config" ,pkg-config)))
262 (propagated-inputs `(("girara" ,girara)))
263 (inputs `(("libarchive" ,libarchive)
264 ("gtk+" ,gtk+)
265 ("zathura" ,zathura)))
266 (build-system gnu-build-system)
267 (arguments
268 `(#:make-flags (list (string-append "PREFIX=" %output)
269 (string-append "PLUGINDIR=" %output "/lib/zathura")
270 "CC=gcc")
271 #:tests? #f ; Package does not contain tests.
272 #:phases
273 (alist-delete 'configure %standard-phases)))
274 (home-page "https://pwmt.org/projects/zathura-cb/")
275 (synopsis "Comic book support for zathura (libarchive backend)")
276 (description "The zathura-cb plugin adds comic book support to zathura
277 using libarchive.")
278 (license license:zlib)))
279
280 (define-public zathura-ps
281 (package
282 (name "zathura-ps")
283 (version "0.2.2")
284 (source (origin
285 (method url-fetch)
286 (uri
287 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
288 version ".tar.gz"))
289 (sha256
290 (base32
291 "1a6ps5v1wk18qvslbkjln6w8wfzzr6fi13ls96vbdc03vdhn4m76"))))
292 (native-inputs `(("pkg-config" ,pkg-config)))
293 (propagated-inputs `(("girara" ,girara)))
294 (inputs `(("libspectre" ,libspectre)
295 ("gtk+" ,gtk+)
296 ("zathura" ,zathura)))
297 (build-system gnu-build-system)
298 (arguments
299 `(#:make-flags (list (string-append "PREFIX=" %output)
300 (string-append "PLUGINDIR=" %output "/lib/zathura")
301 "CC=gcc")
302 #:tests? #f ; Package does not contain tests.
303 #:phases
304 (alist-delete 'configure %standard-phases)))
305 (home-page "https://pwmt.org/projects/zathura-ps/")
306 (synopsis "PS support for zathura (libspectre backend)")
307 (description "The zathura-ps plugin adds PS support to zathura
308 using libspectre.")
309 (license license:zlib)))
310
311 (define-public zathura-djvu
312 (package
313 (name "zathura-djvu")
314 (version "0.2.4")
315 (source (origin
316 (method url-fetch)
317 (uri
318 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
319 version ".tar.gz"))
320 (sha256
321 (base32
322 "1g1lafmrjbx0xv7fljdmyqxx0k334sq4q6jy4a0q5xfrgz0bh45c"))))
323 (native-inputs `(("pkg-config" ,pkg-config)))
324 (propagated-inputs `(("girara" ,girara)))
325 (inputs
326 `(("djvulibre" ,djvulibre)
327 ("gtk+" ,gtk+)
328 ("zathura" ,zathura)))
329 (build-system gnu-build-system)
330 (arguments
331 `(#:make-flags (list (string-append "PREFIX=" %output)
332 (string-append "PLUGINDIR=" %output "/lib/zathura")
333 "CC=gcc")
334 #:tests? #f ; Package does not contain tests.
335 #:phases
336 (alist-delete 'configure %standard-phases)))
337 (home-page "https://pwmt.org/projects/zathura-djvu/")
338 (synopsis "DjVu support for zathura (DjVuLibre backend)")
339 (description "The zathura-djvu plugin adds DjVu support to zathura
340 using the DjVuLibre library.")
341 (license license:zlib)))
342
343 (define-public zathura-pdf-poppler
344 (package
345 (name "zathura-pdf-poppler")
346 (version "0.2.5")
347 (source (origin
348 (method url-fetch)
349 (uri
350 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
351 version ".tar.gz"))
352 (sha256
353 (base32
354 "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0"))))
355 (native-inputs `(("pkg-config" ,pkg-config)))
356 (propagated-inputs `(("girara" ,girara)))
357 (inputs
358 `(("poppler" ,poppler)
359 ("gtk+" ,gtk+)
360 ("zathura" ,zathura)
361 ("cairo" ,cairo)))
362 (build-system gnu-build-system)
363 (arguments
364 `(#:make-flags (list (string-append "PREFIX=" %output)
365 (string-append "PLUGINDIR=" %output "/lib/zathura")
366 "CC=gcc")
367 #:tests? #f ; Package does not include tests.
368 #:phases
369 (alist-delete 'configure %standard-phases)))
370 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
371 (synopsis "PDF support for zathura (poppler backend)")
372 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
373 by using the poppler rendering engine.")
374 (license license:zlib)))
375
376 (define-public zathura
377 (package
378 (name "zathura")
379 (version "0.3.3")
380 (source (origin
381 (method url-fetch)
382 (uri
383 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
384 version ".tar.gz"))
385 (sha256
386 (base32
387 "1rywx09qn6ap5hb1z31wxby4lzdrqdbldm51pjk1ifflr37xwirk"))
388 (patches (search-patches
389 "zathura-plugindir-environment-variable.patch"))))
390 (native-inputs `(("pkg-config" ,pkg-config)
391 ("gettext" ,gnu-gettext)))
392 (inputs `(("girara" ,girara)
393 ("sqlite" ,sqlite)
394 ("gtk+" ,gtk+)))
395 (native-search-paths
396 (list (search-path-specification
397 (variable "ZATHURA_PLUGIN_PATH")
398 (files '("lib/zathura")))))
399 (build-system gnu-build-system)
400 (arguments
401 `(#:make-flags
402 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
403 "CC=gcc" "COLOR=0")
404 #:tests? #f ; Tests fail: "Gtk cannot open display".
405 #:test-target "test"
406 #:phases
407 (alist-delete 'configure %standard-phases)))
408 (home-page "https://pwmt.org/projects/zathura/")
409 (synopsis "Lightweight keyboard-driven PDF viewer")
410 (description "Zathura is a customizable document viewer. It provides a
411 minimalistic interface and an interface that mainly focuses on keyboard
412 interaction.")
413 (license license:zlib)))
414
415 (define-public podofo
416 (package
417 (name "podofo")
418 (version "0.9.3")
419 (source (origin
420 (method url-fetch)
421 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
422 "/podofo-" version ".tar.gz"))
423 (sha256
424 (base32
425 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
426 (build-system cmake-build-system)
427 (inputs ; TODO: Add cppunit for tests
428 `(("lua" ,lua-5.1)
429 ("libpng" ,libpng)
430 ("openssl" ,openssl)
431 ("fontconfig" ,fontconfig)
432 ("libtiff" ,libtiff)
433 ("libjpeg" ,libjpeg-8)
434 ("freetype" ,freetype)
435 ("zlib" ,zlib)))
436 (arguments
437 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
438 "-DPODOFO_BUILD_STATIC=ON")
439 #:phases
440 (alist-cons-before
441 'configure 'patch
442 (lambda* (#:key inputs #:allow-other-keys)
443 (let ((freetype (assoc-ref inputs "freetype")))
444 ;; Look for freetype include files in the correct place.
445 (substitute* "cmake/modules/FindFREETYPE.cmake"
446 (("/usr/local") freetype))))
447 %standard-phases)))
448 (home-page "http://podofo.sourceforge.net")
449 (synopsis "Tools to work with the PDF file format")
450 (description
451 "PoDoFo is a C++ library and set of command-line tools to work with the
452 PDF file format. It can parse PDF files and load them into memory, and makes
453 it easy to modify them and write the changes to disk. It is primarily useful
454 for applications that wish to do lower level manipulation of PDF, such as
455 extracting content or merging files.")
456 (license license:lgpl2.0+)))
457
458 (define-public mupdf
459 (package
460 (name "mupdf")
461 (version "1.8")
462 (source
463 (origin
464 (method url-fetch)
465 (uri (string-append "http://mupdf.com/downloads/archive/"
466 name "-" version "-source.tar.gz"))
467 (sha256
468 (base32 "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2"))
469 (modules '((guix build utils)))
470 (snippet
471 ;; Don't build the bundled-in third party libraries.
472 '(delete-file-recursively "thirdparty"))))
473 (build-system gnu-build-system)
474 (inputs
475 `(("curl" ,curl)
476 ("freetype" ,freetype)
477 ("jbig2dec" ,jbig2dec)
478 ("libjpeg" ,libjpeg)
479 ("libx11" ,libx11)
480 ("libxext" ,libxext)
481 ("openjpeg" ,openjpeg-2.0)
482 ("openssl" ,openssl)
483 ("zlib" ,zlib)))
484 (native-inputs
485 `(("pkg-config" ,pkg-config)))
486 (arguments
487 '(#:tests? #f ; no check target
488 #:make-flags (list "CC=gcc"
489 "XCFLAGS=-fpic"
490 (string-append "prefix=" (assoc-ref %outputs "out")))
491 #:phases (modify-phases %standard-phases
492 (delete 'configure))))
493 (home-page "http://mupdf.com")
494 (synopsis "Lightweight PDF viewer and toolkit")
495 (description
496 "MuPDF is a C library that implements a PDF and XPS parsing and
497 rendering engine. It is used primarily to render pages into bitmaps,
498 but also provides support for other operations such as searching and
499 listing the table of contents and hyperlinks.
500
501 The library ships with a rudimentary X11 viewer, and a set of command
502 line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
503 and examining the file structure (pdfshow).")
504 (license license:agpl3+)))
505
506 (define-public qpdf
507 (package
508 (name "qpdf")
509 (version "5.1.3")
510 (source (origin
511 (method url-fetch)
512 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
513 "/qpdf-" version ".tar.gz"))
514 (sha256 (base32
515 "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm"))
516 (modules '((guix build utils)))
517 (snippet
518 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
519 ;; dependency on Perl.
520 '(substitute* "qpdf/fix-qdf"
521 (("#!/usr/bin/env perl")
522 "\
523 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
524 & eval 'exec perl -wS \"$0\" $argv:q'
525 if 0;\n")))))
526 (build-system gnu-build-system)
527 (arguments
528 `(#:disallowed-references (,perl)
529 #:phases (alist-cons-before
530 'configure 'patch-paths
531 (lambda _
532 (substitute* "make/libtool.mk"
533 (("SHELL=/bin/bash")
534 (string-append "SHELL=" (which "bash"))))
535 (substitute* (append
536 '("qtest/bin/qtest-driver")
537 (find-files "." "\\.test"))
538 (("/usr/bin/env") (which "env"))))
539 %standard-phases)))
540 (native-inputs
541 `(("pkg-config" ,pkg-config)
542 ("perl" ,perl)))
543 (propagated-inputs
544 `(("pcre" ,pcre)))
545 (inputs
546 `(("zlib" ,zlib)))
547 (synopsis "Command-line tools and library for transforming PDF files")
548 (description
549 "QPDF is a command-line program that does structural, content-preserving
550 transformations on PDF files. It could have been called something like
551 pdf-to-pdf. It includes support for merging and splitting PDFs and to
552 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
553 program capable of converting PDF into other formats.")
554 (license license:clarified-artistic)
555 (home-page "http://qpdf.sourceforge.net/")))
556
557 (define-public xournal
558 (package
559 (name "xournal")
560 (version "0.4.8")
561 (source
562 (origin
563 (method url-fetch)
564 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
565 "/xournal-" version ".tar.gz"))
566 (sha256
567 (base32
568 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
569 (build-system gnu-build-system)
570 (inputs
571 `(("gtk" ,gtk+-2)
572 ("pango" ,pango)
573 ("poppler" ,poppler)
574 ("glib" ,glib)
575 ("libgnomecanvas" ,libgnomecanvas)))
576 (native-inputs
577 `(("pkg-config" ,pkg-config)))
578 (home-page "http://xournal.sourceforge.net/")
579 (synopsis "Notetaking using a stylus")
580 (description
581 "Xournal is an application for notetaking, sketching, keeping a journal
582 using a stylus.")
583 (license license:gpl2+)))