gnu: monero: Update to 0.17.1.5.
[jackhill/guix/guix.git] / gnu / packages / ebook.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015, 2016 Andreas Enge <andreas@enge.fr>
3;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
4;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
5;;; Copyright © 2017, 2019, 2020 Brendan Tildesley <mail@brendan.scot>
6;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
7;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
8;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
9;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages ebook)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix utils)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system meson)
34 #:use-module (guix build-system python)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages curl)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages file)
40 #:use-module (gnu packages fonts)
41 #:use-module (gnu packages fontutils)
42 #:use-module (gnu packages freedesktop)
43 #:use-module (gnu packages fribidi)
44 #:use-module (gnu packages gcc)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages gtk)
47 #:use-module (gnu packages gnome)
48 #:use-module (gnu packages glib)
49 #:use-module (gnu packages gstreamer)
50 #:use-module (gnu packages icu4c)
51 #:use-module (gnu packages image)
52 #:use-module (gnu packages javascript)
53 #:use-module (gnu packages libusb)
54 #:use-module (gnu packages libreoffice)
55 #:use-module (gnu packages music)
56 #:use-module (gnu packages pdf)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages python)
59 #:use-module (gnu packages python-web)
60 #:use-module (gnu packages python-xyz)
61 #:use-module (gnu packages qt)
62 #:use-module (gnu packages serialization)
63 #:use-module (gnu packages sqlite)
64 #:use-module (gnu packages time)
65 #:use-module (gnu packages tls)
66 #:use-module (gnu packages web)
67 #:use-module (gnu packages xml)
68 #:use-module (gnu packages xorg)
69 #:use-module (gnu packages wxwidgets))
70
71(define-public chmlib
72 (package
73 (name "chmlib")
74 (version "0.40")
75 (source (origin
76 (method url-fetch)
77 (uri (string-append "http://www.jedrea.com/chmlib/chmlib-"
78 version ".tar.bz2"))
79 (sha256
80 (base32
81 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
82 (patches (search-patches "chmlib-inttypes.patch"))))
83 (build-system gnu-build-system)
84 (home-page "http://www.jedrea.com/chmlib/")
85 (synopsis "Library for CHM files")
86 (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
87 (license license:lgpl2.1+)))
88
89(define-public calibre
90 (package
91 (name "calibre")
92 (version "4.18.0")
93 (source
94 (origin
95 (method url-fetch)
96 (uri (string-append "http://download.calibre-ebook.com/"
97 version "/calibre-"
98 version ".tar.xz"))
99 (sha256
100 (base32
101 "0w9pcfvskjh4v00vjw3i6hzrafy863pgsmmqdx4lffip3p856brw"))
102 (modules '((guix build utils)))
103 (snippet
104 '(begin
105 ;; Unbundle python2-odfpy.
106 (delete-file-recursively "src/odf")
107 ;; Disable test that attempts to load it.
108 (substitute* "setup/test.py"
109 ((".*SRC, 'odf'.*")
110 ""))
111
112 ;; Remove unneeded resources.
113 (delete-file "resources/viewer.js")
114 (delete-file "resources/viewer.html")
115 (delete-file "resources/mozilla-ca-certs.pem")
116 (delete-file "resources/calibre-portable.bat")
117 (delete-file "resources/calibre-portable.sh")
118 #t))
119 (patches (search-patches "calibre-no-updates-dialog.patch"
120 "calibre-remove-test-sqlite.patch" ; TODO: fix test.
121 "calibre-remove-test-unrar.patch"))))
122 (build-system python-build-system)
123 (native-inputs
124 `(("pkg-config" ,pkg-config)
125 ("qtbase" ,qtbase) ; for qmake
126 ("python2-flake8" ,python2-flake8)
127 ("xdg-utils" ,xdg-utils)))
128 (inputs
129 `(("chmlib" ,chmlib)
130 ("fontconfig" ,fontconfig)
131 ("font-liberation" ,font-liberation)
132 ("glib" ,glib)
133 ("hunspell" ,hunspell)
134 ("hyphen" ,hyphen)
135 ("icu4c" ,icu4c)
136 ("js-mathjax" ,js-mathjax)
137 ("libmtp" ,libmtp)
138 ("libpng" ,libpng)
139 ("libusb" ,libusb)
140 ("openssl" ,openssl)
141 ("optipng" ,optipng)
142 ("podofo" ,podofo)
143 ("poppler" ,poppler)
144 ("python" ,python-2)
145 ("python2-apsw" ,python2-apsw)
146 ("python2-beautifulsoup4" ,python2-beautifulsoup4)
147 ("python2-chardet" ,python2-chardet)
148 ("python2-cssselect" ,python2-cssselect)
149 ("python2-css-parser" ,python2-css-parser)
150 ("python2-dateutil" ,python2-dateutil)
151 ("python2-dbus" ,python2-dbus)
152 ("python2-dnspython" ,python2-dnspython)
153 ("python2-dukpy" ,python2-dukpy)
154 ("python2-feedparser" ,python2-feedparser)
155 ("python2-html2text" ,python2-html2text)
156 ("python2-html5-parser" ,python2-html5-parser)
157 ("python2-html5lib" ,python2-html5lib)
158 ("python2-lxml" ,python2-lxml)
159 ("python2-markdown" ,python2-markdown)
160 ("python2-mechanize" ,python2-mechanize)
161 ;; python2-msgpack is needed for the network content server to work.
162 ("python2-msgpack" ,python2-msgpack)
163 ("python2-netifaces" ,python2-netifaces)
164 ("python2-odfpy" ,python2-odfpy)
165 ("python2-pillow" ,python2-pillow)
166 ("python2-psutil" ,python2-psutil)
167 ("python2-pygments" ,python2-pygments)
168 ("python2-pyqtwebengine" ,python2-pyqtwebengine)
169 ("python2-pyqt" ,python2-pyqt)
170 ("python2-sip" ,python2-sip)
171 ("python2-regex" ,python2-regex)
172 ("qtwebengine" ,qtwebengine)
173 ("sqlite" ,sqlite)))
174 (arguments
175 `(#:python ,python-2
176 ;; Calibre is using setuptools by itself, but the setup.py is not
177 ;; compatible with the shim wrapper (taken from pip) we are using.
178 #:use-setuptools? #f
179 #:phases
180 (modify-phases %standard-phases
181 (add-after 'unpack 'patch-source
182 (lambda _
183 (substitute* "src/calibre/linux.py"
184 ;; We can't use the uninstaller in Guix. Don't build it.
185 (("self\\.create_uninstaller()") ""))
186 #t))
187 (add-after 'patch-source-shebangs 'patch-more-shebangs
188 (lambda _
189 ;; Patch various inline shebangs.
190 (substitute* '("src/calibre/gui2/preferences/tweaks.py"
191 "src/calibre/gui2/dialogs/custom_recipes.py"
192 "setup/install.py"
193 "setup/linux-installer.sh")
194 (("#!/usr/bin/env python")
195 (string-append "#!" (which "python")))
196 (("#!/bin/sh")
197 (string-append "#!" (which "sh"))))
198 #t))
199 (add-after 'unpack 'dont-load-remote-icons
200 (lambda _
201 (substitute* "setup/plugins_mirror.py"
202 (("href=\"//calibre-ebook.com/favicon.ico\"")
203 "href=\"favicon.ico\""))
204 #t))
205 (add-before 'build 'configure
206 (lambda* (#:key inputs outputs #:allow-other-keys)
207 (let ((podofo (assoc-ref inputs "podofo"))
208 (pyqt (assoc-ref inputs "python2-pyqt"))
209 (python-sip (assoc-ref inputs "python2-sip"))
210 (out (assoc-ref outputs "out")))
211 (substitute* "setup/build_environment.py"
212 (("= get_sip_dir\\(\\)")
213 (string-append "= '" pyqt "/share/sip'")))
214
215 (substitute* "src/calibre/ebooks/pdf/pdftohtml.py"
216 (("PDFTOHTML = 'pdftohtml'")
217 (string-append "PDFTOHTML = \"" (assoc-ref inputs "poppler")
218 "/bin/pdftohtml\"")))
219
220 ;; Calibre thinks we are installing desktop files into a home
221 ;; directory, but here we butcher the script in to installing
222 ;; to calibres /share directory.
223 (setenv "XDG_DATA_HOME" (string-append out "/share"))
224 (substitute* "src/calibre/linux.py"
225 (("'~/.local/share'") "''"))
226
227 ;; 'python setup.py rapydscript' uses QtWebEngine, which
228 ;; needs to create temporary files in $HOME.
229 (setenv "HOME" "/tmp")
230
231 ;; XXX: QtWebEngine will fail if no fonts are available. This
232 ;; can likely be removed when fontconfig has been patched to
233 ;; include TrueType fonts by default.
234 (symlink (string-append (assoc-ref inputs "font-liberation")
235 "/share/fonts")
236 "/tmp/.fonts")
237
238 (setenv "SIP_BIN" (string-append python-sip "/bin/sip"))
239 (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
240 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))
241 ;; This informs the tests we are a continuous integration
242 ;; environment and thus have no networking.
243 (setenv "CI" "true")
244 ;; The Qt test complains about being unable to load all image plugins, and I
245 ;; notice the available plugins list it shows lacks 'svg'. Adding qtsvg doesn't
246 ;; fix it, so I'm not sure how to fix it. TODO: Fix test and remove this.
247 (setenv "SKIP_QT_BUILD_TEST" "true")
248 #t)))
249 (add-after 'build 'build-extra
250 (lambda* (#:key inputs #:allow-other-keys)
251 (invoke "python2" "setup.py" "mathjax""--system-mathjax"
252 "--path-to-mathjax" (string-append
253 (assoc-ref inputs "js-mathjax")
254 "/share/javascript/mathjax"))
255 (invoke "python2" "setup.py" "rapydscript")
256 #t))
257 (add-after 'install 'install-man-pages
258 (lambda* (#:key outputs #:allow-other-keys)
259 (copy-recursively
260 "man-pages"
261 (string-append (assoc-ref outputs "out") "/share/man"))
262 #t))
263 ;; The font TTF files are used in some miscellaneous tests, so we
264 ;; unbundle them here to avoid patching the tests.
265 (add-after 'install 'unbundle-font-liberation
266 (lambda* (#:key inputs outputs #:allow-other-keys)
267 (let ((font-dest (string-append (assoc-ref outputs "out")
268 "/share/calibre/fonts/liberation"))
269 (font-src (string-append (assoc-ref inputs "font-liberation")
270 "/share/fonts/truetype")))
271 (delete-file-recursively font-dest)
272 (symlink font-src font-dest))
273 #t))
274 ;; Make run-time dependencies available to the binaries.
275 (add-after 'wrap 'wrap-program
276 (lambda* (#:key inputs outputs #:allow-other-keys)
277 (let ((out (assoc-ref outputs "out"))
278 (qtwebengine (assoc-ref inputs "qtwebengine")))
279 (with-directory-excursion (string-append out "/bin")
280 (for-each
281 (lambda (binary)
282 (wrap-program binary
283 ;; Make QtWebEngineProcess available.
284 `("QTWEBENGINEPROCESS_PATH" ":" =
285 ,(list (string-append
286 qtwebengine
287 "/lib/qt5/libexec/QtWebEngineProcess")))))
288 ;; Wrap all the binaries shipping with the package, except
289 ;; for the wrappings created during the 'wrap standard
290 ;; phase. This extends existing .calibre-real wrappers
291 ;; rather than create ..calibre-real-real-s. For more
292 ;; information see: https://issues.guix.gnu.org/43249.
293 (find-files "." (lambda (file stat)
294 (not (wrapper? file)))))))
295 #t)))))
296 (home-page "https://calibre-ebook.com/")
297 (synopsis "E-book library management software")
298 (description "Calibre is an e-book library manager. It can view, convert
299and catalog e-books in most of the major e-book formats. It can also talk
300to many e-book reader devices. It can go out to the Internet and fetch
301metadata for books. It can download newspapers and convert them into
302e-books for convenient reading.")
303 ;; Calibre is largely GPL3+, but includes a number of components covered
304 ;; by other licenses. See COPYRIGHT for more details.
305 (license (list license:gpl3+
306 license:gpl2+
307 license:lgpl2.1+
308 license:lgpl2.1
309 license:bsd-3
310 license:expat
311 license:zpl2.1
312 license:asl2.0
313 license:public-domain
314 license:silofl1.1
315 license:cc-by-sa3.0))))
316
317(define-public liblinebreak
318 (package
319 (name "liblinebreak")
320 (version "2.1")
321 (source (origin
322 (method url-fetch)
323 (uri (string-append "mirror://sourceforge/vimgadgets"
324 "/liblinebreak/" version
325 "/liblinebreak-" version ".tar.gz"))
326 (sha256
327 (base32
328 "1f36dbq7nc77lln1by2n1yl050g9dc63viawhs3gc3169mavm36x"))))
329 (build-system gnu-build-system)
330 (home-page "http://vimgadgets.sourceforge.net/liblinebreak/")
331 (synopsis "Library for detecting where linebreaks are allowed in text")
332 (description "@code{liblinebreak} is an implementation of the line
333breaking algorithm as described in Unicode 6.0.0 Standard Annex 14,
334Revision 26. It breaks lines that contain Unicode characters. It is
335designed to be used in a generic text renderer.")
336 (license license:zlib)))
337
338(define-public fbreader
339 (package
340 (name "fbreader")
341 (version "0.99.6")
342 (source (origin
343 (method git-fetch)
344 (uri (git-reference
345 (url "https://github.com/geometer/FBReader")
346 (commit (string-append version "-freebsdport"))))
347 (file-name (git-file-name name version))
348 (sha256
349 (base32
350 "0c0s4silpax74kwfz3dfmzn4lkv6jsyb800vfak166vii0hvbv3d"))
351 (patches (search-patches "fbreader-curl-7.62.patch"))))
352 (build-system gnu-build-system)
353 (inputs
354 `(("curl" ,curl)
355 ("expat" ,expat)
356 ("fribidi" ,fribidi)
357 ("glib" ,glib)
358 ("gtk+-2" ,gtk+-2)
359 ("libjpeg" ,libjpeg-turbo)
360 ("liblinebreak" ,liblinebreak)
361 ("libxft" ,libxft)
362 ("sqlite" ,sqlite)
363 ("zlib" ,zlib)))
364 (native-inputs
365 `(("gcc@5" ,gcc-5)
366 ("pkg-config" ,pkg-config)))
367 (arguments
368 `(#:tests? #f ; No tests exist.
369 #:make-flags `("CC=gcc" "TARGET_ARCH=desktop" "UI_TYPE=gtk"
370 "TARGET_STATUS=release"
371 ,(string-append "INSTALLDIR="
372 (assoc-ref %outputs "out"))
373 ,(string-append "LDFLAGS=-Wl,-rpath="
374 (assoc-ref %outputs "out") "/lib"))
375 #:phases
376 (modify-phases %standard-phases
377 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
378 (lambda* (#:key inputs #:allow-other-keys)
379 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent a header
380 ;; conflict with the GCC provided in native-inputs.
381 (let ((gcc (assoc-ref inputs "gcc")))
382 (setenv "CPLUS_INCLUDE_PATH"
383 (string-join
384 (delete (string-append gcc "/include/c++")
385 (string-split (getenv "CPLUS_INCLUDE_PATH")
386 #\:))
387 ":"))
388 #t)))
389 (delete 'configure)
390 (add-after 'unpack 'fix-install-locations
391 (lambda* (#:key outputs #:allow-other-keys)
392 (let ((out (assoc-ref outputs "out")))
393 (substitute* "fbreader/desktop/Makefile"
394 (("/usr") out))
395 #t))))))
396 (home-page "https://fbreader.org/")
397 (synopsis "E-Book reader")
398 (description "@code{fbreader} is an E-Book reader. It supports the
399following formats:
400
401@enumerate
402@item CHM
403@item Docbook
404@item FB2
405@item HTML
406@item OEB
407@item PDB
408@item RTF
409@item TCR
410@item TXT
411@item XHTML
412@end enumerate")
413 (license license:gpl2+)))
414
415(define-public cozy
416 (package
417 (name "cozy")
418 (version "0.7.2")
419 (source
420 (origin
421 (method git-fetch)
422 (uri (git-reference
423 (url "https://github.com/geigi/cozy")
424 (commit version)))
425 (file-name (git-file-name name version))
426 (sha256
427 (base32 "0fmbddi4ga0bppwg3rm3yjmf7jgqc6zfslmavnr1pglbzkjhy9fs"))))
428 (build-system meson-build-system)
429 (arguments
430 `(#:glib-or-gtk? #t
431 #:phases
432 (modify-phases %standard-phases
433 (add-after 'unpack 'patch-desktop-file
434 (lambda _
435 (substitute* "data/com.github.geigi.cozy.desktop.in"
436 (("Exec=com.github.geigi.cozy") "Exec=cozy"))
437 #t))
438 (add-after 'install 'patch-executable-name
439 (lambda* (#:key outputs #:allow-other-keys)
440 (with-directory-excursion
441 (string-append (assoc-ref outputs "out") "/bin")
442 (rename-file "com.github.geigi.cozy" "cozy"))
443 #t))
444 (add-after 'wrap 'wrap-libs
445 (lambda* (#:key outputs #:allow-other-keys)
446 (let* ((out (assoc-ref outputs "out"))
447 (pylib (string-append
448 out "/lib/python"
449 ,(version-major+minor
450 (package-version python))
451 "/site-packages"))
452 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
453 (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH"))
454 (libmagic-path (string-append
455 (assoc-ref %build-inputs "file")
456 "/lib"))
457 (python-path (getenv "PYTHONPATH")))
458 (wrap-program (string-append out "/bin/cozy")
459 `("LD_LIBRARY_PATH" ":" prefix (,libmagic-path))
460 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
461 `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))
462 `("PYTHONPATH" ":" prefix (,python-path ,pylib))))
463 #t)))))
464 (native-inputs
465 `(("desktop-file-utils" ,desktop-file-utils)
466 ("gettext" ,gettext-minimal)
467 ("glib:bin" ,glib "bin")
468 ("gobject-introspection" ,gobject-introspection)
469 ("gtk+:bin" ,gtk+ "bin")
470 ("pkg-config" ,pkg-config)
471 ("python" ,python-wrapper)))
472 (inputs
473 `(("file" ,file)
474 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
475 ("gst-libav" ,gst-libav)
476 ("gst-plugins-bad" ,gst-plugins-bad)
477 ("gst-plugins-good" ,gst-plugins-good)
478 ("gst-plugins-ugly" ,gst-plugins-ugly)
479 ("gtk+" ,gtk+)
480 ("python-apsw" ,python-apsw)
481 ("python-distro" ,python-distro)
482 ("python-gst" ,python-gst)
483 ("python-mutagen" ,python-mutagen)
484 ("python-packaging" ,python-packaging)
485 ("python-peewee" ,python-peewee)
486 ("python-pycairo" ,python-pycairo)
487 ("python-pygobject" ,python-pygobject)
488 ("python-pytz" ,python-pytz)
489 ("python-requests" ,python-requests)))
490 (home-page "https://cozy.geigi.de/")
491 (synopsis "Modern audiobook player using GTK+")
492 (description
493 "Cozy is a modern audiobook player written in GTK+.
494
495Some of the current features:
496
497@itemize
498@item Import your audiobooks into Cozy to browse them comfortably
499@item Sort your audio books by author, reader & name
500@item Remembers your playback position
501@item Sleep timer
502@item Playback speed control
503@item Search your library
504@item Offline mode
505@item Add multiple storage locations
506@item Drag & Drop to import new audio books
507@item Support for DRM free mp3, m4a (aac, ALAC, …), flac, ogg, opus, wav files
508@item Mpris integration (Media keys & playback info for desktop environment)
509@end itemize")
510 ;; TODO: Unbundle python-inject.
511 (license (list license:gpl3+ ;cozy
512 license:asl2.0)))) ;python-inject (bundled dependency)
513
514(define-public xchm
515 (package
516 (name "xchm")
517 (version "1.31")
518 (source (origin
519 (method url-fetch)
520 (uri (string-append "https://github.com/rzvncj/xCHM"
521 "/releases/download/"
522 version "/xchm-" version ".tar.gz"))
523 (sha256
524 (base32
525 "0aw6bysqiwbw75n3ad229ihlmh7chqs1wlxm0398z3lfp2y6n7qf"))))
526 (build-system gnu-build-system)
527 (inputs
528 `(("wxwidgets" ,wxwidgets)
529 ("chmlib" ,chmlib)))
530 (native-inputs
531 `(("pkg-config" ,pkg-config)))
532 (home-page "https://github.com/rzvncj/xCHM")
533 (synopsis "CHM file viewer")
534 (description "xCHM is a graphical CHM file viewer. It is a frontend to
535the CHM library CHMLIB.")
536 (license license:gpl2+)))