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