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