%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: calibre Version: 0.7.15 Release: 1%{?dist} Summary: E-book converter and library management Group: Applications/Multimedia License: GPLv3 URL: http://calibre-ebook.com/ # SourceURL: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz # Upstream packages some unfree fonts which we cannot redistribute. # While we're at it, also delete the liberation fonts which we already have. # # Download the upstream tarball and invoke this script while in the tarball's # directory: # ./generate-tarball.sh %{version} Source0: %{name}-%{version}-nofonts.tar.xz Source1: generate-tarball.sh Patch0: %{name}-manpages.patch Patch1: %{name}-no-update.patch Patch2: %{name}-0.6.53-mounthelper.patch Patch3: %{name}-0.6.47-python-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: python >= 2.6 BuildRequires: python-devel >= 2.6 BuildRequires: ImageMagick-devel >= 6.5.9 BuildRequires: python-setuptools BuildRequires: qt4-devel >= 4.6.0 BuildRequires: PyQt4-devel >= 4.7.0 BuildRequires: poppler-qt4-devel >= 0.12 BuildRequires: podofo-devel BuildRequires: desktop-file-utils BuildRequires: python-mechanize >= 0.1.1 BuildRequires: python-lxml >= 2.2.1 BuildRequires: python-cssutils >= 0.9.6 BuildRequires: python-dateutil >= 1.4.1 BuildRequires: python-imaging >= 1.1.6 BuildRequires: xdg-utils >= 1.0.2 BuildRequires: python-BeautifulSoup >= 3.0.5 BuildRequires: xz BuildRequires: unzip BuildRequires: libwmf-devel >= 0.2.8 BuildRequires: chmlib-devel >= 0.40 Requires: PyQt4 Requires: pyPdf Requires: python-cherrypy Requires: python-cssutils Requires: ImageMagick Requires: python-odf Requires: python-django-tagging Requires: python-lxml Requires: python-imaging Requires: python-mechanize Requires: python-dateutil Requires: python-genshi Requires: python-BeautifulSoup ## vine Requires: TrueType-liberation %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. Supported input formats are: MOBI, LIT, PRC, EPUB, CHM, ODT, HTML, CBR, CBZ, RTF, TXT, PDF and LRS. %prep %setup -q -n %{name} # # remove redundant / non-free fonts # %__rm -rf resources/fonts/* # don't append calibre1 to the name of the manpages. No need to compress either # upstream won't fix: http://bugs.calibre-ebook.com/ticket/3770#comment:7 %patch0 -p1 -b .manpages # don't check for new upstream version (that's what packagers do) %patch1 -p1 -b .no-update # Enable mount helper %patch2 -p1 -b .mounthelper #% patch3 -p1 -b .python-fix # dos2unix newline conversion %{__sed} -i 's/\r//' src/calibre/web/feeds/recipes/* # remove shebangs %{__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' resources/recipes/* %{__sed} -i -e '/^#!\//, 1d' resources/default_tweaks.py %{__chmod} -x src/calibre/*/*/*/*.py %{__chmod} -x src/calibre/*/*/*.py %{__chmod} -x src/calibre/*/*.py %{__chmod} -x src/calibre/*.py %{__chmod} -x resources/recipes/* %build OVERRIDE_CFLAGS="%{optflags}" QMAKE=%{_libdir}/qt4/bin/qmake python setup.py build %install %__rm -rf %{buildroot} %__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 # create directory for calibre environment module # the install script assumes it's there. %__mkdir_p %{buildroot}%{python_sitelib} XDG_DATA_DIRS="%{buildroot}%{_datadir}" \ XDG_UTILS_INSTALL_MODE="system" \ LIBPATH="%{_libdir}" \ python setup.py install --root=%{buildroot}%{_prefix} \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --staging-libdir=%{buildroot}%{_libdir} # remove shebang from init_calibre.py here because # it just got spawned by the install script %{__sed} -i -e '/^#!\//, 1d' %{buildroot}%{python_sitelib}/init_calibre.py # icons %__mkdir_p %{buildroot}%{_datadir}/pixmaps/ %__cp -p resources/images/library.png \ %{buildroot}%{_datadir}/pixmaps/%{name}-gui.png %__cp -p resources/images/viewer.svg \ %{buildroot}%{_datadir}/pixmaps/calibre-viewer.svg # every file is empty here find %{buildroot}%{_datadir}/mime -maxdepth 1 -type f|xargs %__rm -f # packages aren't allowed to register mimetypes like this %__rm -f %{buildroot}%{_datadir}/applications/{defaults.list,mimeinfo.cache} 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 %__mv %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes \ %{buildroot}%{_datadir}/mime/packages/calibre-mimetypes.xml # 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.svg \ %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/application-x-sony-bbeb.svg %__cp -p resources/images/viewer.svg \ %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/calibre-viewer.svg # don't put bash completions in /usr/etc %__mv %{buildroot}%{_prefix}%{_sysconfdir} %{buildroot} # 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 (see Source0) the non-free ones # http://bugs.calibre-ebook.com/ticket/3832 %__mkdir_p %{buildroot}%{_datadir}/%{name}/fonts/prs500/ %__ln_s %{_datadir}/fonts/TrueType-liberation/LiberationSans-Regular.ttf \ %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0003m_.ttf %__ln_s %{_datadir}/fonts/TrueType-liberation/LiberationSerif-Regular.ttf \ %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0011m_.ttf %__ln_s %{_datadir}/fonts/TrueType-liberation/LiberationMono-Regular.ttf \ %{buildroot}%{_datadir}/%{name}/fonts/prs500/tt0419m_.ttf # http://bugs.calibre-ebook.com/ticket/3770#comment:7 # man pages %__mv %{buildroot}%{_datadir}/%{name}/man %{buildroot}%{_mandir} # move locales %__mv %{buildroot}%{_datadir}/%{name}/localization/locales \ %{buildroot}%{_datadir}/locale for file in %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/messages.mo; do lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:') %__mv %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/messages.mo \ %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/%{name}.mo done; for file in %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/iso639.mo; do lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:') %__mv %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/iso639.mo \ %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_iso639.mo done; for file in %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/qt.qm; do lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:') %__mv $file %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_$lang.qm done; %find_lang %{name} --with-qt --all-name # locales should be looked for in the proper place %{__sed} -i -e "s:P('localization/locales:('/usr/share/locale:" \ -e "s/messages.mo/calibre.mo/" \ -e "s/iso639.mo/calibre_iso639.mo/" \ %{buildroot}%{_libdir}/%{name}/%{name}/utils/localization.py %{__rm} -f %{buildroot}%{_bindir}/%{name}-uninstall %clean %{__rm} -rf %{buildroot} %post update-desktop-database &> /dev/null ||: update-mime-database %{_datadir}/mime &> /dev/null || : touch --no-create %{_datadir}/icons/hicolor || : if [ -x %{_bindir}/gtk-update-icon-cache ] ; then %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : fi %postun update-desktop-database &> /dev/null ||: update-mime-database %{_datadir}/mime &> /dev/null || : touch --no-create %{_datadir}/icons/hicolor || : if [ -x %{_bindir}/gtk-update-icon-cache ] ; then %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : fi %files -f %{name}.lang %defattr(-,root,root,-) %doc COPYRIGHT LICENSE Changelog.yaml %{_bindir}/* %config(noreplace) %{_sysconfdir}/bash_completion.d/ %{_libdir}/%{name} %{_datadir}/%{name} %{_datadir}/pixmaps/* %{_datadir}/applications/* %{_datadir}/mime/packages/* %{_datadir}/icons/hicolor/scalable/mimetypes/* %{_datadir}/icons/hicolor/scalable/apps/* %{python_sitelib}/init_calibre.py* %{_mandir}/man1/* %changelog * Mon Aug 23 2010 Munehiro Yamamoto 0.7.15-1 - initial build based on Fedora development * Sun Aug 08 2010 Ahmad Samir 0.7.13-1mdv2010.1 + Revision: 567781 - update to 0.7.13 * Fri Aug 06 2010 Ahmad Samir 0.7.12-1mdv2011.0 + Revision: 567146 - update to 0.7.12 * Thu Aug 05 2010 Funda Wang 0.7.10-3mdv2011.0 + Revision: 566253 - rebuild for new poppler * Fri Jul 30 2010 Ahmad Samir 0.7.10-2mdv2011.0 + Revision: 563265 - update manpage and no-update patches (from Fedora) - drop SOURCE1 and python-cssutils hack, it's not needed anymore as python-cssutils has been updated to 0.9.7b3 - build with optflags - delete mimeinfo.cache too + Juan Luis Baptiste - Updated to 0.7.10, redo diff calibre-no-update.patch. * Sat Jul 10 2010 Funda Wang 0.6.54-2mdv2011.0 + Revision: 549995 - rebuild for new imagemagick + Tomas Kindl - various minor SPEC fixes and clean-ups + Juan Luis Baptiste - Updated to 0.6.54. * Tue Apr 20 2010 Tomas Kindl 0.6.48-1mdv2010.1 + Revision: 537127 - update to 0.6.48 - fix python-odf and python-django-tagging dependency' * Tue Apr 20 2010 Tomas Kindl 0.6.47-3mdv2010.1 + Revision: 536983 - fix incorrect odf-py require & bump release - fix incorrect odf-py require * Mon Apr 19 2010 Tomas Kindl 0.6.47-2mdv2010.1 + Revision: 536555 - enable PoDoFo dependency as we have PoDoFo in MDV now * Sun Apr 18 2010 Tomas Kindl 0.6.47-1mdv2010.1 + Revision: 536529 - initial import containing all pertinent fixes to ensure it will build on Mandriva... - create calibre