Revert "Revert "Merge branch 'gnome-updates'""
[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>
7ad608e4 4;;; Copyright © 2014, 2015 Ricardo Wurmus <rekado@elephly.net>
3e40bb82 5;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
135eb524
AE
6;;;
7;;; This file is part of GNU Guix.
8;;;
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.
13;;;
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.
18;;;
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/>.
21
22(define-module (gnu packages pdf)
b5b73a82 23 #:use-module ((guix licenses) #:prefix license:)
135eb524
AE
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
0f28ee34 27 #:use-module (guix build-system cmake)
3efb57ea 28 #:use-module (guix build-system python)
135eb524
AE
29 #:use-module (gnu packages)
30 #:use-module (gnu packages compression)
a86177d6 31 #:use-module (gnu packages fontutils)
14ecc0ef 32 #:use-module (gnu packages ghostscript)
3e40bb82 33 #:use-module (gnu packages databases)
bac31d1f 34 #:use-module (gnu packages djvu)
3e40bb82
PW
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages backup)
14ecc0ef 37 #:use-module (gnu packages lesstif)
e55354b8 38 #:use-module (gnu packages image)
14ecc0ef 39 #:use-module (gnu packages pkg-config)
8410cb62 40 #:use-module (gnu packages qt)
8db824ba 41 #:use-module (gnu packages xorg)
7ad608e4 42 #:use-module (gnu packages gnome)
8db824ba
LC
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gtk)
0f28ee34 45 #:use-module (gnu packages lua)
c0b390ed 46 #:use-module (gnu packages curl)
765f0ac8
RW
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages perl)
cc2b77df 49 #:use-module (gnu packages tls)
8db824ba 50 #:use-module (srfi srfi-1))
135eb524
AE
51
52(define-public poppler
53 (package
54 (name "poppler")
6983ba56 55 (version "0.42.0")
135eb524
AE
56 (source (origin
57 (method url-fetch)
5cc3096c 58 (uri (string-append "https://poppler.freedesktop.org/poppler-"
8befb33d 59 version ".tar.xz"))
6983ba56
SB
60 (sha256
61 (base32
62 "044084dbp804flwf7bw3lbwfdigm9s0psm6sw2j1hkrazrphgvwz"))))
135eb524 63 (build-system gnu-build-system)
6983ba56 64 ;; FIXME:
a25fe6d6 65 ;; use libcurl: no
135eb524
AE
66 (inputs `(("fontconfig" ,fontconfig)
67 ("freetype" ,freetype)
7363cda4 68 ("libjpeg" ,libjpeg)
a25fe6d6 69 ("libpng" ,libpng)
135eb524 70 ("libtiff" ,libtiff)
927d4d9b
RW
71 ("lcms" ,lcms)
72 ("openjpeg-1" ,openjpeg-1)
8db824ba
LC
73 ("zlib" ,zlib)
74
75 ;; To build poppler-glib (as needed by Evince), we need Cairo and
76 ;; GLib. But of course, that Cairo must not depend on Poppler.
77 ("cairo" ,(package (inherit cairo)
78 (inputs (alist-delete "poppler"
79 (package-inputs cairo)))))
80 ("glib" ,glib)))
c4c4cc05 81 (native-inputs
426adbe8 82 `(("pkg-config" ,pkg-config)
6983ba56
SB
83 ("glib" ,glib "bin") ; glib-mkenums, etc.
84 ("gobject-introspection" ,gobject-introspection)))
135eb524
AE
85 (arguments
86 `(#:tests? #f ; no test data provided with the tarball
a25fe6d6 87 #:configure-flags
7363cda4 88 '("--enable-xpdf-headers" ; to install header files
927d4d9b
RW
89 "--enable-zlib")
90 #:phases
91 (alist-cons-before
92 'configure 'setenv
93 (lambda _
94 (setenv "CPATH"
95 (string-append (assoc-ref %build-inputs "openjpeg-1")
96 "/include/openjpeg-1.5"
97 ":" (or (getenv "CPATH") ""))))
98 %standard-phases)))
35b9e423 99 (synopsis "PDF rendering library")
135eb524
AE
100 (description
101 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
14ecc0ef 102 (license license:gpl2+)
135eb524 103 (home-page "http://poppler.freedesktop.org/")))
14ecc0ef 104
8410cb62
RW
105(define-public poppler-qt4
106 (package (inherit poppler)
107 (name "poppler-qt4")
108 (inputs `(("qt-4" ,qt-4)
109 ,@(package-inputs poppler)))
110 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
111
3efb57ea
RW
112(define-public python-poppler-qt4
113 (package
114 (name "python-poppler-qt4")
115 (version "0.24.0")
116 (source
117 (origin
118 (method url-fetch)
119 (uri (string-append "https://pypi.python.org/packages/source/p"
120 "/python-poppler-qt4/python-poppler-qt4-"
121 version ".tar.gz"))
122 (sha256
123 (base32
124 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
125 (build-system python-build-system)
126 (arguments
127 `(#:phases
128 (modify-phases %standard-phases
129 (add-after
130 'unpack 'patch-poppler-include-paths
131 (lambda _
132 (substitute* (find-files "." "poppler-.*\\.sip")
133 (("qt4/poppler-.*\\.h" header)
134 (string-append "poppler/" header)))
135 #t)))))
136 (native-inputs
137 `(("pkg-config" ,pkg-config)))
138 (inputs
139 `(("python-sip" ,python-sip)
140 ("python-pyqt-4" ,python-pyqt-4)
141 ("poppler-qt4" ,poppler-qt4)))
142 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
143 (synopsis "Python bindings for Poppler-Qt4")
144 (description
145 "This package provides Python bindings for the Qt4 interface of the
146Poppler PDF rendering library.")
147 (license license:lgpl2.1+)))
148
14ecc0ef
AE
149(define-public xpdf
150 (package
151 (name "xpdf")
f410c110 152 (version "3.04")
14ecc0ef
AE
153 (source (origin
154 (method url-fetch)
155 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
156 version ".tar.gz"))
157 (sha256 (base32
f410c110 158 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
14ecc0ef
AE
159 (build-system gnu-build-system)
160 (inputs `(("freetype" ,freetype)
19cb5170 161 ("gs-fonts" ,gs-fonts)
14ecc0ef
AE
162 ("lesstif" ,lesstif)
163 ("libpaper" ,libpaper)
164 ("libx11" ,libx11)
165 ("libxext" ,libxext)
166 ("libxp" ,libxp)
167 ("libxpm" ,libxpm)
168 ("libxt" ,libxt)
f410c110 169 ("libpng" ,libpng)
01eafd38 170 ("zlib" ,zlib)))
14ecc0ef
AE
171 (arguments
172 `(#:tests? #f ; there is no check target
bdbf227f
AE
173 #:parallel-build? #f ; build fails randomly on 8-way machines
174 #:configure-flags
175 (list (string-append "--with-freetype2-includes="
176 (assoc-ref %build-inputs "freetype")
177 "/include/freetype2"))
19cb5170
AE
178 #:phases
179 (alist-replace
180 'install
181 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
182 (let* ((install (assoc-ref %standard-phases 'install))
183 (out (assoc-ref outputs "out"))
184 (xpdfrc (string-append out "/etc/xpdfrc"))
185 (gs-fonts (assoc-ref inputs "gs-fonts")))
186 (apply install args)
187 (substitute* xpdfrc
188 (("/usr/local/share/ghostscript/fonts")
189 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
190 (("#fontFile") "fontFile"))))
191 %standard-phases)))
9e771e3b 192 (synopsis "Viewer for PDF files based on the Motif toolkit")
14ecc0ef 193 (description
e881752c 194 "Xpdf is a viewer for Portable Document Format (PDF) files.")
14ecc0ef
AE
195 (license license:gpl3) ; or gpl2, but not gpl2+
196 (home-page "http://www.foolabs.com/xpdf/")))
0f28ee34 197
b3886e0c
PW
198(define-public zathura-cb
199 (package
200 (name "zathura-cb")
201 (version "0.1.4")
202 (source (origin
203 (method url-fetch)
204 (uri
205 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
206 version ".tar.gz"))
207 (sha256
208 (base32
209 "09ln4fpjxmhcq6cw1ka7mdkmca36gyd4gzrynbw3waz0ri0b277j"))))
210 (native-inputs `(("pkg-config" ,pkg-config)))
211 (propagated-inputs `(("girara" ,girara)))
212 (inputs `(("libarchive" ,libarchive)
213 ("gtk+" ,gtk+)
214 ("zathura" ,zathura)))
215 (build-system gnu-build-system)
216 (arguments
b1982b80
MW
217 `(#:make-flags (list (string-append "PREFIX=" %output)
218 (string-append "PLUGINDIR=" %output "/lib/zathura")
219 "CC=gcc")
b3886e0c
PW
220 #:tests? #f ; Package does not contain tests.
221 #:phases
222 (alist-delete 'configure %standard-phases)))
223 (home-page "https://pwmt.org/projects/zathura-cb/")
224 (synopsis "Comic book support for zathura (libarchive backend)")
225 (description "The zathura-cb plugin adds comic book support to zathura
226using libarchive.")
227 (license license:zlib)))
228
721a4f7d
PW
229(define-public zathura-ps
230 (package
231 (name "zathura-ps")
232 (version "0.2.2")
233 (source (origin
234 (method url-fetch)
235 (uri
236 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
237 version ".tar.gz"))
238 (sha256
239 (base32
240 "1a6ps5v1wk18qvslbkjln6w8wfzzr6fi13ls96vbdc03vdhn4m76"))))
241 (native-inputs `(("pkg-config" ,pkg-config)))
242 (propagated-inputs `(("girara" ,girara)))
243 (inputs `(("libspectre" ,libspectre)
244 ("gtk+" ,gtk+)
245 ("zathura" ,zathura)))
246 (build-system gnu-build-system)
247 (arguments
b1982b80
MW
248 `(#:make-flags (list (string-append "PREFIX=" %output)
249 (string-append "PLUGINDIR=" %output "/lib/zathura")
250 "CC=gcc")
721a4f7d
PW
251 #:tests? #f ; Package does not contain tests.
252 #:phases
253 (alist-delete 'configure %standard-phases)))
254 (home-page "https://pwmt.org/projects/zathura-ps/")
255 (synopsis "PS support for zathura (libspectre backend)")
256 (description "The zathura-ps plugin adds PS support to zathura
257using libspectre.")
258 (license license:zlib)))
259
bac31d1f
PW
260(define-public zathura-djvu
261 (package
262 (name "zathura-djvu")
263 (version "0.2.4")
264 (source (origin
265 (method url-fetch)
266 (uri
267 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
268 version ".tar.gz"))
269 (sha256
270 (base32
271 "1g1lafmrjbx0xv7fljdmyqxx0k334sq4q6jy4a0q5xfrgz0bh45c"))))
272 (native-inputs `(("pkg-config" ,pkg-config)))
273 (propagated-inputs `(("girara" ,girara)))
274 (inputs
275 `(("djvulibre" ,djvulibre)
276 ("gtk+" ,gtk+)
277 ("zathura" ,zathura)))
278 (build-system gnu-build-system)
279 (arguments
b1982b80
MW
280 `(#:make-flags (list (string-append "PREFIX=" %output)
281 (string-append "PLUGINDIR=" %output "/lib/zathura")
282 "CC=gcc")
bac31d1f
PW
283 #:tests? #f ; Package does not contain tests.
284 #:phases
285 (alist-delete 'configure %standard-phases)))
286 (home-page "https://pwmt.org/projects/zathura-djvu/")
287 (synopsis "DjVu support for zathura (DjVuLibre backend)")
288 (description "The zathura-djvu plugin adds DjVu support to zathura
289using the DjVuLibre library.")
290 (license license:zlib)))
291
7708557f
PW
292(define-public zathura-pdf-poppler
293 (package
294 (name "zathura-pdf-poppler")
295 (version "0.2.5")
296 (source (origin
297 (method url-fetch)
298 (uri
299 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
300 version ".tar.gz"))
301 (sha256
302 (base32
303 "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0"))))
304 (native-inputs `(("pkg-config" ,pkg-config)))
305 (propagated-inputs `(("girara" ,girara)))
306 (inputs
307 `(("poppler" ,poppler)
308 ("gtk+" ,gtk+)
309 ("zathura" ,zathura)
310 ("cairo" ,cairo)))
311 (build-system gnu-build-system)
312 (arguments
b1982b80
MW
313 `(#:make-flags (list (string-append "PREFIX=" %output)
314 (string-append "PLUGINDIR=" %output "/lib/zathura")
315 "CC=gcc")
7708557f
PW
316 #:tests? #f ; Package does not include tests.
317 #:phases
318 (alist-delete 'configure %standard-phases)))
319 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
320 (synopsis "PDF support for zathura (poppler backend)")
321 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
322by using the poppler rendering engine.")
323 (license license:zlib)))
324
3e40bb82
PW
325(define-public zathura
326 (package
327 (name "zathura")
afb92517 328 (version "0.3.3")
3e40bb82
PW
329 (source (origin
330 (method url-fetch)
331 (uri
332 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
333 version ".tar.gz"))
334 (sha256
335 (base32
afb92517 336 "1rywx09qn6ap5hb1z31wxby4lzdrqdbldm51pjk1ifflr37xwirk"))
fc1adab1
AK
337 (patches (search-patches
338 "zathura-plugindir-environment-variable.patch"))))
3e40bb82
PW
339 (native-inputs `(("pkg-config" ,pkg-config)
340 ("gettext" ,gnu-gettext)))
341 (inputs `(("girara" ,girara)
342 ("sqlite" ,sqlite)
343 ("gtk+" ,gtk+)))
344 (native-search-paths
345 (list (search-path-specification
346 (variable "ZATHURA_PLUGIN_PATH")
347 (files '("lib/zathura")))))
348 (build-system gnu-build-system)
349 (arguments
350 `(#:make-flags
351 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
352 "CC=gcc" "COLOR=0")
353 #:tests? #f ; Tests fail: "Gtk cannot open display".
354 #:test-target "test"
355 #:phases
356 (alist-delete 'configure %standard-phases)))
357 (home-page "https://pwmt.org/projects/zathura/")
358 (synopsis "Lightweight keyboard-driven PDF viewer")
359 (description "Zathura is a customizable document viewer. It provides a
360minimalistic interface and an interface that mainly focuses on keyboard
361interaction.")
362 (license license:zlib)))
363
0f28ee34
LC
364(define-public podofo
365 (package
366 (name "podofo")
d4322e61 367 (version "0.9.3")
0f28ee34
LC
368 (source (origin
369 (method url-fetch)
370 (uri (string-append "mirror://sourceforge/podofo/podofo-"
371 version ".tar.gz"))
372 (sha256
373 (base32
d4322e61 374 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
0f28ee34
LC
375 (build-system cmake-build-system)
376 (inputs ; TODO: Add cppunit for tests
5cc0e486 377 `(("lua" ,lua-5.1)
0f28ee34
LC
378 ("libpng" ,libpng)
379 ("openssl" ,openssl)
380 ("fontconfig" ,fontconfig)
381 ("libtiff" ,libtiff)
382 ("libjpeg" ,libjpeg-8)
383 ("freetype" ,freetype)
384 ("zlib" ,zlib)))
cb6a14ba
AE
385 (arguments
386 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
dde70926
AE
387 "-DPODOFO_BUILD_STATIC=ON")
388 #:phases
389 (alist-cons-before
390 'configure 'patch
391 (lambda* (#:key inputs #:allow-other-keys)
392 (let ((freetype (assoc-ref inputs "freetype")))
393 ;; Look for freetype include files in the correct place.
394 (substitute* "cmake/modules/FindFREETYPE.cmake"
395 (("/usr/local") freetype))))
396 %standard-phases)))
0f28ee34
LC
397 (home-page "http://podofo.sourceforge.net")
398 (synopsis "Tools to work with the PDF file format")
399 (description
400 "PoDoFo is a C++ library and set of command-line tools to work with the
401PDF file format. It can parse PDF files and load them into memory, and makes
402it easy to modify them and write the changes to disk. It is primarily useful
403for applications that wish to do lower level manipulation of PDF, such as
404extracting content or merging files.")
405 (license license:lgpl2.0+)))
c0b390ed
MB
406
407(define-public mupdf
408 (package
409 (name "mupdf")
dfbe56c3 410 (version "1.8")
c0b390ed
MB
411 (source
412 (origin
413 (method url-fetch)
235c4ec3
MW
414 (uri (string-append "http://mupdf.com/downloads/archive/"
415 name "-" version "-source.tar.gz"))
c0b390ed 416 (sha256
dfbe56c3 417 (base32 "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2"))
c0b390ed
MB
418 (modules '((guix build utils)))
419 (snippet
c0b390ed 420 ;; Don't build the bundled-in third party libraries.
8e755b1b 421 '(delete-file-recursively "thirdparty"))))
c0b390ed
MB
422 (build-system gnu-build-system)
423 (inputs
424 `(("curl" ,curl)
425 ("freetype" ,freetype)
426 ("jbig2dec" ,jbig2dec)
427 ("libjpeg" ,libjpeg)
428 ("libx11" ,libx11)
429 ("libxext" ,libxext)
ca407756 430 ("openjpeg" ,openjpeg-2.0)
c0b390ed
MB
431 ("openssl" ,openssl)
432 ("zlib" ,zlib)))
433 (native-inputs
434 `(("pkg-config" ,pkg-config)))
435 (arguments
8e755b1b
AE
436 '(#:tests? #f ; no check target
437 #:make-flags (list "CC=gcc"
438 "XCFLAGS=-fpic"
439 (string-append "prefix=" (assoc-ref %outputs "out")))
440 #:phases (modify-phases %standard-phases
441 (delete 'configure))))
c0b390ed 442 (home-page "http://mupdf.com")
2274b816 443 (synopsis "Lightweight PDF viewer and toolkit")
c0b390ed
MB
444 (description
445 "MuPDF is a C library that implements a PDF and XPS parsing and
446rendering engine. It is used primarily to render pages into bitmaps,
447but also provides support for other operations such as searching and
448listing the table of contents and hyperlinks.
449
450The library ships with a rudimentary X11 viewer, and a set of command
7c125ce0
AK
451line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
452and examining the file structure (pdfshow).")
c0b390ed 453 (license license:agpl3+)))
765f0ac8
RW
454
455(define-public qpdf
456 (package
457 (name "qpdf")
47959dd4 458 (version "5.1.3")
765f0ac8
RW
459 (source (origin
460 (method url-fetch)
461 (uri (string-append "mirror://sourceforge/qpdf/qpdf-"
462 version ".tar.gz"))
463 (sha256 (base32
47959dd4 464 "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm"))))
765f0ac8
RW
465 (build-system gnu-build-system)
466 (arguments
467 '(#:phases (alist-cons-before
468 'configure 'patch-paths
469 (lambda _
470 (substitute* "make/libtool.mk"
471 (("SHELL=/bin/bash")
472 (string-append "SHELL=" (which "bash"))))
473 (substitute* (append
474 '("qtest/bin/qtest-driver")
475 (find-files "." "\\.test"))
476 (("/usr/bin/env") (which "env"))))
477 %standard-phases)))
478 (native-inputs
479 `(("pkg-config" ,pkg-config)))
480 (propagated-inputs
481 `(("pcre" ,pcre)))
482 (inputs
483 `(("zlib" ,zlib)
484 ("perl" ,perl)))
485 (synopsis "Command-line tools and library for transforming PDF files")
486 (description
487 "QPDF is a command-line program that does structural, content-preserving
488transformations on PDF files. It could have been called something like
489pdf-to-pdf. It includes support for merging and splitting PDFs and to
490manipulate the list of pages in a PDF file. It is not a PDF viewer or a
491program capable of converting PDF into other formats.")
492 (license license:clarified-artistic)
493 (home-page "http://qpdf.sourceforge.net/")))
7ad608e4
RW
494
495(define-public xournal
496 (package
497 (name "xournal")
498 (version "0.4.8")
499 (source
500 (origin
501 (method url-fetch)
502 (uri (string-append "mirror://sourceforge/xournal/xournal-"
503 version ".tar.gz"))
504 (sha256
505 (base32
506 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
507 (build-system gnu-build-system)
508 (inputs
509 `(("gtk" ,gtk+-2)
510 ("pango" ,pango)
511 ("poppler" ,poppler)
512 ("glib" ,glib)
513 ("libgnomecanvas" ,libgnomecanvas)))
514 (native-inputs
515 `(("pkg-config" ,pkg-config)))
516 (home-page "http://xournal.sourceforge.net/")
517 (synopsis "Notetaking using a stylus")
518 (description
519 "Xournal is an application for notetaking, sketching, keeping a journal
520using a stylus.")
521 (license license:gpl2+)))