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