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