gnu: calibre: Update to 3.11.1.
[jackhill/guix/guix.git] / gnu / packages / ebook.scm
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>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
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.
14 ;;;
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.
19 ;;;
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/>.
22
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 compression)
32 #:use-module (gnu packages curl)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages fonts)
35 #:use-module (gnu packages fontutils)
36 #:use-module (gnu packages freedesktop)
37 #:use-module (gnu packages fribidi)
38 #:use-module (gnu packages gtk)
39 #:use-module (gnu packages gnome)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages icu4c)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages libusb)
44 #:use-module (gnu packages pdf)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages qt)
48 #:use-module (gnu packages serialization)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages web)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xorg))
53
54 (define-public chmlib
55 (package
56 (name "chmlib")
57 (version "0.40")
58 (source (origin
59 (method url-fetch)
60 (uri (string-append "http://www.jedrea.com/chmlib/chmlib-"
61 version ".tar.bz2"))
62 (sha256
63 (base32
64 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
65 (patches (search-patches "chmlib-inttypes.patch"))))
66 (build-system gnu-build-system)
67 (home-page "http://www.jedrea.com/chmlib/")
68 (synopsis "Library for CHM files")
69 (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
70 (license license:lgpl2.1+)))
71
72 (define-public calibre
73 (package
74 (name "calibre")
75 (version "3.11.1")
76 (source
77 (origin
78 (method url-fetch)
79 (uri (string-append "http://download.calibre-ebook.com/"
80 version "/calibre-"
81 version ".tar.xz"))
82 (sha256
83 (base32
84 "0kwza7iyyyfhq476z5fk9962iyd0qpgmzm1k36nqcy8sfjbk8mrl"))
85 ;; Remove non-free or doubtful code, see
86 ;; https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00478.html
87 (modules '((guix build utils)))
88 (snippet
89 '(begin
90 (delete-file-recursively "src/calibre/ebooks/markdown")
91 (delete-file "src/odf/thumbnail.py")
92 (delete-file-recursively "resources/fonts/liberation")
93 (substitute* (find-files "." "\\.py")
94 (("calibre\\.ebooks\\.markdown") "markdown"))
95 #t))
96 (patches (search-patches "calibre-use-packaged-feedparser.patch"
97 "calibre-no-updates-dialog.patch"))))
98 (build-system python-build-system)
99 (native-inputs
100 `(("pkg-config" ,pkg-config)
101 ("font-liberation" ,font-liberation)
102 ("qtbase" ,qtbase) ; for qmake
103 ;; xdg-utils is supposed to be used for desktop integration, but it
104 ;; also creates lots of messages
105 ;; mkdir: cannot create directory '/homeless-shelter': Permission denied
106 ("python2-flake8" ,python2-flake8)
107 ("xdg-utils" ,xdg-utils)))
108 ;; Beautifulsoup3 is bundled but obsolete and not packaged, so just leave it bundled.
109 (inputs
110 `(("chmlib" ,chmlib)
111 ("fontconfig" ,fontconfig)
112 ("glib" ,glib)
113 ("icu4c" ,icu4c)
114 ("libmtp" ,libmtp)
115 ("libpng" ,libpng)
116 ("libusb" ,libusb)
117 ("libxrender" ,libxrender)
118 ("openssl" ,openssl)
119 ("podofo" ,podofo)
120 ("poppler" ,poppler)
121 ("python" ,python-2)
122 ("python2-apsw" ,python2-apsw)
123 ("python2-chardet" ,python2-chardet)
124 ("python2-cssselect" ,python2-cssselect)
125 ("python2-cssutils" ,python2-cssutils)
126 ("python2-dateutil" ,python2-dateutil)
127 ("python2-dbus" ,python2-dbus)
128 ("python2-dnspython" ,python2-dnspython)
129 ("python2-feedparser" ,python2-feedparser)
130 ("python2-html5-parser" ,python2-html5-parser)
131 ("python2-lxml" ,python2-lxml)
132 ("python2-markdown" ,python2-markdown)
133 ("python2-mechanize" ,python2-mechanize)
134 ;; python2-msgpack is needed for the network content server to work.
135 ("python2-msgpack" ,python2-msgpack)
136 ("python2-netifaces" ,python2-netifaces)
137 ("python2-pillow" ,python2-pillow)
138 ("python2-pygments" ,python2-pygments)
139 ("python2-pyqt" ,python2-pyqt)
140 ("python2-sip" ,python2-sip)
141 ("python2-regex" ,python2-regex)
142 ;; python2-unrardll is needed for decompressing RAR files.
143 ;; A program called 'pdf2html' is needed for reading PDF books
144 ;; in the web interface.
145 ("sqlite" ,sqlite)))
146 (arguments
147 `(#:python ,python-2
148 #:test-target "check"
149 #:tests? #f ; FIXME: enable once flake8 is packaged
150 ;; Calibre is using setuptools by itself, but the setup.py is not
151 ;; compatible with the shim wrapper (taken from pip) we are using.
152 #:use-setuptools? #f
153 #:phases
154 (modify-phases %standard-phases
155 (add-after 'unpack 'patch-source
156 (lambda _
157 (substitute* "src/calibre/linux.py"
158 ;; We can't use the uninstaller in Guix. Don't build it.
159 (("self\\.create_uninstaller()") ""))
160 #t))
161 (add-after 'unpack 'dont-load-remote-icons
162 (lambda _
163 (substitute* "setup/plugins_mirror.py"
164 (("href=\"//calibre-ebook.com/favicon.ico\"")
165 "href=\"favicon.ico\""))
166 #t))
167 (add-before 'build 'configure
168 (lambda* (#:key inputs #:allow-other-keys)
169 (let ((podofo (assoc-ref inputs "podofo"))
170 (pyqt (assoc-ref inputs "python2-pyqt")))
171 (substitute* "setup/build_environment.py"
172 (("sys.prefix") (string-append "'" pyqt "'")))
173 (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
174 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib")))))
175 (add-after 'install 'install-font-liberation
176 (lambda* (#:key inputs outputs #:allow-other-keys)
177 (for-each (lambda (file)
178 (install-file file (string-append
179 (assoc-ref outputs "out")
180 "/share/calibre/fonts/liberation")))
181 (find-files (string-append
182 (assoc-ref inputs "font-liberation")
183 "/share/fonts/truetype")))
184 #t)))))
185 (home-page "http://calibre-ebook.com/")
186 (synopsis "E-book library management software")
187 (description "Calibre is an ebook library manager. It can view, convert
188 and catalog ebooks in most of the major ebook formats. It can also talk
189 to many ebook reader devices. It can go out to the Internet and fetch
190 metadata for books. It can download newspapers and convert them into
191 ebooks for convenient reading.")
192 ;; Calibre is largely GPL3+, but includes a number of components covered
193 ;; by other licenses. See COPYRIGHT for more details.
194 (license (list license:gpl3+
195 license:gpl2+
196 license:lgpl2.1+
197 license:lgpl2.1
198 license:bsd-3
199 license:expat
200 license:zpl2.1
201 license:asl2.0
202 license:public-domain
203 license:silofl1.1
204 license:cc-by-sa3.0))))
205
206 (define-public liblinebreak
207 (package
208 (name "liblinebreak")
209 (version "2.1")
210 (source (origin
211 (method url-fetch)
212 (uri (string-append "mirror://sourceforge/vimgadgets"
213 "/liblinebreak/" version
214 "/liblinebreak-" version ".tar.gz"))
215 (sha256
216 (base32
217 "1f36dbq7nc77lln1by2n1yl050g9dc63viawhs3gc3169mavm36x"))))
218 (build-system gnu-build-system)
219 (home-page "http://vimgadgets.sourceforge.net/liblinebreak/")
220 (synopsis "Library for detecting where linebreaks are allowed in text")
221 (description "@code{liblinebreak} is an implementation of the line
222 breaking algorithm as described in Unicode 6.0.0 Standard Annex 14,
223 Revision 26. It breaks lines that contain Unicode characters. It is
224 designed to be used in a generic text renderer.")
225 (license license:zlib)))
226
227 (define-public fbreader
228 (package
229 (name "fbreader")
230 (version "0.99.6")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "https://github.com/geometer/FBReader/"
234 "archive/" version "-freebsdport.tar.gz"))
235 (file-name (string-append name "-" version ".tar.gz"))
236 (sha256
237 (base32
238 "0gf1nl562fqkwlzcn6rgkp1j8jcixzmfsnwxbc0sm49zh8n3zqib"))))
239 (build-system gnu-build-system)
240 (inputs
241 `(("curl" ,curl)
242 ("expat" ,expat)
243 ("fribidi" ,fribidi)
244 ("glib" ,glib)
245 ("gtk+-2" ,gtk+-2)
246 ("libjpeg" ,libjpeg)
247 ("liblinebreak" ,liblinebreak)
248 ("libxft" ,libxft)
249 ("sqlite" ,sqlite)
250 ("zlib" ,zlib)))
251 (native-inputs
252 `(("pkg-config" ,pkg-config)))
253 (arguments
254 `(#:tests? #f ; No tests exist.
255 #:make-flags `("CC=gcc" "TARGET_ARCH=desktop" "UI_TYPE=gtk"
256 "TARGET_STATUS=release"
257 ,(string-append "INSTALLDIR="
258 (assoc-ref %outputs "out"))
259 ,(string-append "LDFLAGS=-Wl,-rpath="
260 (assoc-ref %outputs "out") "/lib"))
261 #:phases
262 (modify-phases %standard-phases
263 (delete 'configure))))
264 (home-page "https://fbreader.org/")
265 (synopsis "E-Book reader")
266 (description "@code{fbreader} is an E-Book reader. It supports the
267 following formats:
268
269 @enumerate
270 @item CHM
271 @item Docbook
272 @item FB2
273 @item HTML
274 @item OEB
275 @item PDB
276 @item RTF
277 @item TCR
278 @item TXT
279 @item XHTML
280 @end enumerate")
281 (license license:gpl2+)))