gnu: calibre: Update to 3.35.0.
[jackhill/guix/guix.git] / gnu / packages / ebook.scm
CommitLineData
947ae545 1;;; GNU Guix --- Functional package management for GNU
7d1f8d4f 2;;; Copyright © 2015, 2016 Andreas Enge <andreas@enge.fr>
9acd40fe 3;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
37e8a2e2 4;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
cd6171c1 5;;; Copyright © 2017 Brendan Tildesley <brendan.tildesley@openmailbox.org>
f70f3407 6;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
ae16afe9 7;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
947ae545
AE
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)
affaf98f 25 #:use-module ((guix licenses) #:prefix license:)
947ae545
AE
26 #:use-module (guix packages)
27 #:use-module (guix download)
a34816ef 28 #:use-module (guix build-system gnu)
b8ac8c28
AE
29 #:use-module (gnu packages)
30 #:use-module (guix build-system python)
31 #:use-module (gnu packages)
d6ef422f
DM
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages curl)
b8ac8c28 34 #:use-module (gnu packages databases)
b3399a09 35 #:use-module (gnu packages fonts)
b8ac8c28
AE
36 #:use-module (gnu packages fontutils)
37 #:use-module (gnu packages freedesktop)
d6ef422f
DM
38 #:use-module (gnu packages fribidi)
39 #:use-module (gnu packages gtk)
eeba7d3a 40 #:use-module (gnu packages gnome)
b8ac8c28
AE
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages icu4c)
43 #:use-module (gnu packages image)
b8ac8c28
AE
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)
1b2f753d 48 #:use-module (gnu packages python-web)
b8ac8c28 49 #:use-module (gnu packages qt)
9ef5940c 50 #:use-module (gnu packages serialization)
33dc54b0 51 #:use-module (gnu packages time)
cc2b77df 52 #:use-module (gnu packages tls)
d94a99ec 53 #:use-module (gnu packages web)
d6ef422f 54 #:use-module (gnu packages xml)
b8ac8c28 55 #:use-module (gnu packages xorg))
947ae545
AE
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
a34816ef 67 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
fc1adab1 68 (patches (search-patches "chmlib-inttypes.patch"))))
947ae545
AE
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.")
affaf98f 73 (license license:lgpl2.1+)))
b8ac8c28
AE
74
75(define-public calibre
76 (package
77 (name "calibre")
ec60c3a5 78 (version "3.35.0")
b8ac8c28
AE
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
9acd40fe 86 (base32
ec60c3a5 87 "1gd15wjz4fhcra6d44xiy3hwbyk0miwb66a1pq5yldyy0hlb271z"))
b8ac8c28
AE
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
29ec0851 93 (delete-file-recursively "src/calibre/ebooks/markdown")
29ec0851 94 (delete-file "src/odf/thumbnail.py")
b3399a09 95 (delete-file-recursively "resources/fonts/liberation")
29ec0851
BT
96 (substitute* (find-files "." "\\.py")
97 (("calibre\\.ebooks\\.markdown") "markdown"))
98 #t))
026ebc14 99 (patches (search-patches "calibre-use-packaged-feedparser.patch"
fc1adab1 100 "calibre-no-updates-dialog.patch"))))
b8ac8c28
AE
101 (build-system python-build-system)
102 (native-inputs
103 `(("pkg-config" ,pkg-config)
b3399a09 104 ("font-liberation" ,font-liberation)
c5ea9120 105 ("qtbase" ,qtbase) ; for qmake
b8ac8c28
AE
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
9b7dcc27 109 ("python2-flake8" ,python2-flake8)
b8ac8c28 110 ("xdg-utils" ,xdg-utils)))
9b7dcc27 111 ;; Beautifulsoup3 is bundled but obsolete and not packaged, so just leave it bundled.
b8ac8c28
AE
112 (inputs
113 `(("chmlib" ,chmlib)
114 ("fontconfig" ,fontconfig)
115 ("glib" ,glib)
116 ("icu4c" ,icu4c)
b8ac8c28
AE
117 ("libmtp" ,libmtp)
118 ("libpng" ,libpng)
119 ("libusb" ,libusb)
120 ("libxrender" ,libxrender)
df00e148 121 ("openssl" ,openssl)
9132212f 122 ("optipng" ,optipng)
b8ac8c28 123 ("podofo" ,podofo)
9b7dcc27 124 ("poppler" ,poppler)
b8ac8c28
AE
125 ("python" ,python-2)
126 ("python2-apsw" ,python2-apsw)
eeba7d3a 127 ("python2-chardet" ,python2-chardet)
b8ac8c28
AE
128 ("python2-cssselect" ,python2-cssselect)
129 ("python2-cssutils" ,python2-cssutils)
130 ("python2-dateutil" ,python2-dateutil)
131 ("python2-dbus" ,python2-dbus)
9b7dcc27 132 ("python2-dnspython" ,python2-dnspython)
bf4a40db 133 ("python2-dukpy" ,python2-dukpy)
d94a99ec 134 ("python2-feedparser" ,python2-feedparser)
026ebc14 135 ("python2-html5-parser" ,python2-html5-parser)
b8ac8c28 136 ("python2-lxml" ,python2-lxml)
29ec0851 137 ("python2-markdown" ,python2-markdown)
b8ac8c28 138 ("python2-mechanize" ,python2-mechanize)
9ef5940c
MR
139 ;; python2-msgpack is needed for the network content server to work.
140 ("python2-msgpack" ,python2-msgpack)
b8ac8c28 141 ("python2-netifaces" ,python2-netifaces)
2fbec762 142 ("python2-pillow" ,python2-pillow)
9b7dcc27 143 ("python2-pygments" ,python2-pygments)
c5ea9120 144 ("python2-pyqt" ,python2-pyqt)
b8ac8c28 145 ("python2-sip" ,python2-sip)
f70f3407 146 ("python2-regex" ,python2-regex)
026ebc14
RJ
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.
b8ac8c28
AE
150 ("sqlite" ,sqlite)))
151 (arguments
152 `(#:python ,python-2
153 #:test-target "check"
154 #:tests? #f ; FIXME: enable once flake8 is packaged
e89aceab
HG
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
b8ac8c28 158 #:phases
b111bdb6 159 (modify-phases %standard-phases
1326166e
BT
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))
f70f3407
RJ
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))
b111bdb6 172 (add-before 'build 'configure
b8ac8c28
AE
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"))
ae16afe9
TGR
179 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))
180 #t)))
b3399a09
BT
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")))
743d3f65
BT
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"))
b3399a09 196 #t)))))
b8ac8c28
AE
197 (home-page "http://calibre-ebook.com/")
198 (synopsis "E-book library management software")
8572adb2
TGR
199 (description "Calibre is an e-book library manager. It can view, convert
200and catalog e-books in most of the major e-book formats. It can also talk
201to many e-book reader devices. It can go out to the Internet and fetch
b8ac8c28 202metadata for books. It can download newspapers and convert them into
8572adb2 203e-books for convenient reading.")
affaf98f
BT
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))))
84a52639
DM
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
234breaking algorithm as described in Unicode 6.0.0 Standard Annex 14,
235Revision 26. It breaks lines that contain Unicode characters. It is
236designed to be used in a generic text renderer.")
237 (license license:zlib)))
d6ef422f
DM
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
279following 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+)))