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