calibre/calibre.spec

291 lines
11 KiB
RPMSpec
Raw Normal View History

#define debug_package %{nil}
2012-12-04 04:13:37 +04:00
Name: calibre
Version: 0.9.30
Release: 1
2012-02-01 22:04:55 +04:00
Summary: E-book converter and library management
2012-11-30 16:19:29 +04:00
Group: Office
License: GPLv3
2012-02-01 22:04:55 +04:00
URL: http://calibre-ebook.com/
2012-02-02 00:20:04 +04:00
Source0: http://calibre-ebook.googlecode.com/files/%{name}-%{version}.tar.xz
2012-11-30 16:19:29 +04:00
Source2: calibre-mount-helper
Patch1: %{name}-no-update-0.8.6.patch
2012-02-01 22:04:55 +04:00
Patch3: %{name}-0.7.27-python-fix.patch
2012-11-30 16:19:29 +04:00
Patch4: %{name}-python2-env-fix.patch
Patch5: %{name}-web-control.patch
# see http://calibre-ebook.com/download_linux
# for mininal requires
BuildRequires: python >= 2.7
BuildRequires: pkgconfig(python) >= 2.7
BuildRequires: imagemagick-devel >= 6.5.9
2012-02-01 22:04:55 +04:00
BuildRequires: python-setuptools
BuildRequires: qt4-devel
BuildRequires: qt4-devel-private
BuildRequires: python-qt4-devel >= 4.9.6
2012-11-30 16:19:29 +04:00
BuildRequires: pkgconfig(poppler-qt4) >= 0.12
BuildRequires: pkgconfig(poppler-glib)
BuildRequires: podofo-devel >= 0.8.2
2012-02-01 22:04:55 +04:00
BuildRequires: desktop-file-utils
BuildRequires: python-mechanize >= 0.1.11
2012-02-01 22:04:55 +04:00
BuildRequires: python-lxml
BuildRequires: python-dateutil >= 1.4.1
BuildRequires: python-imaging >= 1.1.6
BuildRequires: xdg-utils >= 1.0.3
BuildRequires: python-beautifulsoup >= 3.0.5
BuildRequires: chmlib-devel >= 0.40
BuildRequires: python-cssutils >= 0.9.9
2012-11-30 16:19:29 +04:00
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(icu-i18n)
2012-02-01 22:04:55 +04:00
BuildRequires: unzip
BuildRequires: libwmf-devel >= 0.2.8
BuildRequires: python-cherrypy >= 3.2.2
BuildRequires: pkgconfig(libmtp) >= 1.1.5
BuildRequires: chrpath
Requires: imagemagick >= 6.5.9
Requires: python-beautifulsoup >= 3.0.5
Requires: python-cherrypy >= 3.2.2
Requires: python-cssselect >= 0.7.1
Requires: python-cssutils >= 0.9.9
Requires: python-dateutil >= 1.4.1
2012-02-01 22:04:55 +04:00
Requires: python-django-tagging
Requires: python-genshi
Requires: python-imaging >= 1.1.6
Requires: python-lxml
Requires: python-mechanize >= 0.1.11
2013-05-12 20:57:19 +04:00
Requires: python-netifaces
Requires: python-odf
Requires: python-pypdf
Requires: python-qt4
2012-11-30 16:19:29 +04:00
Requires: poppler
2012-02-02 00:20:04 +04:00
# Require the packages of the files which are symlinked by calibre
Requires: fonts-ttf-liberation
# E-mail functionality requires this package
# see https://bugs.launchpad.net/calibre/+bug/739073
Requires: python-dnspython >= 1.6.0
2012-02-01 22:04:55 +04:00
%description
Calibre is meant to be a complete e-library solution. It includes library
management, format conversion, news feeds to ebook conversion as well as
e-book reader sync features.
Calibre is primarily a ebook cataloging program. It manages your ebook
collection for you. It is designed around the concept of the logical book,
i.e. a single entry in the database that may correspond to ebooks in several
formats. It also supports conversion to and from a dozen different ebook
formats.
2012-11-30 16:19:29 +04:00
Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML, CBR, CBZ,
RTF, TXT, PDF and LRS.
%files
#-f %{name}.lang
%doc COPYRIGHT LICENSE Changelog.yaml
%{_bindir}/calibre
%{_bindir}/calibre-complete
%{_bindir}/calibre-customize
%{_bindir}/calibre-debug
%{_bindir}/calibre-parallel
%{_bindir}/calibre-server
%{_bindir}/calibre-smtp
%{_bindir}/calibre-mount-helper
%{_bindir}/calibredb
%{_bindir}/ebook-convert
%{_bindir}/ebook-device
%{_bindir}/ebook-meta
%{_bindir}/ebook-viewer
#{_bindir}/epub-fix
%{_bindir}/ebook-polish
2012-11-30 16:19:29 +04:00
%{_bindir}/fetch-ebook-metadata
%{_bindir}/lrf2lrs
%{_bindir}/lrfviewer
%{_bindir}/lrs2lrf
%{_bindir}/markdown-calibre
%{_bindir}/web2disk
%config(noreplace) %{_sysconfdir}/bash_completion.d/%{name}
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/pixmaps/*
%{_datadir}/applications/*.desktop
%{_datadir}/mime/packages/*
%{_datadir}/icons/hicolor/scalable/mimetypes/*
%{_datadir}/icons/hicolor/*/apps/*
%{python_sitelib}/init_calibre.py*
#--------------------------------------------------------------------
2012-02-01 22:04:55 +04:00
%prep
%setup -q -n %{name}
# remove redundant / non-free fonts
2012-11-30 16:19:29 +04:00
rm -rf resources/fonts/*/
2012-02-01 22:04:55 +04:00
2012-11-30 16:19:29 +04:00
# don't check for new upstream version (that's what packagers do)
# otherwise the plugins are safe to be updated in ~/.config/calibre/plugins/
%patch1 -F 2 -p1 -b .no-update
# libs
2012-02-01 22:04:55 +04:00
%patch3 -p1 -b .python-fix
2012-11-30 16:19:29 +04:00
# there is no python2 symlink to python2.7
# but just python, as opposed to python3
%patch4 -p1 -b .python2-env-fix
# import from QtNetwork, not Qt
%patch5 -p1 -b .python-web-control
2012-02-01 22:04:55 +04:00
# dos2unix newline conversion
2012-12-04 04:13:37 +04:00
sed -i -e 's/\r//' src/calibre/web/feeds/recipes/*
2012-11-30 16:19:29 +04:00
# fix the location of liberation default font
2012-12-04 04:13:37 +04:00
# sed -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
2012-11-30 16:19:29 +04:00
# src/calibre/library/catalog.py
2012-12-04 04:13:37 +04:00
sed -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
2012-11-30 16:19:29 +04:00
src/calibre/utils/magick/draw.py
2012-12-04 04:13:37 +04:00
sed -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
2012-11-30 16:19:29 +04:00
src/calibre/web/feeds/news.py
2012-12-04 04:13:37 +04:00
sed -i -e "s:P('fonts/liberation/LiberationSerif:('%{_datadir}/fonts/TTF/liberation/LiberationSerif:" \
2012-11-30 16:19:29 +04:00
recipes/*_ke.recipe
2012-02-01 22:04:55 +04:00
# remove shebangs
2012-12-04 04:13:37 +04:00
sed -i -e '/^#!\//, 1d' src/calibre/*/*/*/*.py
sed -i -e '/^#!\//, 1d' src/calibre/*/*/*.py
sed -i -e '/^#![ ]*\//, 1d' src/calibre/*/*.py
sed -i -e '/^#!\//, 1d' src/calibre/*.py
sed -i -e '/^#!\//, 1d' src/templite/*.py
sed -i -e '/^#!\//, 1d' resources/default_tweaks.py
sed -i -e '/^#!\//, 1d' recipes/*.recipe
chmod -x src/calibre/*/*/*/*.py
chmod -x src/calibre/*/*/*.py
chmod -x src/calibre/*/*.py
chmod -x src/calibre/*.py
chmod -x recipes/*.recipe
2012-02-01 22:04:55 +04:00
%build
OVERRIDE_CFLAGS="%{optflags}" LANG='en_US.UTF-8' python setup.py build
LANG='en_US.UTF-8' python setup.py translations
2012-02-01 22:04:55 +04:00
%install
mkdir -p %{buildroot}%{_datadir}
# create directories for xdg-utils
mkdir -p %{buildroot}%{_datadir}/icons
mkdir -p %{buildroot}%{_datadir}/icons/hicolor
mkdir -p %{buildroot}%{_datadir}/packages
mkdir -p %{buildroot}%{_datadir}/mime
mkdir -p %{buildroot}%{_datadir}/mime/packages
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/desktop-directories
2012-11-30 16:19:29 +04:00
# create directory for calibre environment module
# the install script assumes it's there.
2012-02-01 22:04:55 +04:00
mkdir -p %{buildroot}%{python_sitelib}
2012-11-30 16:19:29 +04:00
2012-02-01 22:04:55 +04:00
XDG_DATA_DIRS="%{buildroot}%{_datadir}" \
XDG_UTILS_INSTALL_MODE="system" \
LIBPATH="%{_libdir}" \
python setup.py install --root=%{buildroot}%{_prefix} \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
2012-11-30 16:19:29 +04:00
--staging-libdir=%{buildroot}%{_libdir} \
# remove shebang from init_calibre.py here because
# it just got spawned by the install script
2012-12-04 04:13:37 +04:00
sed -i -e '/^#!\//, 1d' %{buildroot}%{python_sitelib}/init_calibre.py
2012-11-30 16:19:29 +04:00
2012-02-01 22:04:55 +04:00
# icons
mkdir -p %{buildroot}%{_datadir}/pixmaps/
2012-11-30 16:19:29 +04:00
cp -p resources/images/library.png \
%{buildroot}%{_datadir}/pixmaps/%{name}-gui.png
cp -p resources/images/viewer.png \
%{buildroot}%{_datadir}/pixmaps/calibre-viewer.png
2012-02-01 22:04:55 +04:00
# every file is empty here
find %{buildroot}%{_datadir}/mime -maxdepth 1 -type f|xargs rm -f
2012-02-02 00:20:04 +04:00
# the portable batch (>=0.8.5) is not needed
rm -f %{buildroot}%{_bindir}/calibre-portable.bat
2012-02-01 22:04:55 +04:00
# packages aren't allowed to register mimetypes like this
2012-11-30 16:19:29 +04:00
rm -f %{buildroot}%{_datadir}/applications/defaults.list
rm -f %{buildroot}%{_datadir}/applications/mimeinfo.cache
rm -f %{buildroot}%{_datadir}/mime/application/*.xml
rm -f %{buildroot}%{_datadir}/mime/text/*.xml
2012-02-01 22:04:55 +04:00
desktop-file-validate \
%{buildroot}%{_datadir}/applications/calibre-ebook-viewer.desktop
desktop-file-validate \
%{buildroot}%{_datadir}/applications/calibre-gui.desktop
desktop-file-validate \
%{buildroot}%{_datadir}/applications/calibre-lrfviewer.desktop
# mimetype icon for lrf
rm -rf %{buildroot}%{_datadir}/icons/hicolor/128x128
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
cp -p resources/images/mimetypes/lrf.png \
2012-11-30 16:19:29 +04:00
%{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/application-x-sony-bbeb.png
2012-02-01 22:04:55 +04:00
cp -p resources/images/viewer.png \
2012-11-30 16:19:29 +04:00
%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/calibre-viewer.png
2012-02-01 22:04:55 +04:00
# don't put bash completions in /usr/etc
2012-11-30 16:19:29 +04:00
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
mv %{buildroot}%{_prefix}%{_sysconfdir}/bash_completion.d/%{name} %{buildroot}%{_sysconfdir}/bash_completion.d
rmdir %{buildroot}%{_prefix}%{_sysconfdir}/bash_completion.d
2012-02-01 22:04:55 +04:00
# these are provided as separate packages
rm -rf %{buildroot}%{_libdir}/%{name}/{odf,cherrypy,pyPdf,encutils,cssutils}
rm -rf %{buildroot}%{_libdir}/%{name}/cal/utils/genshi
rm -rf %{buildroot}%{_libdir}/%{name}/cal/trac
# link to system fonts after we have deleted the non-free ones
2012-11-30 16:19:29 +04:00
# http://oldbugs.calibre-ebook.com/ticket/3832
mkdir -p %{buildroot}%{_datadir}/%{name}/fonts/prs500
2012-02-01 22:04:55 +04:00
ln -s %{_datadir}/fonts/TTF/liberation/LiberationSans-Regular.ttf \
2012-11-30 16:19:29 +04:00
%{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0003m_.ttf
2012-02-01 22:04:55 +04:00
ln -s %{_datadir}/fonts/TTF/liberation/LiberationSerif-Regular.ttf \
2012-11-30 16:19:29 +04:00
%{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0011m_.ttf
2012-02-01 22:04:55 +04:00
ln -s %{_datadir}/fonts/TTF/liberation/LiberationMono-Regular.ttf \
2012-11-30 16:19:29 +04:00
%{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0419m_.ttf
2012-02-01 22:04:55 +04:00
2012-02-02 00:20:04 +04:00
# localization has changed since calibre-0.8.5
# locale.zip is treated internally at runtime
# so the traditional locale fixes are moot.
# locales should still be looked for in the proper place
# but under the new localization zip-based schema
2012-12-04 04:13:37 +04:00
sed -i -e 's:localization/locale.zip:%{_datadir}/%{name}/localization/locales.zip:' %{buildroot}%{_libdir}/%{name}/%{name}/utils/localization.py
2012-02-01 22:04:55 +04:00
2012-11-30 16:19:29 +04:00
#% find_lang %{name} --with-kde --all-name
2012-02-01 22:04:55 +04:00
rm -f %{buildroot}%{_bindir}/%{name}-uninstall
2012-02-01 22:04:55 +04:00
install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/
# script-without-shebang
find %{buildroot}%{_libdir}/%{name}/chardet -name '*.py' -exec sed -i -e '1i#!/usr/bin/python' {} \;
# non-executable-script
chmod a+x %{buildroot}%{_libdir}/%{name}/qtcurve/test_rendering.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/ebooks/djvu/djvubzzdec.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/utils/fonts/sfnt/cff/table.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/ebooks/djvu/djvu.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/ebooks/oeb/display/test-cfi/run.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/devices/mtp/unix/upstream/update.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/utils/fonts/sfnt/cff/__init__.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/utils/fonts/sfnt/cff/dict_data.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/utils/fonts/sfnt/cff/constants.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/ebooks/markdown/extensions/meta.py
chmod a+x %{buildroot}%{_libdir}/%{name}/calibre/utils/fonts/sfnt/cff/writer.py
chmod a+x %{buildroot}%{_datadir}/%{name}/catalog/section_list_templates.py
chmod a+x %{buildroot}%{_datadir}/%{name}/calibre-portable.sh
# rpath fix
chrpath -d %{buildroot}%{_libdir}/%{name}/calibre/plugins/pictureflow.so
chrpath -d %{buildroot}%{_libdir}/%{name}/calibre/plugins/progress_indicator.so
chrpath -d %{buildroot}%{_libdir}/%{name}/calibre/plugins/qt_hack.so