1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
5 ;;; Copyright © 2017 Brendan Tildesley <brendan.tildesley@openmailbox.org>
6 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages ebook)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages databases)
32 #:use-module (gnu packages fonts)
33 #:use-module (gnu packages fontutils)
34 #:use-module (gnu packages freedesktop)
35 #:use-module (gnu packages gnome)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages icu4c)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages libusb)
40 #:use-module (gnu packages pdf)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages qt)
44 #:use-module (gnu packages serialization)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages web)
47 #:use-module (gnu packages xorg))
55 (uri (string-append "http://www.jedrea.com/chmlib/chmlib-"
59 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
60 (patches (search-patches "chmlib-inttypes.patch"))))
61 (build-system gnu-build-system)
62 (home-page "http://www.jedrea.com/chmlib/")
63 (synopsis "Library for CHM files")
64 (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
65 (license license:lgpl2.1+)))
67 (define-public calibre
74 (uri (string-append "http://download.calibre-ebook.com/"
79 "1zhk7bvgr973dd18x4wp48kzai29qqqi5qcy72sxc4wcbk2sbnkw"))
80 ;; Remove non-free or doubtful code, see
81 ;; https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00478.html
82 (modules '((guix build utils)))
85 (delete-file-recursively "src/calibre/ebooks/markdown")
86 (delete-file-recursively "src/unrar")
87 (delete-file "src/odf/thumbnail.py")
88 (delete-file-recursively "resources/fonts/liberation")
89 (substitute* (find-files "." "\\.py")
90 (("calibre\\.ebooks\\.markdown") "markdown"))
92 (patches (search-patches "calibre-drop-unrar.patch"
93 "calibre-use-packaged-feedparser.patch"
94 "calibre-no-updates-dialog.patch"))))
95 (build-system python-build-system)
97 `(("pkg-config" ,pkg-config)
98 ("font-liberation" ,font-liberation)
99 ("qtbase" ,qtbase) ; for qmake
100 ;; xdg-utils is supposed to be used for desktop integration, but it
101 ;; also creates lots of messages
102 ;; mkdir: cannot create directory '/homeless-shelter': Permission denied
103 ("python2-flake8" ,python2-flake8)
104 ("xdg-utils" ,xdg-utils)))
105 ;; Beautifulsoup3 is bundled but obsolete and not packaged, so just leave it bundled.
108 ("fontconfig" ,fontconfig)
114 ("libxrender" ,libxrender)
119 ("python2-apsw" ,python2-apsw)
120 ("python2-chardet" ,python2-chardet)
121 ("python2-cssselect" ,python2-cssselect)
122 ("python2-cssutils" ,python2-cssutils)
123 ("python2-dateutil" ,python2-dateutil)
124 ("python2-dbus" ,python2-dbus)
125 ("python2-dnspython" ,python2-dnspython)
126 ("python2-feedparser" ,python2-feedparser)
127 ("python2-lxml" ,python2-lxml)
128 ("python2-markdown" ,python2-markdown)
129 ("python2-mechanize" ,python2-mechanize)
130 ;; python2-msgpack is needed for the network content server to work.
131 ("python2-msgpack" ,python2-msgpack)
132 ("python2-netifaces" ,python2-netifaces)
133 ("python2-pillow" ,python2-pillow)
134 ("python2-pygments" ,python2-pygments)
135 ("python2-pyqt" ,python2-pyqt)
136 ("python2-sip" ,python2-sip)
137 ("python2-regex" ,python2-regex)
141 #:test-target "check"
142 #:tests? #f ; FIXME: enable once flake8 is packaged
143 ;; Calibre is using setuptools by itself, but the setup.py is not
144 ;; compatible with the shim wrapper (taken from pip) we are using.
147 (modify-phases %standard-phases
148 (add-after 'unpack 'patch-source
150 (substitute* "src/calibre/linux.py"
151 ;; We can't use the uninstaller in Guix. Don't build it.
152 (("self\\.create_uninstaller()") ""))
154 (add-after 'unpack 'dont-load-remote-icons
156 (substitute* "setup/plugins_mirror.py"
157 (("href=\"//calibre-ebook.com/favicon.ico\"")
158 "href=\"favicon.ico\""))
160 (add-before 'build 'configure
161 (lambda* (#:key inputs #:allow-other-keys)
162 (let ((podofo (assoc-ref inputs "podofo"))
163 (pyqt (assoc-ref inputs "python2-pyqt")))
164 (substitute* "setup/build_environment.py"
165 (("sys.prefix") (string-append "'" pyqt "'")))
166 (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
167 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib")))))
168 (add-after 'install 'install-font-liberation
169 (lambda* (#:key inputs outputs #:allow-other-keys)
170 (for-each (lambda (file)
171 (install-file file (string-append
172 (assoc-ref outputs "out")
173 "/share/calibre/fonts/liberation")))
174 (find-files (string-append
175 (assoc-ref inputs "font-liberation")
176 "/share/fonts/truetype")))
178 (home-page "http://calibre-ebook.com/")
179 (synopsis "E-book library management software")
180 (description "Calibre is an ebook library manager. It can view, convert
181 and catalog ebooks in most of the major ebook formats. It can also talk
182 to many ebook reader devices. It can go out to the Internet and fetch
183 metadata for books. It can download newspapers and convert them into
184 ebooks for convenient reading.")
185 ;; Calibre is largely GPL3+, but includes a number of components covered
186 ;; by other licenses. See COPYRIGHT for more details.
187 (license (list license:gpl3+
195 license:public-domain
197 license:cc-by-sa3.0))))