aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2015-02-17 23:15:18 +0100
committerAndreas Enge <andreas@enge.fr>2015-03-07 00:57:59 +0100
commitb8ac8c282d9a70949d3f603313b643bfd23b1e32 (patch)
tree80ba5823150f53576afb4504cadbe771719e2dea
parent516277cb146b528a3686c5d7d5ce0bd349095af3 (diff)
downloadguix-b8ac8c282d9a70949d3f603313b643bfd23b1e32.tar
guix-b8ac8c282d9a70949d3f603313b643bfd23b1e32.tar.gz
gnu: Add calibre.
* gnu/packages/ebook.scm (calibre): New variable. * gnu/packages/patches/calibre-drop-unrar.patch: New file. * gnu-system.am (dist_patch_DATA): Register patch.
-rw-r--r--gnu-system.am1
-rw-r--r--gnu/packages/ebook.scm108
-rw-r--r--gnu/packages/patches/calibre-drop-unrar.patch49
3 files changed, 156 insertions, 2 deletions
diff --git a/gnu-system.am b/gnu-system.am
index 16e96bb99b..9ac7f6cdbf 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -367,6 +367,7 @@ dist_patch_DATA = \
gnu/packages/patches/bigloo-gc-shebangs.patch \
gnu/packages/patches/binutils-ld-new-dtags.patch \
gnu/packages/patches/binutils-loongson-workaround.patch \
+ gnu/packages/patches/calibre-drop-unrar.patch \
gnu/packages/patches/cdparanoia-fpic.patch \
gnu/packages/patches/chmlib-inttypes.patch \
gnu/packages/patches/clucene-pkgconfig.patch \
diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index e4d609aaf2..a1d887a561 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -17,11 +17,27 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages ebook)
- #:use-module ((guix licenses) #:select (lgpl2.1+))
+ #:use-module ((guix licenses) #:select (gpl3 lgpl2.1+))
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
- #:use-module (gnu packages))
+ #:use-module (gnu packages)
+ #:use-module (guix build-system python)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages databases)
+ #:use-module (gnu packages ebook)
+ #:use-module (gnu packages fontutils)
+ #:use-module (gnu packages freedesktop)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages icu4c)
+ #:use-module (gnu packages image)
+ #:use-module (gnu packages imagemagick)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages pdf)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages qt)
+ #:use-module (gnu packages xorg))
(define-public chmlib
(package
@@ -40,3 +56,91 @@
(synopsis "Library for CHM files")
(description "CHMLIB is a library for dealing with ITSS/CHM format files.")
(license lgpl2.1+)))
+
+(define-public calibre
+ (package
+ (name "calibre")
+ (version "2.20.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://download.calibre-ebook.com/"
+ version "/calibre-"
+ version ".tar.xz"))
+ (sha256
+ (base32
+ "13246f4vxz4ps3c549hrnwdkwic5jsf7g1faham38z1ixd094lkd"))
+ ;; Remove non-free or doubtful code, see
+ ;; https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00478.html
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ (delete-file-recursively "src/unrar")
+ (delete-file "src/odf/thumbnail.py")))
+ (patches (list (search-patch "calibre-drop-unrar.patch")))))
+ (build-system python-build-system)
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("qt" ,qt) ; for qmake
+ ;; xdg-utils is supposed to be used for desktop integration, but it
+ ;; also creates lots of messages
+ ;; mkdir: cannot create directory '/homeless-shelter': Permission denied
+ ("xdg-utils" ,xdg-utils)))
+ ;; FIXME: The following are missing inputs according to the documentation,
+ ;; but the package can apparently be used without them,
+ ;; They may need to be added if a deficiency is detected.
+ ;; BeautifulSoup >= 3.0.5
+ ;; dnspython >= 1.6.0
+ ;; poppler >= 0.20.2
+ ;; libwmf >= 0.2.8
+ ;; psutil >= 0.6.1
+ ;; python-pygments >= 2.0.1 ; used for ebook editing
+ (inputs
+ `(("chmlib" ,chmlib)
+ ("fontconfig" ,fontconfig)
+ ("glib" ,glib)
+ ("icu4c" ,icu4c)
+ ("imagemagick" ,imagemagick)
+ ("libmtp" ,libmtp)
+ ("libpng" ,libpng)
+ ("libusb" ,libusb)
+ ("libxrender" ,libxrender)
+ ("podofo" ,podofo)
+ ("python" ,python-2)
+ ("python2-apsw" ,python2-apsw)
+ ("python2-cssselect" ,python2-cssselect)
+ ("python2-cssutils" ,python2-cssutils)
+ ("python2-dateutil" ,python2-dateutil)
+ ("python2-dbus" ,python2-dbus)
+ ("python2-lxml" ,python2-lxml)
+ ("python2-mechanize" ,python2-mechanize)
+ ("python2-netifaces" ,python2-netifaces)
+ ;; pil is unmaintained, but the maintained fork pillow does not work.
+ ("python2-pil" ,python2-pil)
+ ("python2-pyqt" ,python2-pyqt)
+ ("python2-sip" ,python2-sip)
+ ("qt" ,qt)
+ ("sqlite" ,sqlite)))
+ (arguments
+ `(#:python ,python-2
+ #:test-target "check"
+ #:tests? #f ; FIXME: enable once flake8 is packaged
+ #:phases
+ (alist-cons-before
+ 'build 'configure
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((podofo (assoc-ref inputs "podofo"))
+ (pyqt (assoc-ref inputs "python2-pyqt")))
+ (substitute* "setup/build_environment.py"
+ (("sys.prefix") (string-append "'" pyqt "'")))
+ (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
+ (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))))
+ %standard-phases)))
+ (home-page "http://calibre-ebook.com/")
+ (synopsis "E-book library management software")
+ (description "Calibre is an ebook library manager. It can view, convert
+and catalog ebooks in most of the major ebook formats. It can also talk
+to many ebook reader devices. It can go out to the Internet and fetch
+metadata for books. It can download newspapers and convert them into
+ebooks for convenient reading.")
+ (license gpl3))) ; some files are under various other licenses, see COPYRIGHT
diff --git a/gnu/packages/patches/calibre-drop-unrar.patch b/gnu/packages/patches/calibre-drop-unrar.patch
new file mode 100644
index 0000000000..6b7a9f454c
--- /dev/null
+++ b/gnu/packages/patches/calibre-drop-unrar.patch
@@ -0,0 +1,49 @@
+Taken from Debian.
+
+Author: Dmitry Shachnev <mitya57@gmail.com>
+Description: do not build unrar extension as we strip unrar from the tarball
+Forwarded: not-needed
+Last-Update: 2013-04-04
+
+Index: calibre/setup/extensions.py
+===================================================================
+--- calibre.orig/setup/extensions.py 2014-02-02 10:42:14.510954007 +0100
++++ calibre/setup/extensions.py 2014-02-02 10:42:14.502954007 +0100
+@@ -209,24 +209,6 @@
+ sip_files=['calibre/ebooks/pdf/render/qt_hack.sip']
+ ),
+
+- Extension('unrar',
+- ['unrar/%s.cpp'%(x.partition('.')[0]) for x in '''
+- rar.o strlist.o strfn.o pathfn.o savepos.o smallfn.o global.o file.o
+- filefn.o filcreat.o archive.o arcread.o unicode.o system.o
+- isnt.o crypt.o crc.o rawread.o encname.o resource.o match.o
+- timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o
+- secpassword.o rijndael.o getbits.o sha1.o extinfo.o extract.o
+- volume.o list.o find.o unpack.o cmddata.o filestr.o scantree.o
+- '''.split()] + ['calibre/utils/unrar.cpp'],
+- inc_dirs=['unrar'],
+- cflags=[('/' if iswindows else '-') + x for x in (
+- 'DSILENT', 'DRARDLL', 'DUNRAR')] + (
+- [] if iswindows else ['-D_FILE_OFFSET_BITS=64',
+- '-D_LARGEFILE_SOURCE']),
+- optimize_level=2,
+- libraries=['User32', 'Advapi32', 'kernel32', 'Shell32'] if iswindows else []
+- ),
+-
+ ]
+
+
+Index: calibre/src/calibre/ebooks/metadata/archive.py
+===================================================================
+--- calibre.orig/src/calibre/ebooks/metadata/archive.py 2014-02-02 10:42:14.510954007 +0100
++++ calibre/src/calibre/ebooks/metadata/archive.py 2014-02-02 10:42:14.502954007 +0100
+@@ -42,7 +42,7 @@
+ description = _('Extract common e-book formats from archives '
+ '(zip/rar) files. Also try to autodetect if they are actually '
+ 'cbz/cbr files.')
+- file_types = set(['zip', 'rar'])
++ file_types = set(['zip'])
+ supported_platforms = ['windows', 'osx', 'linux']
+ on_import = True
+