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.
202 python-pyqt-without-qtwebkit
211 ;; Calibre is using setuptools by itself, but the setup.py is not
212 ;; compatible with the shim wrapper (taken from pip) we are using.
215 #~(modify-phases %standard-phases
216 (add-after 'unpack 'patch-source
218 (substitute* "src/calibre/linux.py"
219 ;; We can't use the uninstaller in Guix. Don't build it.
220 (("self\\.create_uninstaller()") ""))))
221 (add-after 'patch-source-shebangs 'patch-more-shebangs
222 (lambda* (#:key inputs native-inputs #:allow-other-keys)
223 ;; Patch various inline shebangs.
224 (substitute* '("src/calibre/gui2/preferences/tweaks.py"
225 "src/calibre/gui2/dialogs/custom_recipes.py"
227 "setup/linux-installer.sh")
228 (("#!/usr/bin/env python")
229 (string-append "#!" (search-input-file inputs "/bin/python")))
232 (search-input-file native-inputs "/bin/sh"))))))
233 (add-after 'unpack 'dont-load-remote-icons
235 (substitute* "setup/plugins_mirror.py"
236 (("href=\"//calibre-ebook.com/favicon.ico\"")
237 "href=\"favicon.ico\""))))
238 (add-before 'build 'configure
239 (lambda* (#:key inputs #:allow-other-keys)
240 (substitute* "setup/build.py"
241 (("\\[tool.sip.bindings.pictureflow\\]")
242 "[tool.sip.bindings.pictureflow]
243 tags = [\"WS_X11\"]")
244 (("\\[tool.sip.project\\]")
245 (string-append "[tool.sip.project]
246 sip-include-dirs = [\""
247 #$(this-package-input
248 "python-pyqt-without-qtwebkit")
250 (substitute* "src/calibre/ebooks/pdf/pdftohtml.py"
251 (("PDFTOHTML = 'pdftohtml'")
252 (string-append "PDFTOHTML = \""
253 (search-input-file inputs "/bin/pdftohtml")
255 ;; get_exe_path looks in poppler's output for these
256 ;; binaries. Make it not do that.
257 (substitute* "src/calibre/utils/img.py"
258 (("get_exe_path..jpegtran..")
260 (search-input-file inputs "/bin/jpegtran")
262 (("get_exe_path..cjpeg..")
264 (search-input-file inputs "/bin/cjpeg")
266 (("get_exe_path..optipng..")
268 (search-input-file inputs "/bin/optipng")
270 (("get_exe_path..JxrDecApp..")
272 (search-input-file inputs "/bin/JxrDecApp")
274 ;; Calibre thinks we are installing desktop files into a home
275 ;; directory, but here we butcher the script in to installing
276 ;; to calibres /share directory.
277 (setenv "XDG_DATA_HOME" (string-append #$output "/share"))
278 (substitute* "src/calibre/linux.py"
279 (("'~/.local/share'") "''"))
280 ;; 'python setup.py rapydscript' uses QtWebEngine, which
281 ;; needs to create temporary files in $HOME.
282 (setenv "HOME" "/tmp")
283 ;; XXX: QtWebEngine will fail if no fonts are available. This
284 ;; can likely be removed when fontconfig has been patched to
285 ;; include TrueType fonts by default.
286 (symlink (string-append #$(this-package-input "font-liberation")
289 (let ((podofo #$(this-package-input "podofo")))
290 (setenv "PODOFO_INC_DIR"
291 (string-append podofo "/include/podofo"))
292 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib")))
293 ;; This informs the tests we are a continuous integration
294 ;; environment and thus have no networking.
296 ;; The Qt test complains about being unable to load all image
297 ;; plugins, and I notice the available plugins list it shows
298 ;; lacks 'svg'. Adding qtsvg-5 doesn't fix it, so I'm not sure how
299 ;; to fix it. TODO: Fix test and remove this.
300 (setenv "SKIP_QT_BUILD_TEST" "true")))
301 (add-after 'install 'install-rapydscript
303 ;; Unset so QtWebengine doesn't dump temporary files here.
304 (unsetenv "XDG_DATA_HOME")
305 (invoke "python" "setup.py" "rapydscript")))
306 (add-after 'install 'install-man-pages
308 (copy-recursively "man-pages"
309 (string-append #$output "/share/man"))))
310 ;; The font TTF files are used in some miscellaneous tests, so we
311 ;; unbundle them here to avoid patching the tests.
312 (add-after 'install 'unbundle-font-liberation
315 (string-append #$output "/share/calibre/fonts/liberation"))
317 (string-append #$(this-package-input "font-liberation")
318 "/share/fonts/truetype")))
319 (delete-file-recursively font-dest)
320 (symlink font-src font-dest))))
321 ;; Make run-time dependencies available to the binaries.
322 (add-after 'wrap 'wrap-program
323 (lambda* (#:key inputs #:allow-other-keys)
324 (with-directory-excursion (string-append #$output "/bin")
328 ;; Make QtWebEngineProcess available.
329 `("QTWEBENGINEPROCESS_PATH" =
332 inputs "/lib/qt5/libexec/QtWebEngineProcess")))))
333 ;; Wrap all the binaries shipping with the package, except
334 ;; for the wrappings created during the 'wrap standard
335 ;; phase. This extends existing .calibre-real wrappers
336 ;; rather than create ..calibre-real-real-s. For more
337 ;; information see: https://issues.guix.gnu.org/43249.
338 (find-files "." (lambda (file stat)
339 (not (wrapped-program? file)))))))))))
340 (home-page "https://calibre-ebook.com/")
341 (synopsis "E-book library management software")
342 (description "Calibre is an e-book library manager. It can view, convert
343 and catalog e-books in most of the major e-book formats. It can also talk
344 to many e-book reader devices. It can go out to the Internet and fetch
345 metadata for books. It can download newspapers and convert them into
346 e-books for convenient reading.")
347 ;; Calibre is largely GPL3+, but includes a number of components covered
348 ;; by other licenses. See COPYRIGHT for more details.
349 (license (list license:gpl3+
357 license:public-domain
359 license:cc-by-sa3.0))))
361 (define-public ebook-tools
368 (uri (string-append "mirror://sourceforge/ebook-tools/ebook-tools/"
369 version "/ebook-tools-" version ".tar.gz"))
372 "1bi7wsz3p5slb43kj7lgb3r6lb91lvb6ldi556k4y50ix6b5khyb"))))
374 `(#:tests? #f)) ; No 'test' target
375 (build-system cmake-build-system)
379 (list libzip libxml2))
380 (home-page "http://ebook-tools.sourceforge.net")
381 (synopsis "Tools and library for dealing with various ebook file formats")
382 (description "This package provides command-line tools and a library for
383 accessing and converting various ebook file formats.")
384 (license license:expat)))
386 (define-public inkbox
390 (home-page "https://github.com/Kobo-InkBox/inkbox")
398 (file-name (git-file-name name version))
400 (base32 "126cqn0ixcn608lv2hd9f7zmzj4g448bnpxc7wv9cvg83qqajh5n"))))
401 (build-system qt-build-system)
404 #:tests? #f ; no test suite
406 #~(list (string-append "PREFIX=" #$output))
408 #~(modify-phases %standard-phases
409 (add-after 'unpack 'prefix-opt
411 (substitute* "inkbox.pro"
412 (("/opt/\\$\\$\\{TARGET\\}")
415 (lambda* (#:key make-flags #:allow-other-keys)
416 (apply invoke (cons "qmake" make-flags)))))))
419 (synopsis "EBook reader")
420 (description "This package provides InkBox eBook reader.")
421 (license license:gpl3)))
423 (define-public liblinebreak
425 (name "liblinebreak")
429 (uri (string-append "mirror://sourceforge/vimgadgets"
430 "/liblinebreak/" version
431 "/liblinebreak-" version ".tar.gz"))
434 "1f36dbq7nc77lln1by2n1yl050g9dc63viawhs3gc3169mavm36x"))))
435 (build-system gnu-build-system)
436 (home-page "http://vimgadgets.sourceforge.net/liblinebreak/")
437 (synopsis "Library for detecting where linebreaks are allowed in text")
438 (description "@code{liblinebreak} is an implementation of the line
439 breaking algorithm as described in Unicode 6.0.0 Standard Annex 14,
440 Revision 26. It breaks lines that contain Unicode characters. It is
441 designed to be used in a generic text renderer.")
442 (license license:zlib)))
444 (define-public fbreader
451 (url "https://github.com/geometer/FBReader")
452 (commit (string-append version "-freebsdport"))))
453 (file-name (git-file-name name version))
456 "0c0s4silpax74kwfz3dfmzn4lkv6jsyb800vfak166vii0hvbv3d"))
457 (patches (search-patches "fbreader-curl-7.62.patch"))))
458 (build-system gnu-build-system)
465 ("libjpeg" ,libjpeg-turbo)
466 ("liblinebreak" ,liblinebreak)
472 ("pkg-config" ,pkg-config)))
474 `(#:tests? #f ; No tests exist.
475 #:make-flags `("CC=gcc" "TARGET_ARCH=desktop" "UI_TYPE=gtk"
476 "TARGET_STATUS=release"
477 ,(string-append "INSTALLDIR="
478 (assoc-ref %outputs "out"))
479 ,(string-append "LDFLAGS=-Wl,-rpath="
480 (assoc-ref %outputs "out") "/lib"))
482 (modify-phases %standard-phases
483 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
484 (lambda* (#:key inputs #:allow-other-keys)
485 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent a header
486 ;; conflict with the GCC provided in native-inputs.
487 (let ((gcc (assoc-ref inputs "gcc")))
488 (setenv "CPLUS_INCLUDE_PATH"
490 (delete (string-append gcc "/include/c++")
491 (string-split (getenv "CPLUS_INCLUDE_PATH")
496 (add-after 'unpack 'fix-install-locations
497 (lambda* (#:key outputs #:allow-other-keys)
498 (let ((out (assoc-ref outputs "out")))
499 (substitute* "fbreader/desktop/Makefile"
502 (home-page "https://fbreader.org/")
503 (synopsis "E-Book reader")
504 (description "@code{fbreader} is an E-Book reader. It supports the
519 (license license:gpl2+)))
529 (url "https://github.com/geigi/cozy")
531 (file-name (git-file-name name version))
533 (base32 "0qky885fl63d5ih5d3rggm8rhp00sk6lny26qljyz3gga8n9y6ki"))))
534 (build-system meson-build-system)
538 (modify-phases %standard-phases
539 (add-after 'unpack 'patch-desktop-file
541 (substitute* "data/com.github.geigi.cozy.desktop"
542 (("Exec=com.github.geigi.cozy") "Exec=cozy"))))
543 (add-after 'install 'patch-executable-name
544 (lambda* (#:key outputs #:allow-other-keys)
545 (with-directory-excursion
546 (string-append (assoc-ref outputs "out") "/bin")
547 (rename-file "com.github.geigi.cozy" "cozy"))))
548 (add-after 'wrap 'wrap-libs
549 (lambda* (#:key outputs #:allow-other-keys)
550 (let* ((out (assoc-ref outputs "out"))
551 (pylib (string-append
553 ,(version-major+minor
554 (package-version python))
556 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
557 (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH"))
558 (libmagic-path (string-append
559 (assoc-ref %build-inputs "file")
561 (python-path (getenv "GUIX_PYTHONPATH")))
562 (wrap-program (string-append out "/bin/cozy")
563 `("LD_LIBRARY_PATH" ":" prefix (,libmagic-path))
564 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
565 `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))
566 `("GUIX_PYTHONPATH" ":" prefix (,python-path ,pylib)))))))))
568 (list desktop-file-utils
571 gobject-introspection
579 gsettings-desktop-schemas
597 (home-page "https://cozy.geigi.de/")
598 (synopsis "Modern audiobook player using GTK+")
600 "Cozy is a modern audiobook player written in GTK+.
602 Some of the current features:
605 @item Import your audiobooks into Cozy to browse them comfortably
606 @item Sort your audio books by author, reader & name
607 @item Remembers your playback position
609 @item Playback speed control
610 @item Search your library
612 @item Add multiple storage locations
613 @item Drag & Drop to import new audio books
614 @item Support for DRM free mp3, m4a (aac, ALAC, …), flac, ogg, opus, wav files
615 @item Mpris integration (Media keys & playback info for desktop environment)
617 ;; TODO: Unbundle python-inject.
618 (license (list license:gpl3+ ;cozy
619 license:asl2.0)))) ;python-inject (bundled dependency)
627 (uri (string-append "https://github.com/rzvncj/xCHM"
628 "/releases/download/"
629 version "/xchm-" version ".tar.gz"))
632 "0an09shap2wj9gzj5fsw5sc2i6paq3kc3mc52fnwg2bb2dan5qxk"))))
633 (build-system gnu-build-system)
635 (list wxwidgets chmlib))
638 (home-page "https://github.com/rzvncj/xCHM")
639 (synopsis "CHM file viewer")
640 (description "xCHM is a graphical CHM file viewer. It is a frontend to
641 the CHM library CHMLIB.")
642 (license license:gpl2+)))
644 (define-public libmobi
651 (url "https://github.com/bfabiszewski/libmobi/")
652 (commit (string-append "v" version))))
653 (file-name (git-file-name name version))
656 "0yps72cm609xn2k7alflkdhp9kgr1w7zzyxjygz0n1kqrdcplihh"))))
657 (build-system gnu-build-system)
659 (list autoconf automake libtool))
662 (home-page "https://github.com/bfabiszewski/libmobi/")
663 (synopsis "C library for handling MOBI formats")
664 (description "Libmobi is a C library for handling MOBI ebook
665 format documents, with the following features:
668 @item reading and parsing:
670 @item some older text Palmdoc formats (pdb),
671 @item Mobipocket files (prc, mobi),
672 @item newer MOBI files including KF8 format (azw, azw3),
673 @item Replica Print files (azw4)
675 @item recreating source files using indices
676 @item reconstructing references (links and embedded) in html files
677 @item reconstructing source structure that can be fed back to kindlegen
678 @item reconstructing dictionary markup (orth, infl tags)
679 @item writing back loaded documents
680 @item metadata editing
681 @item handling encrypted documents
683 (license license:lgpl3+)))
685 (define-public python-ebooklib
687 (name "python-ebooklib")
691 (uri (pypi-uri "EbookLib" version))
694 "1w972g0kmh9cdxf3kjr7v4k99wvv4lxv3rxkip39c08550nf48zy"))))
695 (build-system python-build-system)
696 (propagated-inputs (list python-lxml python-six))
697 (home-page "https://github.com/aerkalov/ebooklib")
698 (synopsis "Ebook library which can handle EPUB2/EPUB3 and Kindle format")
700 "Ebook library which can handle EPUB2/EPUB3 and Kindle format.")
701 (license license:agpl3+)))
703 (define-public shirah
709 (uri (pypi-uri "shirah_reader" version))
712 "0j15v435lz68c1mj5clfx5dmfyjc6jvvz2q8hqvv799mb2faj42y"))))
713 (build-system python-build-system)
714 (propagated-inputs (list python-beautifulsoup4 python-ebooklib
715 python-syllables python-termcolor))
716 (home-page "https://github.com/hallicopter/shirah-reader")
717 (synopsis "Terminal ebook reader with an optional RSVP mode")
719 "@command{shirah} is a curses based terminal ebook reader that can
720 display ebooks in the usual way or with Rapid Serial Visual Presentation, a
721 method to enable speedreading by showing the text word by word at configurable
723 (license license:gpl2+)))