#
-# TODO: - xdg stuff (put desktops and icons in proper place)
+# TODO: - rewrite generate-tarball.sh script to provide locales.zip handling (if needed)
+# - make separate server package with init-scripts, etc...
+# - -locales.patch needs love
#
# NOTE:
# Upstream packages some unfree fonts which we cannot redistribute,
Summary: E-book converter and library management
Summary(pl.UTF-8): Konwerter oraz biblioteka dla e-booków
Name: calibre
-Version: 0.8.1
-Release: 2
+Version: 0.9.4
+Release: 1
License: GPL v3+
Group: Applications/Multimedia
Source0: %{name}-%{version}-nofonts.tar.xz
-# Source0-md5: c956836f3648462b6d3f38c2e5d60d69
+# Source0-md5: 89e959c8ce0f432e56a5336470bac7e0
Source1: generate-tarball.sh
Source2: %{name}-mount-helper
Patch0: %{name}-prefix.patch
-Patch1: %{name}-manpages.patch
-Patch2: %{name}-no-update.patch
-Patch3: %{name}-env_module.patch
-Patch4: %{name}-locales.patch
-Patch5: shebang-python-fix.patch
+Patch1: %{name}-no-update.patch
+Patch2: %{name}-env_module.patch
+Patch3: %{name}-locales.patch
+Patch4: shebang-python-fix.patch
URL: http://www.calibre-ebook.com/
BuildRequires: ImageMagick-devel >= 6.6.4.7
-BuildRequires: chmlib-devel
+BuildRequires: QtGui-devel
+BuildRequires: QtSvg-devel
+BuildRequires: chmlib-devel >= 0.40
BuildRequires: libicu-devel
+BuildRequires: libmtp-devel >= 1.1.5
+BuildRequires: libwmf-devel >= 0.2.8
BuildRequires: pkgconfig
-BuildRequires: podofo-devel
-BuildRequires: poppler-Qt-devel
+BuildRequires: podofo-devel >= 0.8.2
+BuildRequires: poppler-Qt-devel >= 0.20.2
+BuildRequires: poppler-glib-devel >= 0.20.2
BuildRequires: python-BeautifulSoup
BuildRequires: python-PIL
BuildRequires: python-PyQt4-devel
-BuildRequires: python-cssutils >= 1:0.9.7
+BuildRequires: python-PyQt4-devel-tools
+BuildRequires: python-cssutils >= 1:0.9.9
BuildRequires: python-dateutil
BuildRequires: python-devel >= 1:2.7.1
BuildRequires: python-lxml
BuildRequires: sed >= 4.0
BuildRequires: sqlite3-devel
BuildRequires: tar >= 1:1.22
+BuildRequires: unzip
BuildRequires: xdg-utils
BuildRequires: xz >= 1:4.999.7
-Requires: ImageMagick-coder-jpeg
-Requires: ImageMagick-coder-png
-Requires: python-BeautifulSoup
-Requires: python-PIL
-Requires: python-cssutils
-Requires: python-dateutil
-Requires: python-lxml
-Requires: python-mechanize
+Requires: python-BeautifulSoup >= 3.0.5
+Requires: python-PIL >= 1.1.6
+Requires: python-PyQt4 >= 4.9.1
+Requires: python-cssselect >= 0.7.1
+Requires: python-cssutils >= 1:0.9.9
+Requires: python-dateutil >= 1.4.1
+Requires: python-dns >= 1.6.0
+Requires: python-genshi
+Requires: python-lxml >= 2.2.1
+Requires: python-mechanize >= 0.1.11
Requires: python-modules-sqlite
+Requires: python-netifaces >= 0.8
+Requires: python-psutil >= 0.6.1
+Suggests: ImageMagick-coder-jpeg
+Suggests: ImageMagick-coder-png
+### FIXME: libunrar.so is needed for rar-packed files
+Suggests: libunrar-devel
+Suggests: poppler-progs
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
%patch2 -p1
%patch3 -p1
%patch4 -p1
-%patch5 -p1
+
+# 64bit target build fix
+%{__sed} -i -e "s!'/usr/lib'!'%{_libdir}'!g" setup/build_environment.py
+
+# upstream decides to store locale files in a single zip file but we prefer separate .mo
+mkdir resources/localization/locales
+unzip resources/localization/locales.zip -d resources/localization/locales
+chmod 755 resources/localization/locales/*
+rm -f resources/localization/locales.zip
%build
+CC="%{__cc}" \
+CXX=%{__cxx} \
+OVERRIDE_CFLAGS="%{rpmcflags}" \
+OVERRIDE_LDFLAGS="%{rpmldflags}" \
%{__python} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
+# create directories for xdg-utils
+install -d $RPM_BUILD_ROOT%{_datadir}/{icons/hicolor,packages,mime/packages,desktop-directories} \
+ $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
+XDG_DATA_DIRS="$RPM_BUILD_ROOT%{_datadir}" \
+XDG_UTILS_INSTALL_MODE="system" \
+LIBPATH="%{_libdir}" \
%{__python} setup.py install \
--root=$RPM_BUILD_ROOT \
--libdir="%{_libdir}"
+cp -p resources/images/library.png $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}-gui.png
+cp -p resources/images/viewer.png $RPM_BUILD_ROOT%{_pixmapsdir}/calibre-viewer.png
+
%py_ocomp $RPM_BUILD_ROOT%{_libdir}/%{name}
%py_comp $RPM_BUILD_ROOT%{_libdir}/%{name}
%py_postclean %{_libdir}/%{name}
-# move manpages and locales to proper place
-mv $RPM_BUILD_ROOT%{_datadir}/%{name}/man $RPM_BUILD_ROOT%{_mandir}
-mv $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_datadir}/locale
+mv $RPM_BUILD_ROOT%{_datadir}/%{name}/localization/locales $RPM_BUILD_ROOT%{_localedir}
# set proper filenames for locales (TODO: switch to patch if possible)
-for file in $RPM_BUILD_ROOT%{_datadir}/locale/*/LC_MESSAGES/messages.mo; do
- lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
- mv $RPM_BUILD_ROOT%{_datadir}/locale/$lang/LC_MESSAGES/messages.mo \
- $RPM_BUILD_ROOT%{_datadir}/locale/$lang/LC_MESSAGES/%{name}.mo
+for file in $RPM_BUILD_ROOT%{_localedir}/*; do
+ lang=$(echo $file|%{__sed} 's:.*locale/\(.*\).*:\1:')
+ mkdir $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
+ mv $RPM_BUILD_ROOT%{_localedir}/$lang/*.mo \
+ $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES
done;
-for file in $RPM_BUILD_ROOT%{_datadir}/locale/*/LC_MESSAGES/iso639.mo; do
+for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/messages.mo; do
lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
- mv $RPM_BUILD_ROOT%{_datadir}/locale/$lang/LC_MESSAGES/iso639.mo \
- $RPM_BUILD_ROOT%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_iso639.mo
+ mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/messages.mo \
+ $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}.mo
done;
-for file in $RPM_BUILD_ROOT%{_datadir}/locale/*/LC_MESSAGES/qt.qm; do
+for file in $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/iso639.mo; do
lang=$(echo $file|%{__sed} 's:.*locale/\(.*\)/LC_MESSAGES.*:\1:')
- mv $file $RPM_BUILD_ROOT%{_datadir}/locale/$lang/LC_MESSAGES/%{name}.$lang.qm
+ mv $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/iso639.mo \
+ $RPM_BUILD_ROOT%{_localedir}/$lang/LC_MESSAGES/%{name}_iso639.mo
done;
%{__rm} $RPM_BUILD_ROOT%{_bindir}/%{name}-uninstall
# unsupported
-%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/locale/ltg
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ber
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/jv
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/ltg
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en_AU
install %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}
-%find_lang %{name} --all-name --with-qm
+%find_lang %{name} --all-name
%clean
rm -rf $RPM_BUILD_ROOT
+%post
+%update_desktop_database
+%update_mime_database
+%update_icon_cache hicolor
+
+%postun
+if [ $1 -eq 0 ] ; then
+ %update_desktop_database
+ %update_mime_database
+ %update_icon_cache hicolor
+fi
+
%files -f %{name}.lang
%defattr(644,root,root,755)
%doc Changelog.yaml COPYRIGHT README
%attr(755,root,root) %{_bindir}/ebook-viewer
%attr(755,root,root) %{_bindir}/epub-fix
%attr(755,root,root) %{_bindir}/fetch-ebook-metadata
-%attr(755,root,root) %{_bindir}/librarything
%attr(755,root,root) %{_bindir}/lrf2lrs
%attr(755,root,root) %{_bindir}/lrfviewer
%attr(755,root,root) %{_bindir}/lrs2lrf
%attr(755,root,root) %{_bindir}/markdown-calibre
-%attr(755,root,root) %{_bindir}/pdfmanipulate
%attr(755,root,root) %{_bindir}/web2disk
%{_datadir}/%{name}
%{_libdir}/%{name}
-%{_mandir}/man1/*.1*
+%{_desktopdir}/calibre-ebook-viewer.desktop
+%{_desktopdir}/calibre-gui.desktop
+%{_desktopdir}/calibre-lrfviewer.desktop
+%{_iconsdir}/hicolor/*/*/*.png
+%{_datadir}/mime/packages/calibre-mimetypes.xml
+%{_pixmapsdir}/%{name}-gui.png
+%{_pixmapsdir}/calibre-viewer.png
%files -n bash-completion-calibre
%defattr(644,root,root,755)