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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
54 (define-public poppler
60 (uri (string-append "https://poppler.freedesktop.org/poppler-"
64 "0mi4zf0pz3x3fx3ir7szz1n57nywgbpd4mp2r7mvf47f4rmf4867"))))
65 (build-system gnu-build-system)
68 (inputs `(("fontconfig" ,fontconfig)
69 ("freetype" ,freetype)
74 ("openjpeg-1" ,openjpeg-1)
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)))))
84 `(("pkg-config" ,pkg-config)
85 ("glib" ,glib "bin") ; glib-mkenums, etc.
86 ("gobject-introspection" ,gobject-introspection)))
88 `(#:tests? #f ; no test data provided with the tarball
90 '("--enable-xpdf-headers" ; to install header files
97 (string-append (assoc-ref %build-inputs "openjpeg-1")
98 "/include/openjpeg-1.5"
99 ":" (or (getenv "CPATH") ""))))
101 (synopsis "PDF rendering library")
103 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
104 (license license:gpl2+)
105 (home-page "http://poppler.freedesktop.org/")))
107 (define-public poppler-qt4
108 (package (inherit poppler)
110 (inputs `(("qt-4" ,qt-4)
111 ,@(package-inputs poppler)))
112 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
114 (define-public poppler-qt5
115 (package (inherit poppler)
118 ,@(package-inputs poppler)))
119 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
121 (define-public python-poppler-qt4
123 (name "python-poppler-qt4")
128 (uri (string-append "https://pypi.python.org/packages/source/p"
129 "/python-poppler-qt4/python-poppler-qt4-"
133 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
134 (build-system python-build-system)
137 (modify-phases %standard-phases
139 'unpack 'patch-poppler-include-paths
141 (substitute* (find-files "." "poppler-.*\\.sip")
142 (("qt4/poppler-.*\\.h" header)
143 (string-append "poppler/" header)))
146 `(("pkg-config" ,pkg-config)))
148 `(("python-sip" ,python-sip)
149 ("python-pyqt-4" ,python-pyqt-4)
150 ("poppler-qt4" ,poppler-qt4)))
151 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
152 (synopsis "Python bindings for Poppler-Qt4")
154 "This package provides Python bindings for the Qt4 interface of the
155 Poppler PDF rendering library.")
156 (license license:lgpl2.1+)))
158 (define-public libharu
164 (uri (string-append "https://github.com/libharu/libharu/archive/"
166 (string-join (string-split version #\.) "_")
168 (file-name (string-append name "-" version ".tar.gz"))
171 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
172 (build-system gnu-build-system)
175 (list (string-append "--with-zlib="
176 (assoc-ref %build-inputs "zlib"))
177 (string-append "--with-png="
178 (assoc-ref %build-inputs "libpng")))
180 (modify-phases %standard-phases
181 (add-before 'configure 'autogen
182 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
187 `(("autoconf" ,autoconf)
188 ("automake" ,automake)
189 ("libtool" ,libtool)))
190 (home-page "http://libharu.org/")
191 (synopsis "Library for generating PDF files")
193 "libHaru is a library for generating PDF files. libHaru does not support
194 reading and editing of existing PDF files.")
195 (license license:zlib)))
203 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
206 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
207 (build-system gnu-build-system)
208 (inputs `(("freetype" ,freetype)
209 ("gs-fonts" ,gs-fonts)
211 ("libpaper" ,libpaper)
220 `(#:tests? #f ; there is no check target
221 #:parallel-build? #f ; build fails randomly on 8-way machines
223 (list (string-append "--with-freetype2-includes="
224 (assoc-ref %build-inputs "freetype")
225 "/include/freetype2"))
229 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
230 (let* ((install (assoc-ref %standard-phases 'install))
231 (out (assoc-ref outputs "out"))
232 (xpdfrc (string-append out "/etc/xpdfrc"))
233 (gs-fonts (assoc-ref inputs "gs-fonts")))
236 (("/usr/local/share/ghostscript/fonts")
237 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
238 (("#fontFile") "fontFile"))))
240 (synopsis "Viewer for PDF files based on the Motif toolkit")
242 "Xpdf is a viewer for Portable Document Format (PDF) files.")
243 (license license:gpl3) ; or gpl2, but not gpl2+
244 (home-page "http://www.foolabs.com/xpdf/")))
246 (define-public zathura-cb
253 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
257 "09ln4fpjxmhcq6cw1ka7mdkmca36gyd4gzrynbw3waz0ri0b277j"))))
258 (native-inputs `(("pkg-config" ,pkg-config)))
259 (propagated-inputs `(("girara" ,girara)))
260 (inputs `(("libarchive" ,libarchive)
262 ("zathura" ,zathura)))
263 (build-system gnu-build-system)
265 `(#:make-flags (list (string-append "PREFIX=" %output)
266 (string-append "PLUGINDIR=" %output "/lib/zathura")
268 #:tests? #f ; Package does not contain tests.
270 (alist-delete 'configure %standard-phases)))
271 (home-page "https://pwmt.org/projects/zathura-cb/")
272 (synopsis "Comic book support for zathura (libarchive backend)")
273 (description "The zathura-cb plugin adds comic book support to zathura
275 (license license:zlib)))
277 (define-public zathura-ps
284 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
288 "1a6ps5v1wk18qvslbkjln6w8wfzzr6fi13ls96vbdc03vdhn4m76"))))
289 (native-inputs `(("pkg-config" ,pkg-config)))
290 (propagated-inputs `(("girara" ,girara)))
291 (inputs `(("libspectre" ,libspectre)
293 ("zathura" ,zathura)))
294 (build-system gnu-build-system)
296 `(#:make-flags (list (string-append "PREFIX=" %output)
297 (string-append "PLUGINDIR=" %output "/lib/zathura")
299 #:tests? #f ; Package does not contain tests.
301 (alist-delete 'configure %standard-phases)))
302 (home-page "https://pwmt.org/projects/zathura-ps/")
303 (synopsis "PS support for zathura (libspectre backend)")
304 (description "The zathura-ps plugin adds PS support to zathura
306 (license license:zlib)))
308 (define-public zathura-djvu
310 (name "zathura-djvu")
315 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
319 "1g1lafmrjbx0xv7fljdmyqxx0k334sq4q6jy4a0q5xfrgz0bh45c"))))
320 (native-inputs `(("pkg-config" ,pkg-config)))
321 (propagated-inputs `(("girara" ,girara)))
323 `(("djvulibre" ,djvulibre)
325 ("zathura" ,zathura)))
326 (build-system gnu-build-system)
328 `(#:make-flags (list (string-append "PREFIX=" %output)
329 (string-append "PLUGINDIR=" %output "/lib/zathura")
331 #:tests? #f ; Package does not contain tests.
333 (alist-delete 'configure %standard-phases)))
334 (home-page "https://pwmt.org/projects/zathura-djvu/")
335 (synopsis "DjVu support for zathura (DjVuLibre backend)")
336 (description "The zathura-djvu plugin adds DjVu support to zathura
337 using the DjVuLibre library.")
338 (license license:zlib)))
340 (define-public zathura-pdf-poppler
342 (name "zathura-pdf-poppler")
347 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
351 "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0"))))
352 (native-inputs `(("pkg-config" ,pkg-config)))
353 (propagated-inputs `(("girara" ,girara)))
355 `(("poppler" ,poppler)
359 (build-system gnu-build-system)
361 `(#:make-flags (list (string-append "PREFIX=" %output)
362 (string-append "PLUGINDIR=" %output "/lib/zathura")
364 #:tests? #f ; Package does not include tests.
366 (alist-delete 'configure %standard-phases)))
367 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
368 (synopsis "PDF support for zathura (poppler backend)")
369 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
370 by using the poppler rendering engine.")
371 (license license:zlib)))
373 (define-public zathura
380 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
384 "1rywx09qn6ap5hb1z31wxby4lzdrqdbldm51pjk1ifflr37xwirk"))
385 (patches (search-patches
386 "zathura-plugindir-environment-variable.patch"))))
387 (native-inputs `(("pkg-config" ,pkg-config)
388 ("gettext" ,gnu-gettext)))
389 (inputs `(("girara" ,girara)
393 (list (search-path-specification
394 (variable "ZATHURA_PLUGIN_PATH")
395 (files '("lib/zathura")))))
396 (build-system gnu-build-system)
399 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
401 #:tests? #f ; Tests fail: "Gtk cannot open display".
404 (alist-delete 'configure %standard-phases)))
405 (home-page "https://pwmt.org/projects/zathura/")
406 (synopsis "Lightweight keyboard-driven PDF viewer")
407 (description "Zathura is a customizable document viewer. It provides a
408 minimalistic interface and an interface that mainly focuses on keyboard
410 (license license:zlib)))
412 (define-public podofo
418 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
419 "/podofo-" version ".tar.gz"))
422 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
423 (build-system cmake-build-system)
424 (inputs ; TODO: Add cppunit for tests
428 ("fontconfig" ,fontconfig)
430 ("libjpeg" ,libjpeg-8)
431 ("freetype" ,freetype)
434 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
435 "-DPODOFO_BUILD_STATIC=ON")
439 (lambda* (#:key inputs #:allow-other-keys)
440 (let ((freetype (assoc-ref inputs "freetype")))
441 ;; Look for freetype include files in the correct place.
442 (substitute* "cmake/modules/FindFREETYPE.cmake"
443 (("/usr/local") freetype))))
445 (home-page "http://podofo.sourceforge.net")
446 (synopsis "Tools to work with the PDF file format")
448 "PoDoFo is a C++ library and set of command-line tools to work with the
449 PDF file format. It can parse PDF files and load them into memory, and makes
450 it easy to modify them and write the changes to disk. It is primarily useful
451 for applications that wish to do lower level manipulation of PDF, such as
452 extracting content or merging files.")
453 (license license:lgpl2.0+)))
462 (uri (string-append "http://mupdf.com/downloads/archive/"
463 name "-" version "-source.tar.gz"))
465 (base32 "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2"))
466 (modules '((guix build utils)))
468 ;; Don't build the bundled-in third party libraries.
469 '(delete-file-recursively "thirdparty"))))
470 (build-system gnu-build-system)
473 ("freetype" ,freetype)
474 ("jbig2dec" ,jbig2dec)
478 ("openjpeg" ,openjpeg-2.0)
482 `(("pkg-config" ,pkg-config)))
484 '(#:tests? #f ; no check target
485 #:make-flags (list "CC=gcc"
487 (string-append "prefix=" (assoc-ref %outputs "out")))
488 #:phases (modify-phases %standard-phases
489 (delete 'configure))))
490 (home-page "http://mupdf.com")
491 (synopsis "Lightweight PDF viewer and toolkit")
493 "MuPDF is a C library that implements a PDF and XPS parsing and
494 rendering engine. It is used primarily to render pages into bitmaps,
495 but also provides support for other operations such as searching and
496 listing the table of contents and hyperlinks.
498 The library ships with a rudimentary X11 viewer, and a set of command
499 line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
500 and examining the file structure (pdfshow).")
501 (license license:agpl3+)))
509 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
510 "/qpdf-" version ".tar.gz"))
512 "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm"))))
513 (build-system gnu-build-system)
515 '(#:phases (alist-cons-before
516 'configure 'patch-paths
518 (substitute* "make/libtool.mk"
520 (string-append "SHELL=" (which "bash"))))
522 '("qtest/bin/qtest-driver")
523 (find-files "." "\\.test"))
524 (("/usr/bin/env") (which "env"))))
527 `(("pkg-config" ,pkg-config)))
533 (synopsis "Command-line tools and library for transforming PDF files")
535 "QPDF is a command-line program that does structural, content-preserving
536 transformations on PDF files. It could have been called something like
537 pdf-to-pdf. It includes support for merging and splitting PDFs and to
538 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
539 program capable of converting PDF into other formats.")
540 (license license:clarified-artistic)
541 (home-page "http://qpdf.sourceforge.net/")))
543 (define-public xournal
550 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
551 "/xournal-" version ".tar.gz"))
554 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
555 (build-system gnu-build-system)
561 ("libgnomecanvas" ,libgnomecanvas)))
563 `(("pkg-config" ,pkg-config)))
564 (home-page "http://xournal.sourceforge.net/")
565 (synopsis "Notetaking using a stylus")
567 "Xournal is an application for notetaking, sketching, keeping a journal
569 (license license:gpl2+)))