gnu: Rename module gnutls to tls.
[jackhill/guix/guix.git] / gnu / packages / ebook.scm
CommitLineData
947ae545
AE
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages ebook)
b8ac8c28 20 #:use-module ((guix licenses) #:select (gpl3 lgpl2.1+))
947ae545
AE
21 #:use-module (guix packages)
22 #:use-module (guix download)
a34816ef 23 #:use-module (guix build-system gnu)
b8ac8c28
AE
24 #:use-module (gnu packages)
25 #:use-module (guix build-system python)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages databases)
b8ac8c28
AE
28 #:use-module (gnu packages fontutils)
29 #:use-module (gnu packages freedesktop)
30 #:use-module (gnu packages glib)
31 #:use-module (gnu packages icu4c)
32 #:use-module (gnu packages image)
33 #:use-module (gnu packages imagemagick)
34 #:use-module (gnu packages libusb)
df00e148 35 #:use-module (gnu packages openssl)
b8ac8c28
AE
36 #:use-module (gnu packages pdf)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages qt)
40 #:use-module (gnu packages xorg))
947ae545
AE
41
42(define-public chmlib
43 (package
44 (name "chmlib")
45 (version "0.40")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "http://www.jedrea.com/chmlib/chmlib-"
49 version ".tar.bz2"))
50 (sha256
51 (base32
a34816ef
AE
52 "18zzb4x3z0d7fjh1x5439bs62dmgsi4c1pg3qyr7h5gp1i5xcj9l"))
53 (patches (list (search-patch "chmlib-inttypes.patch")))))
947ae545
AE
54 (build-system gnu-build-system)
55 (home-page "http://www.jedrea.com/chmlib/")
56 (synopsis "Library for CHM files")
57 (description "CHMLIB is a library for dealing with ITSS/CHM format files.")
71e1de33 58 (license lgpl2.1+)))
b8ac8c28
AE
59
60(define-public calibre
61 (package
62 (name "calibre")
d5711017 63 (version "2.30.0")
b8ac8c28
AE
64 (source
65 (origin
66 (method url-fetch)
67 (uri (string-append "http://download.calibre-ebook.com/"
68 version "/calibre-"
69 version ".tar.xz"))
70 (sha256
71 (base32
d5711017 72 "1k2rpn06nfzqjy5k6fh8pwfj8vbhpn7rgkpkkpz5n2fqg3z8ph1j"))
b8ac8c28
AE
73 ;; Remove non-free or doubtful code, see
74 ;; https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00478.html
75 (modules '((guix build utils)))
76 (snippet
77 '(begin
78 (delete-file-recursively "src/unrar")
79 (delete-file "src/odf/thumbnail.py")))
b655b215
AE
80 (patches (list (search-patch "calibre-drop-unrar.patch")
81 (search-patch "calibre-no-updates-dialog.patch")))))
b8ac8c28
AE
82 (build-system python-build-system)
83 (native-inputs
84 `(("pkg-config" ,pkg-config)
85 ("qt" ,qt) ; for qmake
86 ;; xdg-utils is supposed to be used for desktop integration, but it
87 ;; also creates lots of messages
88 ;; mkdir: cannot create directory '/homeless-shelter': Permission denied
89 ("xdg-utils" ,xdg-utils)))
90 ;; FIXME: The following are missing inputs according to the documentation,
91 ;; but the package can apparently be used without them,
92 ;; They may need to be added if a deficiency is detected.
93 ;; BeautifulSoup >= 3.0.5
94 ;; dnspython >= 1.6.0
95 ;; poppler >= 0.20.2
96 ;; libwmf >= 0.2.8
97 ;; psutil >= 0.6.1
98 ;; python-pygments >= 2.0.1 ; used for ebook editing
99 (inputs
100 `(("chmlib" ,chmlib)
101 ("fontconfig" ,fontconfig)
102 ("glib" ,glib)
103 ("icu4c" ,icu4c)
104 ("imagemagick" ,imagemagick)
105 ("libmtp" ,libmtp)
106 ("libpng" ,libpng)
107 ("libusb" ,libusb)
108 ("libxrender" ,libxrender)
df00e148 109 ("openssl" ,openssl)
b8ac8c28
AE
110 ("podofo" ,podofo)
111 ("python" ,python-2)
112 ("python2-apsw" ,python2-apsw)
113 ("python2-cssselect" ,python2-cssselect)
114 ("python2-cssutils" ,python2-cssutils)
115 ("python2-dateutil" ,python2-dateutil)
116 ("python2-dbus" ,python2-dbus)
117 ("python2-lxml" ,python2-lxml)
118 ("python2-mechanize" ,python2-mechanize)
119 ("python2-netifaces" ,python2-netifaces)
2fbec762 120 ("python2-pillow" ,python2-pillow)
b8ac8c28
AE
121 ("python2-pyqt" ,python2-pyqt)
122 ("python2-sip" ,python2-sip)
123 ("qt" ,qt)
124 ("sqlite" ,sqlite)))
125 (arguments
126 `(#:python ,python-2
127 #:test-target "check"
128 #:tests? #f ; FIXME: enable once flake8 is packaged
129 #:phases
130 (alist-cons-before
131 'build 'configure
132 (lambda* (#:key inputs #:allow-other-keys)
133 (let ((podofo (assoc-ref inputs "podofo"))
134 (pyqt (assoc-ref inputs "python2-pyqt")))
135 (substitute* "setup/build_environment.py"
136 (("sys.prefix") (string-append "'" pyqt "'")))
137 (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
138 (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))))
139 %standard-phases)))
140 (home-page "http://calibre-ebook.com/")
141 (synopsis "E-book library management software")
142 (description "Calibre is an ebook library manager. It can view, convert
143and catalog ebooks in most of the major ebook formats. It can also talk
144to many ebook reader devices. It can go out to the Internet and fetch
145metadata for books. It can download newspapers and convert them into
146ebooks for convenient reading.")
147 (license gpl3))) ; some files are under various other licenses, see COPYRIGHT