1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages pdf)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system python)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages ghostscript)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages djvu)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages backup)
37 #:use-module (gnu packages lesstif)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages qt)
41 #:use-module (gnu packages xorg)
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages lua)
46 #:use-module (gnu packages curl)
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages tls)
50 #:use-module (srfi srfi-1))
52 (define-public poppler
58 (uri (string-append "http://poppler.freedesktop.org/poppler-"
61 "1vjvd0md8y37hlq3lsj0l01a3v3mzm572rzpn1311frvmrg9r7xq"))))
62 (build-system gnu-build-system)
63 ;; FIXME: more dependencies could be added
64 ;; cairo output: no (requires cairo >= 1.10.0)
69 (inputs `(("fontconfig" ,fontconfig)
70 ("freetype" ,freetype)
75 ("openjpeg-1" ,openjpeg-1)
78 ;; To build poppler-glib (as needed by Evince), we need Cairo and
79 ;; GLib. But of course, that Cairo must not depend on Poppler.
80 ("cairo" ,(package (inherit cairo)
81 (inputs (alist-delete "poppler"
82 (package-inputs cairo)))))
85 `(("pkg-config" ,pkg-config)
86 ("glib" ,glib "bin"))) ; glib-mkenums, etc.
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 python-poppler-qt4
116 (name "python-poppler-qt4")
121 (uri (string-append "https://pypi.python.org/packages/source/p"
122 "/python-poppler-qt4/python-poppler-qt4-"
126 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
127 (build-system python-build-system)
130 (modify-phases %standard-phases
132 'unpack 'patch-poppler-include-paths
134 (substitute* (find-files "." "poppler-.*\\.sip")
135 (("qt4/poppler-.*\\.h" header)
136 (string-append "poppler/" header)))
139 `(("pkg-config" ,pkg-config)))
141 `(("python-sip" ,python-sip)
142 ("python-pyqt-4" ,python-pyqt-4)
143 ("poppler-qt4" ,poppler-qt4)))
144 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
145 (synopsis "Python bindings for Poppler-Qt4")
147 "This package provides Python bindings for the Qt4 interface of the
148 Poppler PDF rendering library.")
149 (license license:lgpl2.1+)))
157 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
160 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
161 (build-system gnu-build-system)
162 (inputs `(("freetype" ,freetype)
163 ("gs-fonts" ,gs-fonts)
165 ("libpaper" ,libpaper)
174 `(#:tests? #f ; there is no check target
175 #:parallel-build? #f ; build fails randomly on 8-way machines
177 (list (string-append "--with-freetype2-includes="
178 (assoc-ref %build-inputs "freetype")
179 "/include/freetype2"))
183 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
184 (let* ((install (assoc-ref %standard-phases 'install))
185 (out (assoc-ref outputs "out"))
186 (xpdfrc (string-append out "/etc/xpdfrc"))
187 (gs-fonts (assoc-ref inputs "gs-fonts")))
190 (("/usr/local/share/ghostscript/fonts")
191 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
192 (("#fontFile") "fontFile"))))
194 (synopsis "Viewer for PDF files based on the Motif toolkit")
196 "Xpdf is a viewer for Portable Document Format (PDF) files.")
197 (license license:gpl3) ; or gpl2, but not gpl2+
198 (home-page "http://www.foolabs.com/xpdf/")))
200 (define-public zathura-cb
207 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
211 "09ln4fpjxmhcq6cw1ka7mdkmca36gyd4gzrynbw3waz0ri0b277j"))))
212 (native-inputs `(("pkg-config" ,pkg-config)))
213 (propagated-inputs `(("girara" ,girara)))
214 (inputs `(("libarchive" ,libarchive)
216 ("zathura" ,zathura)))
217 (build-system gnu-build-system)
219 `(#:make-flags (list (string-append "PREFIX=" %output)
220 (string-append "PLUGINDIR=" %output "/lib/zathura")
222 #:tests? #f ; Package does not contain tests.
224 (alist-delete 'configure %standard-phases)))
225 (home-page "https://pwmt.org/projects/zathura-cb/")
226 (synopsis "Comic book support for zathura (libarchive backend)")
227 (description "The zathura-cb plugin adds comic book support to zathura
229 (license license:zlib)))
231 (define-public zathura-ps
238 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
242 "1a6ps5v1wk18qvslbkjln6w8wfzzr6fi13ls96vbdc03vdhn4m76"))))
243 (native-inputs `(("pkg-config" ,pkg-config)))
244 (propagated-inputs `(("girara" ,girara)))
245 (inputs `(("libspectre" ,libspectre)
247 ("zathura" ,zathura)))
248 (build-system gnu-build-system)
250 `(#:make-flags (list (string-append "PREFIX=" %output)
251 (string-append "PLUGINDIR=" %output "/lib/zathura")
253 #:tests? #f ; Package does not contain tests.
255 (alist-delete 'configure %standard-phases)))
256 (home-page "https://pwmt.org/projects/zathura-ps/")
257 (synopsis "PS support for zathura (libspectre backend)")
258 (description "The zathura-ps plugin adds PS support to zathura
260 (license license:zlib)))
262 (define-public zathura-djvu
264 (name "zathura-djvu")
269 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
273 "1g1lafmrjbx0xv7fljdmyqxx0k334sq4q6jy4a0q5xfrgz0bh45c"))))
274 (native-inputs `(("pkg-config" ,pkg-config)))
275 (propagated-inputs `(("girara" ,girara)))
277 `(("djvulibre" ,djvulibre)
279 ("zathura" ,zathura)))
280 (build-system gnu-build-system)
282 `(#:make-flags (list (string-append "PREFIX=" %output)
283 (string-append "PLUGINDIR=" %output "/lib/zathura")
285 #:tests? #f ; Package does not contain tests.
287 (alist-delete 'configure %standard-phases)))
288 (home-page "https://pwmt.org/projects/zathura-djvu/")
289 (synopsis "DjVu support for zathura (DjVuLibre backend)")
290 (description "The zathura-djvu plugin adds DjVu support to zathura
291 using the DjVuLibre library.")
292 (license license:zlib)))
294 (define-public zathura-pdf-poppler
296 (name "zathura-pdf-poppler")
301 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
305 "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0"))))
306 (native-inputs `(("pkg-config" ,pkg-config)))
307 (propagated-inputs `(("girara" ,girara)))
309 `(("poppler" ,poppler)
313 (build-system gnu-build-system)
315 `(#:make-flags (list (string-append "PREFIX=" %output)
316 (string-append "PLUGINDIR=" %output "/lib/zathura")
318 #:tests? #f ; Package does not include tests.
320 (alist-delete 'configure %standard-phases)))
321 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
322 (synopsis "PDF support for zathura (poppler backend)")
323 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
324 by using the poppler rendering engine.")
325 (license license:zlib)))
327 (define-public zathura
334 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
338 "1rywx09qn6ap5hb1z31wxby4lzdrqdbldm51pjk1ifflr37xwirk"))
341 (search-patch "zathura-plugindir-environment-variable.patch")))))
342 (native-inputs `(("pkg-config" ,pkg-config)
343 ("gettext" ,gnu-gettext)))
344 (inputs `(("girara" ,girara)
348 (list (search-path-specification
349 (variable "ZATHURA_PLUGIN_PATH")
350 (files '("lib/zathura")))))
351 (build-system gnu-build-system)
354 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
356 #:tests? #f ; Tests fail: "Gtk cannot open display".
359 (alist-delete 'configure %standard-phases)))
360 (home-page "https://pwmt.org/projects/zathura/")
361 (synopsis "Lightweight keyboard-driven PDF viewer")
362 (description "Zathura is a customizable document viewer. It provides a
363 minimalistic interface and an interface that mainly focuses on keyboard
365 (license license:zlib)))
367 (define-public podofo
373 (uri (string-append "mirror://sourceforge/podofo/podofo-"
377 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
378 (build-system cmake-build-system)
379 (inputs ; TODO: Add cppunit for tests
383 ("fontconfig" ,fontconfig)
385 ("libjpeg" ,libjpeg-8)
386 ("freetype" ,freetype)
389 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
390 "-DPODOFO_BUILD_STATIC=ON")
394 (lambda* (#:key inputs #:allow-other-keys)
395 (let ((freetype (assoc-ref inputs "freetype")))
396 ;; Look for freetype include files in the correct place.
397 (substitute* "cmake/modules/FindFREETYPE.cmake"
398 (("/usr/local") freetype))))
400 (home-page "http://podofo.sourceforge.net")
401 (synopsis "Tools to work with the PDF file format")
403 "PoDoFo is a C++ library and set of command-line tools to work with the
404 PDF file format. It can parse PDF files and load them into memory, and makes
405 it easy to modify them and write the changes to disk. It is primarily useful
406 for applications that wish to do lower level manipulation of PDF, such as
407 extracting content or merging files.")
408 (license license:lgpl2.0+)))
417 (uri (string-append "http://mupdf.com/downloads/archive/"
418 name "-" version "-source.tar.gz"))
420 (base32 "0qx51rj6alzcagcixm59rvdpm54w6syrwr4184v439jh14ryw4wq"))
422 (list (search-patch "mupdf-buildsystem-fix.patch")))
423 (modules '((guix build utils)))
426 ;; Don't build the bundled-in third party libraries.
427 (delete-file-recursively "thirdparty")
429 ;; Make the scripts for finding openjpeg build details executable.
430 (chmod "ojp2_cppflags.sh" #o0755)
431 (chmod "ojp2_ldflags.sh" #o0755)))))
433 (build-system gnu-build-system)
436 ("freetype" ,freetype)
437 ("jbig2dec" ,jbig2dec)
441 ("openjpeg" ,openjpeg-2.0)
445 `(("pkg-config" ,pkg-config)))
447 ;; Trying to run `$ make check' results in a no rule fault.
450 #:modules ((guix build gnu-build-system)
453 #:phases (alist-replace
455 (lambda _ (zero? (system* "make" "XCFLAGS=-fpic")))
458 (lambda* (#:key outputs #:allow-other-keys)
459 (let ((out (assoc-ref outputs "out")))
460 (zero? (system* "make" (string-append "prefix=" out)
462 (alist-delete 'configure %standard-phases)))))
463 (home-page "http://mupdf.com")
464 (synopsis "Lightweight PDF viewer and toolkit")
466 "MuPDF is a C library that implements a PDF and XPS parsing and
467 rendering engine. It is used primarily to render pages into bitmaps,
468 but also provides support for other operations such as searching and
469 listing the table of contents and hyperlinks.
471 The library ships with a rudimentary X11 viewer, and a set of command
472 line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
473 and examining the file structure (pdfshow).")
474 (license license:agpl3+)))
482 (uri (string-append "mirror://sourceforge/qpdf/qpdf-"
485 "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm"))))
486 (build-system gnu-build-system)
488 '(#:phases (alist-cons-before
489 'configure 'patch-paths
491 (substitute* "make/libtool.mk"
493 (string-append "SHELL=" (which "bash"))))
495 '("qtest/bin/qtest-driver")
496 (find-files "." "\\.test"))
497 (("/usr/bin/env") (which "env"))))
500 `(("pkg-config" ,pkg-config)))
506 (synopsis "Command-line tools and library for transforming PDF files")
508 "QPDF is a command-line program that does structural, content-preserving
509 transformations on PDF files. It could have been called something like
510 pdf-to-pdf. It includes support for merging and splitting PDFs and to
511 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
512 program capable of converting PDF into other formats.")
513 (license license:clarified-artistic)
514 (home-page "http://qpdf.sourceforge.net/")))
516 (define-public xournal
523 (uri (string-append "mirror://sourceforge/xournal/xournal-"
527 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
528 (build-system gnu-build-system)
534 ("libgnomecanvas" ,libgnomecanvas)))
536 `(("pkg-config" ,pkg-config)))
537 (home-page "http://xournal.sourceforge.net/")
538 (synopsis "Notetaking using a stylus")
540 "Xournal is an application for notetaking, sketching, keeping a journal
542 (license license:gpl2+)))