gnu: Update URLs for sourceforge.net.
[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 #:phases
93 (alist-cons-before
94 'configure 'setenv
95 (lambda _
96 (setenv "CPATH"
97 (string-append (assoc-ref %build-inputs "openjpeg-1")
98 "/include/openjpeg-1.5"
99 ":" (or (getenv "CPATH") ""))))
100 %standard-phases)))
101 (synopsis "PDF rendering library")
102 (description
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/")))
106
107 (define-public poppler-qt4
108 (package (inherit poppler)
109 (name "poppler-qt4")
110 (inputs `(("qt-4" ,qt-4)
111 ,@(package-inputs poppler)))
112 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
113
114 (define-public poppler-qt5
115 (package (inherit poppler)
116 (name "poppler-qt5")
117 (inputs `(("qt" ,qt)
118 ,@(package-inputs poppler)))
119 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
120
121 (define-public python-poppler-qt4
122 (package
123 (name "python-poppler-qt4")
124 (version "0.24.0")
125 (source
126 (origin
127 (method url-fetch)
128 (uri (string-append "https://pypi.python.org/packages/source/p"
129 "/python-poppler-qt4/python-poppler-qt4-"
130 version ".tar.gz"))
131 (sha256
132 (base32
133 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
134 (build-system python-build-system)
135 (arguments
136 `(#:phases
137 (modify-phases %standard-phases
138 (add-after
139 'unpack 'patch-poppler-include-paths
140 (lambda _
141 (substitute* (find-files "." "poppler-.*\\.sip")
142 (("qt4/poppler-.*\\.h" header)
143 (string-append "poppler/" header)))
144 #t)))))
145 (native-inputs
146 `(("pkg-config" ,pkg-config)))
147 (inputs
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")
153 (description
154 "This package provides Python bindings for the Qt4 interface of the
155 Poppler PDF rendering library.")
156 (license license:lgpl2.1+)))
157
158 (define-public libharu
159 (package
160 (name "libharu")
161 (version "2.3.0")
162 (source (origin
163 (method url-fetch)
164 (uri (string-append "https://github.com/libharu/libharu/archive/"
165 "RELEASE_"
166 (string-join (string-split version #\.) "_")
167 ".tar.gz"))
168 (file-name (string-append name "-" version ".tar.gz"))
169 (sha256
170 (base32
171 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
172 (build-system gnu-build-system)
173 (arguments
174 `(#:configure-flags
175 (list (string-append "--with-zlib="
176 (assoc-ref %build-inputs "zlib"))
177 (string-append "--with-png="
178 (assoc-ref %build-inputs "libpng")))
179 #:phases
180 (modify-phases %standard-phases
181 (add-before 'configure 'autogen
182 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
183 (inputs
184 `(("zlib" ,zlib)
185 ("libpng" ,libpng)))
186 (native-inputs
187 `(("autoconf" ,autoconf)
188 ("automake" ,automake)
189 ("libtool" ,libtool)))
190 (home-page "http://libharu.org/")
191 (synopsis "Library for generating PDF files")
192 (description
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)))
196
197 (define-public xpdf
198 (package
199 (name "xpdf")
200 (version "3.04")
201 (source (origin
202 (method url-fetch)
203 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
204 version ".tar.gz"))
205 (sha256 (base32
206 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
207 (build-system gnu-build-system)
208 (inputs `(("freetype" ,freetype)
209 ("gs-fonts" ,gs-fonts)
210 ("lesstif" ,lesstif)
211 ("libpaper" ,libpaper)
212 ("libx11" ,libx11)
213 ("libxext" ,libxext)
214 ("libxp" ,libxp)
215 ("libxpm" ,libxpm)
216 ("libxt" ,libxt)
217 ("libpng" ,libpng)
218 ("zlib" ,zlib)))
219 (arguments
220 `(#:tests? #f ; there is no check target
221 #:parallel-build? #f ; build fails randomly on 8-way machines
222 #:configure-flags
223 (list (string-append "--with-freetype2-includes="
224 (assoc-ref %build-inputs "freetype")
225 "/include/freetype2"))
226 #:phases
227 (alist-replace
228 'install
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")))
234 (apply install args)
235 (substitute* xpdfrc
236 (("/usr/local/share/ghostscript/fonts")
237 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
238 (("#fontFile") "fontFile"))))
239 %standard-phases)))
240 (synopsis "Viewer for PDF files based on the Motif toolkit")
241 (description
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/")))
245
246 (define-public zathura-cb
247 (package
248 (name "zathura-cb")
249 (version "0.1.4")
250 (source (origin
251 (method url-fetch)
252 (uri
253 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
254 version ".tar.gz"))
255 (sha256
256 (base32
257 "09ln4fpjxmhcq6cw1ka7mdkmca36gyd4gzrynbw3waz0ri0b277j"))))
258 (native-inputs `(("pkg-config" ,pkg-config)))
259 (propagated-inputs `(("girara" ,girara)))
260 (inputs `(("libarchive" ,libarchive)
261 ("gtk+" ,gtk+)
262 ("zathura" ,zathura)))
263 (build-system gnu-build-system)
264 (arguments
265 `(#:make-flags (list (string-append "PREFIX=" %output)
266 (string-append "PLUGINDIR=" %output "/lib/zathura")
267 "CC=gcc")
268 #:tests? #f ; Package does not contain tests.
269 #:phases
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
274 using libarchive.")
275 (license license:zlib)))
276
277 (define-public zathura-ps
278 (package
279 (name "zathura-ps")
280 (version "0.2.2")
281 (source (origin
282 (method url-fetch)
283 (uri
284 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
285 version ".tar.gz"))
286 (sha256
287 (base32
288 "1a6ps5v1wk18qvslbkjln6w8wfzzr6fi13ls96vbdc03vdhn4m76"))))
289 (native-inputs `(("pkg-config" ,pkg-config)))
290 (propagated-inputs `(("girara" ,girara)))
291 (inputs `(("libspectre" ,libspectre)
292 ("gtk+" ,gtk+)
293 ("zathura" ,zathura)))
294 (build-system gnu-build-system)
295 (arguments
296 `(#:make-flags (list (string-append "PREFIX=" %output)
297 (string-append "PLUGINDIR=" %output "/lib/zathura")
298 "CC=gcc")
299 #:tests? #f ; Package does not contain tests.
300 #:phases
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
305 using libspectre.")
306 (license license:zlib)))
307
308 (define-public zathura-djvu
309 (package
310 (name "zathura-djvu")
311 (version "0.2.4")
312 (source (origin
313 (method url-fetch)
314 (uri
315 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
316 version ".tar.gz"))
317 (sha256
318 (base32
319 "1g1lafmrjbx0xv7fljdmyqxx0k334sq4q6jy4a0q5xfrgz0bh45c"))))
320 (native-inputs `(("pkg-config" ,pkg-config)))
321 (propagated-inputs `(("girara" ,girara)))
322 (inputs
323 `(("djvulibre" ,djvulibre)
324 ("gtk+" ,gtk+)
325 ("zathura" ,zathura)))
326 (build-system gnu-build-system)
327 (arguments
328 `(#:make-flags (list (string-append "PREFIX=" %output)
329 (string-append "PLUGINDIR=" %output "/lib/zathura")
330 "CC=gcc")
331 #:tests? #f ; Package does not contain tests.
332 #:phases
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)))
339
340 (define-public zathura-pdf-poppler
341 (package
342 (name "zathura-pdf-poppler")
343 (version "0.2.5")
344 (source (origin
345 (method url-fetch)
346 (uri
347 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
348 version ".tar.gz"))
349 (sha256
350 (base32
351 "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0"))))
352 (native-inputs `(("pkg-config" ,pkg-config)))
353 (propagated-inputs `(("girara" ,girara)))
354 (inputs
355 `(("poppler" ,poppler)
356 ("gtk+" ,gtk+)
357 ("zathura" ,zathura)
358 ("cairo" ,cairo)))
359 (build-system gnu-build-system)
360 (arguments
361 `(#:make-flags (list (string-append "PREFIX=" %output)
362 (string-append "PLUGINDIR=" %output "/lib/zathura")
363 "CC=gcc")
364 #:tests? #f ; Package does not include tests.
365 #:phases
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)))
372
373 (define-public zathura
374 (package
375 (name "zathura")
376 (version "0.3.3")
377 (source (origin
378 (method url-fetch)
379 (uri
380 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
381 version ".tar.gz"))
382 (sha256
383 (base32
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)
390 ("sqlite" ,sqlite)
391 ("gtk+" ,gtk+)))
392 (native-search-paths
393 (list (search-path-specification
394 (variable "ZATHURA_PLUGIN_PATH")
395 (files '("lib/zathura")))))
396 (build-system gnu-build-system)
397 (arguments
398 `(#:make-flags
399 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
400 "CC=gcc" "COLOR=0")
401 #:tests? #f ; Tests fail: "Gtk cannot open display".
402 #:test-target "test"
403 #:phases
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
409 interaction.")
410 (license license:zlib)))
411
412 (define-public podofo
413 (package
414 (name "podofo")
415 (version "0.9.3")
416 (source (origin
417 (method url-fetch)
418 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
419 "/podofo-" version ".tar.gz"))
420 (sha256
421 (base32
422 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
423 (build-system cmake-build-system)
424 (inputs ; TODO: Add cppunit for tests
425 `(("lua" ,lua-5.1)
426 ("libpng" ,libpng)
427 ("openssl" ,openssl)
428 ("fontconfig" ,fontconfig)
429 ("libtiff" ,libtiff)
430 ("libjpeg" ,libjpeg-8)
431 ("freetype" ,freetype)
432 ("zlib" ,zlib)))
433 (arguments
434 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
435 "-DPODOFO_BUILD_STATIC=ON")
436 #:phases
437 (alist-cons-before
438 'configure 'patch
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))))
444 %standard-phases)))
445 (home-page "http://podofo.sourceforge.net")
446 (synopsis "Tools to work with the PDF file format")
447 (description
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+)))
454
455 (define-public mupdf
456 (package
457 (name "mupdf")
458 (version "1.8")
459 (source
460 (origin
461 (method url-fetch)
462 (uri (string-append "http://mupdf.com/downloads/archive/"
463 name "-" version "-source.tar.gz"))
464 (sha256
465 (base32 "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2"))
466 (modules '((guix build utils)))
467 (snippet
468 ;; Don't build the bundled-in third party libraries.
469 '(delete-file-recursively "thirdparty"))))
470 (build-system gnu-build-system)
471 (inputs
472 `(("curl" ,curl)
473 ("freetype" ,freetype)
474 ("jbig2dec" ,jbig2dec)
475 ("libjpeg" ,libjpeg)
476 ("libx11" ,libx11)
477 ("libxext" ,libxext)
478 ("openjpeg" ,openjpeg-2.0)
479 ("openssl" ,openssl)
480 ("zlib" ,zlib)))
481 (native-inputs
482 `(("pkg-config" ,pkg-config)))
483 (arguments
484 '(#:tests? #f ; no check target
485 #:make-flags (list "CC=gcc"
486 "XCFLAGS=-fpic"
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")
492 (description
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.
497
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+)))
502
503 (define-public qpdf
504 (package
505 (name "qpdf")
506 (version "5.1.3")
507 (source (origin
508 (method url-fetch)
509 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
510 "/qpdf-" version ".tar.gz"))
511 (sha256 (base32
512 "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm"))))
513 (build-system gnu-build-system)
514 (arguments
515 '(#:phases (alist-cons-before
516 'configure 'patch-paths
517 (lambda _
518 (substitute* "make/libtool.mk"
519 (("SHELL=/bin/bash")
520 (string-append "SHELL=" (which "bash"))))
521 (substitute* (append
522 '("qtest/bin/qtest-driver")
523 (find-files "." "\\.test"))
524 (("/usr/bin/env") (which "env"))))
525 %standard-phases)))
526 (native-inputs
527 `(("pkg-config" ,pkg-config)))
528 (propagated-inputs
529 `(("pcre" ,pcre)))
530 (inputs
531 `(("zlib" ,zlib)
532 ("perl" ,perl)))
533 (synopsis "Command-line tools and library for transforming PDF files")
534 (description
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/")))
542
543 (define-public xournal
544 (package
545 (name "xournal")
546 (version "0.4.8")
547 (source
548 (origin
549 (method url-fetch)
550 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
551 "/xournal-" version ".tar.gz"))
552 (sha256
553 (base32
554 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
555 (build-system gnu-build-system)
556 (inputs
557 `(("gtk" ,gtk+-2)
558 ("pango" ,pango)
559 ("poppler" ,poppler)
560 ("glib" ,glib)
561 ("libgnomecanvas" ,libgnomecanvas)))
562 (native-inputs
563 `(("pkg-config" ,pkg-config)))
564 (home-page "http://xournal.sourceforge.net/")
565 (synopsis "Notetaking using a stylus")
566 (description
567 "Xournal is an application for notetaking, sketching, keeping a journal
568 using a stylus.")
569 (license license:gpl2+)))