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, 2021 Brendan Tildesley <mail@brendan.scot>
6 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
7 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
9 ;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
10 ;;; Copyright © 2020 Zheng Junjie <873216071@qq.com>
11 ;;; Copyright © 2021 la snesne <lasnesne@lagunposprasihopre.org>
12 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
13 ;;; Copyright © 2021 Mathieu Laparie <mlaparie@disr.it>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages ebook)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix utils)
35 #:use-module (guix gexp)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system cmake)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system meson)
40 #:use-module (guix build-system python)
41 #:use-module (guix build-system qt)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages bash)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages curl)
47 #:use-module (gnu packages databases)
48 #:use-module (gnu packages file)
49 #:use-module (gnu packages fonts)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages freedesktop)
52 #:use-module (gnu packages fribidi)
53 #:use-module (gnu packages gcc)
54 #:use-module (gnu packages gettext)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages gnome)
57 #:use-module (gnu packages glib)
58 #:use-module (gnu packages gstreamer)
59 #:use-module (gnu packages icu4c)
60 #:use-module (gnu packages image)
61 #:use-module (gnu packages javascript)
62 #:use-module (gnu packages language)
63 #:use-module (gnu packages libusb)
64 #:use-module (gnu packages libreoffice)
65 #:use-module (gnu packages music)
66 #:use-module (gnu packages pantheon)
67 #:use-module (gnu packages pdf)
68 #:use-module (gnu packages pkg-config)
69 #:use-module (gnu packages python)
70 #:use-module (gnu packages python-build)
71 #:use-module (gnu packages python-compression)
72 #:use-module (gnu packages python-crypto)
73 #:use-module (gnu packages python-web)
74 #:use-module (gnu packages python-xyz)
75 #:use-module (gnu packages qt)
76 #:use-module (gnu packages serialization)
77 #:use-module (gnu packages speech)
78 #:use-module (gnu packages sqlite)
79 #:use-module (gnu packages time)
80 #:use-module (gnu packages tls)
81 #:use-module (gnu packages web)
82 #:use-module (gnu packages xml)
83 #:use-module (gnu packages xorg)
84 #:use-module (gnu packages wxwidgets))
92 (uri (string-append "http://www.jedrea.com/chmlib/chmlib-"
96 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
97 (patches (search-patches "chmlib-inttypes.patch"))))
98 (build-system gnu-build-system)
99 (home-page "http://www.jedrea.com/chmlib/")
100 (synopsis "Library for CHM files")
101 (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
102 (license license:lgpl2.1+)))
104 (define-public python-pychm
106 (name "python-pychm")
111 (uri (pypi-uri "pychm" version))
114 "0wpn9ijlsmrpyiwg3drmgz4dms1i1i347adgqw37bkrh3vn6yq16"))))
115 (build-system python-build-system)
118 (home-page "https://github.com/dottedmag/pychm")
119 (synopsis "Handle CHM files")
120 (description "This package provides a Python module for interacting
121 with Microsoft Compiled HTML (CHM) files")
122 (license license:gpl2+)))
124 (define-public calibre
131 (uri (string-append "http://download.calibre-ebook.com/"
136 "1c036qmn7lxq0899c2xzzs6whz7z0557frnfqisbvfxa13b2sadk"))
137 (modules '((guix build utils)))
140 ;; Unbundle python2-odfpy.
141 (delete-file-recursively "src/odf")
142 ;; Disable test that attempts to load it.
143 (substitute* "setup/test.py"
144 ((".*SRC, 'odf'.*") ""))
145 ;; Remove unneeded resources.
146 (delete-file "resources/mozilla-ca-certs.pem")
147 (delete-file "resources/calibre-portable.bat")
148 (delete-file "resources/calibre-portable.sh")))
149 (patches (search-patches "calibre-no-updates-dialog.patch"
150 "calibre-remove-test-sqlite.patch" ; TODO: fix test.
151 "calibre-remove-test-unrar.patch"))))
152 (build-system python-build-system)
178 python-beautifulsoup4
183 python-dnspython-1.16
192 ;; python-msgpack is needed for the network content server to work.
201 python-pyqt-without-qtwebkit
210 ;; Calibre is using setuptools by itself, but the setup.py is not
211 ;; compatible with the shim wrapper (taken from pip) we are using.
214 #~(modify-phases %standard-phases
215 (add-after 'unpack 'patch-source
217 (substitute* "src/calibre/linux.py"
218 ;; We can't use the uninstaller in Guix. Don't build it.
219 (("self\\.create_uninstaller()") ""))))
220 (add-after 'patch-source-shebangs 'patch-more-shebangs
221 (lambda* (#:key inputs native-inputs #:allow-other-keys)
222 ;; Patch various inline shebangs.
223 (substitute* '("src/calibre/gui2/preferences/tweaks.py"
224 "src/calibre/gui2/dialogs/custom_recipes.py"
226 "setup/linux-installer.sh")
227 (("#!/usr/bin/env python")
228 (string-append "#!" (search-input-file inputs "/bin/python")))
231 (search-input-file native-inputs "/bin/sh"))))))
232 (add-after 'unpack 'dont-load-remote-icons
234 (substitute* "setup/plugins_mirror.py"
235 (("href=\"//calibre-ebook.com/favicon.ico\"")
236 "href=\"favicon.ico\""))))
237 (add-before 'build 'configure
238 (lambda* (#:key inputs #:allow-other-keys)
239 (substitute* "setup/build.py"
240 (("\\[tool.sip.bindings.pictureflow\\]")
241 "[tool.sip.bindings.pictureflow]
242 tags = [\"WS_X11\"]")
243 (("\\[tool.sip.project\\]")
244 (string-append "[tool.sip.project]
245 sip-include-dirs = [\""
246 #$(this-package-input
247 "python-pyqt-without-qtwebkit")
249 (substitute* "src/calibre/ebooks/pdf/pdftohtml.py"
250 (("PDFTOHTML = 'pdftohtml'")
251 (string-append "PDFTOHTML = \""
252 (search-input-file inputs "/bin/pdftohtml")
254 ;; get_exe_path looks in poppler's output for these
255 ;; binaries. Make it not do that.
256 (substitute* "src/calibre/utils/img.py"
257 (("get_exe_path..jpegtran..")
259 (search-input-file inputs "/bin/jpegtran")
261 (("get_exe_path..cjpeg..")
263 (search-input-file inputs "/bin/cjpeg")
265 (("get_exe_path..optipng..")
267 (search-input-file inputs "/bin/optipng")
269 (("get_exe_path..JxrDecApp..")
271 (search-input-file inputs "/bin/JxrDecApp")
273 ;; Calibre thinks we are installing desktop files into a home
274 ;; directory, but here we butcher the script in to installing
275 ;; to calibres /share directory.
276 (setenv "XDG_DATA_HOME" (string-append #$output "/share"))
277 (substitute* "src/calibre/linux.py"
278 (("'~/.local/share'") "''"))
279 ;; 'python setup.py rapydscript' uses QtWebEngine, which
280 ;; needs to create temporary files in $HOME.
281 (setenv "HOME" "/tmp")
282 ;; XXX: QtWebEngine will fail if no fonts are available. This
283 ;; can likely be removed when fontconfig has been patched to
284 ;; include TrueType fonts by default.
285 (symlink (string-append #$(this-package-input "font-liberation")
288 (let ((podofo #$(this-package-input "podofo")))
289 (setenv "PODOFO_INC_DIR"
290 (string-append podofo "/include/podofo"))
291 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib")))
292 ;; This informs the tests we are a continuous integration
293 ;; environment and thus have no networking.
295 ;; The Qt test complains about being unable to load all image
296 ;; plugins, and I notice the available plugins list it shows
297 ;; lacks 'svg'. Adding qtsvg-5 doesn't fix it, so I'm not sure how
298 ;; to fix it. TODO: Fix test and remove this.
299 (setenv "SKIP_QT_BUILD_TEST" "true")))
300 (add-after 'install 'install-rapydscript
302 ;; Unset so QtWebengine doesn't dump temporary files here.
303 (unsetenv "XDG_DATA_HOME")
304 (invoke "python" "setup.py" "rapydscript")))
305 (add-after 'install 'install-man-pages
307 (copy-recursively "man-pages"
308 (string-append #$output "/share/man"))))
309 ;; The font TTF files are used in some miscellaneous tests, so we
310 ;; unbundle them here to avoid patching the tests.
311 (add-after 'install 'unbundle-font-liberation
314 (string-append #$output "/share/calibre/fonts/liberation"))
316 (string-append #$(this-package-input "font-liberation")
317 "/share/fonts/truetype")))
318 (delete-file-recursively font-dest)
319 (symlink font-src font-dest))))
320 ;; Make run-time dependencies available to the binaries.
321 (add-after 'wrap 'wrap-program
322 (lambda* (#:key inputs #:allow-other-keys)
323 (with-directory-excursion (string-append #$output "/bin")
327 ;; Make QtWebEngineProcess available.
328 `("QTWEBENGINEPROCESS_PATH" =
331 inputs "/lib/qt5/libexec/QtWebEngineProcess")))))
332 ;; Wrap all the binaries shipping with the package, except
333 ;; for the wrappings created during the 'wrap standard
334 ;; phase. This extends existing .calibre-real wrappers
335 ;; rather than create ..calibre-real-real-s. For more
336 ;; information see: https://issues.guix.gnu.org/43249.
337 (find-files "." (lambda (file stat)
338 (not (wrapped-program? file)))))))))))
339 (home-page "https://calibre-ebook.com/")
340 (synopsis "E-book library management software")
341 (description "Calibre is an e-book library manager. It can view, convert
342 and catalog e-books in most of the major e-book formats. It can also talk
343 to many e-book reader devices. It can go out to the Internet and fetch
344 metadata for books. It can download newspapers and convert them into
345 e-books for convenient reading.")
346 ;; Calibre is largely GPL3+, but includes a number of components covered
347 ;; by other licenses. See COPYRIGHT for more details.
348 (license (list license:gpl3+
356 license:public-domain
358 license:cc-by-sa3.0))))
360 (define-public ebook-tools
367 (uri (string-append "mirror://sourceforge/ebook-tools/ebook-tools/"
368 version "/ebook-tools-" version ".tar.gz"))
371 "1bi7wsz3p5slb43kj7lgb3r6lb91lvb6ldi556k4y50ix6b5khyb"))))
373 `(#:tests? #f)) ; No 'test' target
374 (build-system cmake-build-system)
378 (list libzip libxml2))
379 (home-page "http://ebook-tools.sourceforge.net")
380 (synopsis "Tools and library for dealing with various ebook file formats")
381 (description "This package provides command-line tools and a library for
382 accessing and converting various ebook file formats.")
383 (license license:expat)))
385 (define-public inkbox
389 (home-page "https://github.com/Kobo-InkBox/inkbox")
397 (file-name (git-file-name name version))
399 (base32 "126cqn0ixcn608lv2hd9f7zmzj4g448bnpxc7wv9cvg83qqajh5n"))))
400 (build-system qt-build-system)
403 #:tests? #f ; no test suite
405 #~(list (string-append "PREFIX=" #$output))
407 #~(modify-phases %standard-phases
408 (add-after 'unpack 'prefix-opt
410 (substitute* "inkbox.pro"
411 (("/opt/\\$\\$\\{TARGET\\}")
414 (lambda* (#:key make-flags #:allow-other-keys)
415 (apply invoke (cons "qmake" make-flags)))))))
418 (synopsis "EBook reader")
419 (description "This package provides InkBox eBook reader.")
420 (license license:gpl3)))
422 (define-public liblinebreak
424 (name "liblinebreak")
428 (uri (string-append "mirror://sourceforge/vimgadgets"
429 "/liblinebreak/" version
430 "/liblinebreak-" version ".tar.gz"))
433 "1f36dbq7nc77lln1by2n1yl050g9dc63viawhs3gc3169mavm36x"))))
434 (build-system gnu-build-system)
435 (home-page "http://vimgadgets.sourceforge.net/liblinebreak/")
436 (synopsis "Library for detecting where linebreaks are allowed in text")
437 (description "@code{liblinebreak} is an implementation of the line
438 breaking algorithm as described in Unicode 6.0.0 Standard Annex 14,
439 Revision 26. It breaks lines that contain Unicode characters. It is
440 designed to be used in a generic text renderer.")
441 (license license:zlib)))
443 (define-public fbreader
450 (url "https://github.com/geometer/FBReader")
451 (commit (string-append version "-freebsdport"))))
452 (file-name (git-file-name name version))
455 "0c0s4silpax74kwfz3dfmzn4lkv6jsyb800vfak166vii0hvbv3d"))
456 (patches (search-patches "fbreader-curl-7.62.patch"))))
457 (build-system gnu-build-system)
464 ("libjpeg" ,libjpeg-turbo)
465 ("liblinebreak" ,liblinebreak)
471 ("pkg-config" ,pkg-config)))
473 `(#:tests? #f ; No tests exist.
474 #:make-flags `("CC=gcc" "TARGET_ARCH=desktop" "UI_TYPE=gtk"
475 "TARGET_STATUS=release"
476 ,(string-append "INSTALLDIR="
477 (assoc-ref %outputs "out"))
478 ,(string-append "LDFLAGS=-Wl,-rpath="
479 (assoc-ref %outputs "out") "/lib"))
481 (modify-phases %standard-phases
482 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
483 (lambda* (#:key inputs #:allow-other-keys)
484 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent a header
485 ;; conflict with the GCC provided in native-inputs.
486 (let ((gcc (assoc-ref inputs "gcc")))
487 (setenv "CPLUS_INCLUDE_PATH"
489 (delete (string-append gcc "/include/c++")
490 (string-split (getenv "CPLUS_INCLUDE_PATH")
495 (add-after 'unpack 'fix-install-locations
496 (lambda* (#:key outputs #:allow-other-keys)
497 (let ((out (assoc-ref outputs "out")))
498 (substitute* "fbreader/desktop/Makefile"
501 (home-page "https://fbreader.org/")
502 (synopsis "E-Book reader")
503 (description "@code{fbreader} is an E-Book reader. It supports the
518 (license license:gpl2+)))
528 (url "https://github.com/geigi/cozy")
530 (file-name (git-file-name name version))
532 (base32 "0qky885fl63d5ih5d3rggm8rhp00sk6lny26qljyz3gga8n9y6ki"))))
533 (build-system meson-build-system)
537 (modify-phases %standard-phases
538 (add-after 'unpack 'patch-desktop-file
540 (substitute* "data/com.github.geigi.cozy.desktop"
541 (("Exec=com.github.geigi.cozy") "Exec=cozy"))))
542 (add-after 'install 'patch-executable-name
543 (lambda* (#:key outputs #:allow-other-keys)
544 (with-directory-excursion
545 (string-append (assoc-ref outputs "out") "/bin")
546 (rename-file "com.github.geigi.cozy" "cozy"))))
547 (add-after 'wrap 'wrap-libs
548 (lambda* (#:key outputs #:allow-other-keys)
549 (let* ((out (assoc-ref outputs "out"))
550 (pylib (string-append
552 ,(version-major+minor
553 (package-version python))
555 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
556 (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH"))
557 (libmagic-path (string-append
558 (assoc-ref %build-inputs "file")
560 (python-path (getenv "GUIX_PYTHONPATH")))
561 (wrap-program (string-append out "/bin/cozy")
562 `("LD_LIBRARY_PATH" ":" prefix (,libmagic-path))
563 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
564 `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))
565 `("GUIX_PYTHONPATH" ":" prefix (,python-path ,pylib)))))))))
567 (list desktop-file-utils
570 gobject-introspection
578 gsettings-desktop-schemas
596 (home-page "https://cozy.geigi.de/")
597 (synopsis "Modern audiobook player using GTK+")
599 "Cozy is a modern audiobook player written in GTK+.
601 Some of the current features:
604 @item Import your audiobooks into Cozy to browse them comfortably
605 @item Sort your audio books by author, reader & name
606 @item Remembers your playback position
608 @item Playback speed control
609 @item Search your library
611 @item Add multiple storage locations
612 @item Drag & Drop to import new audio books
613 @item Support for DRM free mp3, m4a (aac, ALAC, …), flac, ogg, opus, wav files
614 @item Mpris integration (Media keys & playback info for desktop environment)
616 ;; TODO: Unbundle python-inject.
617 (license (list license:gpl3+ ;cozy
618 license:asl2.0)))) ;python-inject (bundled dependency)
626 (uri (string-append "https://github.com/rzvncj/xCHM"
627 "/releases/download/"
628 version "/xchm-" version ".tar.gz"))
631 "0an09shap2wj9gzj5fsw5sc2i6paq3kc3mc52fnwg2bb2dan5qxk"))))
632 (build-system gnu-build-system)
634 (list wxwidgets chmlib))
637 (home-page "https://github.com/rzvncj/xCHM")
638 (synopsis "CHM file viewer")
639 (description "xCHM is a graphical CHM file viewer. It is a frontend to
640 the CHM library CHMLIB.")
641 (license license:gpl2+)))
643 (define-public libmobi
650 (url "https://github.com/bfabiszewski/libmobi/")
651 (commit (string-append "v" version))))
652 (file-name (git-file-name name version))
655 "0yps72cm609xn2k7alflkdhp9kgr1w7zzyxjygz0n1kqrdcplihh"))))
656 (build-system gnu-build-system)
658 (list autoconf automake libtool))
661 (home-page "https://github.com/bfabiszewski/libmobi/")
662 (synopsis "C library for handling MOBI formats")
663 (description "Libmobi is a C library for handling MOBI ebook
664 format documents, with the following features:
667 @item reading and parsing:
669 @item some older text Palmdoc formats (pdb),
670 @item Mobipocket files (prc, mobi),
671 @item newer MOBI files including KF8 format (azw, azw3),
672 @item Replica Print files (azw4)
674 @item recreating source files using indices
675 @item reconstructing references (links and embedded) in html files
676 @item reconstructing source structure that can be fed back to kindlegen
677 @item reconstructing dictionary markup (orth, infl tags)
678 @item writing back loaded documents
679 @item metadata editing
680 @item handling encrypted documents
682 (license license:lgpl3+)))
684 (define-public python-ebooklib
686 (name "python-ebooklib")
690 (uri (pypi-uri "EbookLib" version))
693 "1w972g0kmh9cdxf3kjr7v4k99wvv4lxv3rxkip39c08550nf48zy"))))
694 (build-system python-build-system)
695 (propagated-inputs (list python-lxml python-six))
696 (home-page "https://github.com/aerkalov/ebooklib")
697 (synopsis "Ebook library which can handle EPUB2/EPUB3 and Kindle format")
699 "Ebook library which can handle EPUB2/EPUB3 and Kindle format.")
700 (license license:agpl3+)))
702 (define-public shirah
708 (uri (pypi-uri "shirah_reader" version))
711 "0j15v435lz68c1mj5clfx5dmfyjc6jvvz2q8hqvv799mb2faj42y"))))
712 (build-system python-build-system)
713 (propagated-inputs (list python-beautifulsoup4 python-ebooklib
714 python-syllables python-termcolor))
715 (home-page "https://github.com/hallicopter/shirah-reader")
716 (synopsis "Terminal ebook reader with an optional RSVP mode")
718 "@command{shirah} is a curses based terminal ebook reader that can
719 display ebooks in the usual way or with Rapid Serial Visual Presentation, a
720 method to enable speedreading by showing the text word by word at configurable
722 (license license:gpl2+)))