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>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages ebook)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix utils)
34 #:use-module (guix gexp)
35 #:use-module (guix git-download)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system meson)
39 #:use-module (guix build-system python)
40 #:use-module (guix build-system qt)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages bash)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages curl)
46 #:use-module (gnu packages databases)
47 #:use-module (gnu packages file)
48 #:use-module (gnu packages fonts)
49 #:use-module (gnu packages fontutils)
50 #:use-module (gnu packages freedesktop)
51 #:use-module (gnu packages fribidi)
52 #:use-module (gnu packages gcc)
53 #:use-module (gnu packages gettext)
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages gnome)
56 #:use-module (gnu packages glib)
57 #:use-module (gnu packages gstreamer)
58 #:use-module (gnu packages icu4c)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages javascript)
61 #:use-module (gnu packages language)
62 #:use-module (gnu packages libusb)
63 #:use-module (gnu packages libreoffice)
64 #:use-module (gnu packages music)
65 #:use-module (gnu packages pantheon)
66 #:use-module (gnu packages pdf)
67 #:use-module (gnu packages pkg-config)
68 #:use-module (gnu packages python)
69 #:use-module (gnu packages python-build)
70 #:use-module (gnu packages python-compression)
71 #:use-module (gnu packages python-crypto)
72 #:use-module (gnu packages python-web)
73 #:use-module (gnu packages python-xyz)
74 #:use-module (gnu packages qt)
75 #:use-module (gnu packages serialization)
76 #:use-module (gnu packages speech)
77 #:use-module (gnu packages sqlite)
78 #:use-module (gnu packages time)
79 #:use-module (gnu packages tls)
80 #:use-module (gnu packages web)
81 #:use-module (gnu packages xml)
82 #:use-module (gnu packages xorg)
83 #:use-module (gnu packages wxwidgets))
91 (uri (string-append "http://www.jedrea.com/chmlib/chmlib-"
95 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
96 (patches (search-patches "chmlib-inttypes.patch"))))
97 (build-system gnu-build-system)
98 (home-page "http://www.jedrea.com/chmlib/")
99 (synopsis "Library for CHM files")
100 (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
101 (license license:lgpl2.1+)))
103 (define-public python-pychm
105 (name "python-pychm")
110 (uri (pypi-uri "pychm" version))
113 "0wpn9ijlsmrpyiwg3drmgz4dms1i1i347adgqw37bkrh3vn6yq16"))))
114 (build-system python-build-system)
117 (home-page "https://github.com/dottedmag/pychm")
118 (synopsis "Handle CHM files")
119 (description "This package provides a Python module for interacting
120 with Microsoft Compiled HTML (CHM) files")
121 (license license:gpl2+)))
123 (define-public calibre
130 (uri (string-append "http://download.calibre-ebook.com/"
135 "1c036qmn7lxq0899c2xzzs6whz7z0557frnfqisbvfxa13b2sadk"))
136 (modules '((guix build utils)))
139 ;; Unbundle python2-odfpy.
140 (delete-file-recursively "src/odf")
141 ;; Disable test that attempts to load it.
142 (substitute* "setup/test.py"
143 ((".*SRC, 'odf'.*") ""))
144 ;; Remove unneeded resources.
145 (delete-file "resources/mozilla-ca-certs.pem")
146 (delete-file "resources/calibre-portable.bat")
147 (delete-file "resources/calibre-portable.sh")))
148 (patches (search-patches "calibre-no-updates-dialog.patch"
149 "calibre-remove-test-sqlite.patch" ; TODO: fix test.
150 "calibre-remove-test-unrar.patch"))))
151 (build-system python-build-system)
177 python-beautifulsoup4
182 python-dnspython-1.16
191 ;; python-msgpack is needed for the network content server to work.
200 python-pyqt-without-qtwebkit
209 ;; Calibre is using setuptools by itself, but the setup.py is not
210 ;; compatible with the shim wrapper (taken from pip) we are using.
213 #~(modify-phases %standard-phases
214 (add-after 'unpack 'patch-source
216 (substitute* "src/calibre/linux.py"
217 ;; We can't use the uninstaller in Guix. Don't build it.
218 (("self\\.create_uninstaller()") ""))))
219 (add-after 'patch-source-shebangs 'patch-more-shebangs
220 (lambda* (#:key inputs native-inputs #:allow-other-keys)
221 ;; Patch various inline shebangs.
222 (substitute* '("src/calibre/gui2/preferences/tweaks.py"
223 "src/calibre/gui2/dialogs/custom_recipes.py"
225 "setup/linux-installer.sh")
226 (("#!/usr/bin/env python")
227 (string-append "#!" (search-input-file inputs "/bin/python")))
230 (search-input-file native-inputs "/bin/sh"))))))
231 (add-after 'unpack 'dont-load-remote-icons
233 (substitute* "setup/plugins_mirror.py"
234 (("href=\"//calibre-ebook.com/favicon.ico\"")
235 "href=\"favicon.ico\""))))
236 (add-before 'build 'configure
237 (lambda* (#:key inputs #:allow-other-keys)
238 (substitute* "setup/build.py"
239 (("\\[tool.sip.bindings.pictureflow\\]")
240 "[tool.sip.bindings.pictureflow]
241 tags = [\"WS_X11\"]")
242 (("\\[tool.sip.project\\]")
243 (string-append "[tool.sip.project]
244 sip-include-dirs = [\""
245 #$(this-package-input
246 "python-pyqt-without-qtwebkit")
248 (substitute* "src/calibre/ebooks/pdf/pdftohtml.py"
249 (("PDFTOHTML = 'pdftohtml'")
250 (string-append "PDFTOHTML = \""
251 (search-input-file inputs "/bin/pdftohtml")
253 ;; get_exe_path looks in poppler's output for these
254 ;; binaries. Make it not do that.
255 (substitute* "src/calibre/utils/img.py"
256 (("get_exe_path..jpegtran..")
258 (search-input-file inputs "/bin/jpegtran")
260 (("get_exe_path..cjpeg..")
262 (search-input-file inputs "/bin/cjpeg")
264 (("get_exe_path..optipng..")
266 (search-input-file inputs "/bin/optipng")
268 (("get_exe_path..JxrDecApp..")
270 (search-input-file inputs "/bin/JxrDecApp")
272 ;; Calibre thinks we are installing desktop files into a home
273 ;; directory, but here we butcher the script in to installing
274 ;; to calibres /share directory.
275 (setenv "XDG_DATA_HOME" (string-append #$output "/share"))
276 (substitute* "src/calibre/linux.py"
277 (("'~/.local/share'") "''"))
278 ;; 'python setup.py rapydscript' uses QtWebEngine, which
279 ;; needs to create temporary files in $HOME.
280 (setenv "HOME" "/tmp")
281 ;; XXX: QtWebEngine will fail if no fonts are available. This
282 ;; can likely be removed when fontconfig has been patched to
283 ;; include TrueType fonts by default.
284 (symlink (string-append #$(this-package-input "font-liberation")
287 (let ((podofo #$(this-package-input "podofo")))
288 (setenv "PODOFO_INC_DIR"
289 (string-append podofo "/include/podofo"))
290 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib")))
291 ;; This informs the tests we are a continuous integration
292 ;; environment and thus have no networking.
294 ;; The Qt test complains about being unable to load all image
295 ;; plugins, and I notice the available plugins list it shows
296 ;; lacks 'svg'. Adding qtsvg doesn't fix it, so I'm not sure how
297 ;; to fix it. TODO: Fix test and remove this.
298 (setenv "SKIP_QT_BUILD_TEST" "true")))
299 (add-after 'install 'install-rapydscript
301 ;; Unset so QtWebengine doesn't dump temporary files here.
302 (unsetenv "XDG_DATA_HOME")
303 (invoke "python" "setup.py" "rapydscript")))
304 (add-after 'install 'install-man-pages
306 (copy-recursively "man-pages"
307 (string-append #$output "/share/man"))))
308 ;; The font TTF files are used in some miscellaneous tests, so we
309 ;; unbundle them here to avoid patching the tests.
310 (add-after 'install 'unbundle-font-liberation
313 (string-append #$output "/share/calibre/fonts/liberation"))
315 (string-append #$(this-package-input "font-liberation")
316 "/share/fonts/truetype")))
317 (delete-file-recursively font-dest)
318 (symlink font-src font-dest))))
319 ;; Make run-time dependencies available to the binaries.
320 (add-after 'wrap 'wrap-program
321 (lambda* (#:key inputs #:allow-other-keys)
322 (with-directory-excursion (string-append #$output "/bin")
326 ;; Make QtWebEngineProcess available.
327 `("QTWEBENGINEPROCESS_PATH" =
330 inputs "/lib/qt5/libexec/QtWebEngineProcess")))))
331 ;; Wrap all the binaries shipping with the package, except
332 ;; for the wrappings created during the 'wrap standard
333 ;; phase. This extends existing .calibre-real wrappers
334 ;; rather than create ..calibre-real-real-s. For more
335 ;; information see: https://issues.guix.gnu.org/43249.
336 (find-files "." (lambda (file stat)
337 (not (wrapped-program? file)))))))))))
338 (home-page "https://calibre-ebook.com/")
339 (synopsis "E-book library management software")
340 (description "Calibre is an e-book library manager. It can view, convert
341 and catalog e-books in most of the major e-book formats. It can also talk
342 to many e-book reader devices. It can go out to the Internet and fetch
343 metadata for books. It can download newspapers and convert them into
344 e-books for convenient reading.")
345 ;; Calibre is largely GPL3+, but includes a number of components covered
346 ;; by other licenses. See COPYRIGHT for more details.
347 (license (list license:gpl3+
355 license:public-domain
357 license:cc-by-sa3.0))))
359 (define-public ebook-tools
366 (uri (string-append "mirror://sourceforge/ebook-tools/ebook-tools/"
367 version "/ebook-tools-" version ".tar.gz"))
370 "1bi7wsz3p5slb43kj7lgb3r6lb91lvb6ldi556k4y50ix6b5khyb"))))
372 `(#:tests? #f)) ; No 'test' target
373 (build-system cmake-build-system)
377 (list libzip libxml2))
378 (home-page "http://ebook-tools.sourceforge.net")
379 (synopsis "Tools and library for dealing with various ebook file formats")
380 (description "This package provides command-line tools and a library for
381 accessing and converting various ebook file formats.")
382 (license license:expat)))
384 (define-public inkbox
393 (url "https://alpinekobox.ddns.net/InkBox/inkbox/")
395 (file-name (git-file-name name version))
397 (base32 "126cqn0ixcn608lv2hd9f7zmzj4g448bnpxc7wv9cvg83qqajh5n"))))
398 (build-system qt-build-system)
400 '(#:tests? #f ; no test suite
402 (list (string-append "PREFIX="
403 (assoc-ref %outputs "out")))
405 (modify-phases %standard-phases
406 (add-after 'unpack 'prefix-opt
407 (lambda* (#:key outputs #:allow-other-keys)
408 (substitute* "inkbox.pro"
409 (("/opt/\\$\\$\\{TARGET\\}") (string-append (assoc-ref outputs "out"))))))
411 (lambda* (#:key make-flags #:allow-other-keys)
412 (apply invoke (cons "qmake" make-flags)))))))
415 (home-page "https://alpinekobox.ddns.net/InkBox/inkbox/")
416 (synopsis "EBook reader")
417 (description "This package provides InkBox eBook reader.")
418 (license license:gpl3)))
420 (define-public liblinebreak
422 (name "liblinebreak")
426 (uri (string-append "mirror://sourceforge/vimgadgets"
427 "/liblinebreak/" version
428 "/liblinebreak-" version ".tar.gz"))
431 "1f36dbq7nc77lln1by2n1yl050g9dc63viawhs3gc3169mavm36x"))))
432 (build-system gnu-build-system)
433 (home-page "http://vimgadgets.sourceforge.net/liblinebreak/")
434 (synopsis "Library for detecting where linebreaks are allowed in text")
435 (description "@code{liblinebreak} is an implementation of the line
436 breaking algorithm as described in Unicode 6.0.0 Standard Annex 14,
437 Revision 26. It breaks lines that contain Unicode characters. It is
438 designed to be used in a generic text renderer.")
439 (license license:zlib)))
441 (define-public fbreader
448 (url "https://github.com/geometer/FBReader")
449 (commit (string-append version "-freebsdport"))))
450 (file-name (git-file-name name version))
453 "0c0s4silpax74kwfz3dfmzn4lkv6jsyb800vfak166vii0hvbv3d"))
454 (patches (search-patches "fbreader-curl-7.62.patch"))))
455 (build-system gnu-build-system)
462 ("libjpeg" ,libjpeg-turbo)
463 ("liblinebreak" ,liblinebreak)
469 ("pkg-config" ,pkg-config)))
471 `(#:tests? #f ; No tests exist.
472 #:make-flags `("CC=gcc" "TARGET_ARCH=desktop" "UI_TYPE=gtk"
473 "TARGET_STATUS=release"
474 ,(string-append "INSTALLDIR="
475 (assoc-ref %outputs "out"))
476 ,(string-append "LDFLAGS=-Wl,-rpath="
477 (assoc-ref %outputs "out") "/lib"))
479 (modify-phases %standard-phases
480 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
481 (lambda* (#:key inputs #:allow-other-keys)
482 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent a header
483 ;; conflict with the GCC provided in native-inputs.
484 (let ((gcc (assoc-ref inputs "gcc")))
485 (setenv "CPLUS_INCLUDE_PATH"
487 (delete (string-append gcc "/include/c++")
488 (string-split (getenv "CPLUS_INCLUDE_PATH")
493 (add-after 'unpack 'fix-install-locations
494 (lambda* (#:key outputs #:allow-other-keys)
495 (let ((out (assoc-ref outputs "out")))
496 (substitute* "fbreader/desktop/Makefile"
499 (home-page "https://fbreader.org/")
500 (synopsis "E-Book reader")
501 (description "@code{fbreader} is an E-Book reader. It supports the
516 (license license:gpl2+)))
526 (url "https://github.com/geigi/cozy")
528 (file-name (git-file-name name version))
530 (base32 "0igqf9b77i13sxlk4ziw549h379hmz1slrb3vvf8irk94gxabsaw"))))
531 (build-system meson-build-system)
535 (modify-phases %standard-phases
536 (add-after 'unpack 'patch-desktop-file
538 (substitute* "data/com.github.geigi.cozy.desktop"
539 (("Exec=com.github.geigi.cozy") "Exec=cozy"))))
540 (add-after 'install 'patch-executable-name
541 (lambda* (#:key outputs #:allow-other-keys)
542 (with-directory-excursion
543 (string-append (assoc-ref outputs "out") "/bin")
544 (rename-file "com.github.geigi.cozy" "cozy"))))
545 (add-after 'wrap 'wrap-libs
546 (lambda* (#:key outputs #:allow-other-keys)
547 (let* ((out (assoc-ref outputs "out"))
548 (pylib (string-append
550 ,(version-major+minor
551 (package-version python))
553 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
554 (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH"))
555 (libmagic-path (string-append
556 (assoc-ref %build-inputs "file")
558 (python-path (getenv "GUIX_PYTHONPATH")))
559 (wrap-program (string-append out "/bin/cozy")
560 `("LD_LIBRARY_PATH" ":" prefix (,libmagic-path))
561 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
562 `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))
563 `("GUIX_PYTHONPATH" ":" prefix (,python-path ,pylib)))))))))
565 (list desktop-file-utils
568 gobject-introspection
576 gsettings-desktop-schemas
594 (home-page "https://cozy.geigi.de/")
595 (synopsis "Modern audiobook player using GTK+")
597 "Cozy is a modern audiobook player written in GTK+.
599 Some of the current features:
602 @item Import your audiobooks into Cozy to browse them comfortably
603 @item Sort your audio books by author, reader & name
604 @item Remembers your playback position
606 @item Playback speed control
607 @item Search your library
609 @item Add multiple storage locations
610 @item Drag & Drop to import new audio books
611 @item Support for DRM free mp3, m4a (aac, ALAC, …), flac, ogg, opus, wav files
612 @item Mpris integration (Media keys & playback info for desktop environment)
614 ;; TODO: Unbundle python-inject.
615 (license (list license:gpl3+ ;cozy
616 license:asl2.0)))) ;python-inject (bundled dependency)
624 (uri (string-append "https://github.com/rzvncj/xCHM"
625 "/releases/download/"
626 version "/xchm-" version ".tar.gz"))
629 "0an09shap2wj9gzj5fsw5sc2i6paq3kc3mc52fnwg2bb2dan5qxk"))))
630 (build-system gnu-build-system)
632 (list wxwidgets chmlib))
635 (home-page "https://github.com/rzvncj/xCHM")
636 (synopsis "CHM file viewer")
637 (description "xCHM is a graphical CHM file viewer. It is a frontend to
638 the CHM library CHMLIB.")
639 (license license:gpl2+)))
641 (define-public libmobi
648 (url "https://github.com/bfabiszewski/libmobi/")
649 (commit (string-append "v" version))))
650 (file-name (git-file-name name version))
653 "0yps72cm609xn2k7alflkdhp9kgr1w7zzyxjygz0n1kqrdcplihh"))))
654 (build-system gnu-build-system)
656 (list autoconf automake libtool))
659 (home-page "https://github.com/bfabiszewski/libmobi/")
660 (synopsis "C library for handling MOBI formats")
661 (description "Libmobi is a C library for handling MOBI ebook
662 format documents, with the following features:
665 @item reading and parsing:
667 @item some older text Palmdoc formats (pdb),
668 @item Mobipocket files (prc, mobi),
669 @item newer MOBI files including KF8 format (azw, azw3),
670 @item Replica Print files (azw4)
672 @item recreating source files using indices
673 @item reconstructing references (links and embedded) in html files
674 @item reconstructing source structure that can be fed back to kindlegen
675 @item reconstructing dictionary markup (orth, infl tags)
676 @item writing back loaded documents
677 @item metadata editing
678 @item handling encrypted documents
680 (license license:lgpl3+)))