File calibre.spec of Package calibre

#
# spec file for package calibre
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Summary:        EBook Management Application

Name:           calibre
Version:        0.7.45
Release:        1.<RELEASE2>
Url:            http://calibre-ebook.com
Group:          Productivity/Other
License:        GPL3
Source0:        %{name}-%{version}-nofonts.tar.bz2
Source2:        %{name}.desktop
Source3:        %{name}.png
Source4:        generate-tarball.sh
#              saigkill@opensuse.org 09/5/10 --fixes LC_MESSAGES stuff
#              see http://bugs.calibre-ebook.com/ticket/3770
Patch0:         %{name}-l18n.diff
#              saigkill@opensuse.org 09/5/10 --fixes man issues
#              see http://bugs.calibre-ebook.com/ticket/3770
Patch1:         %{name}-no-update-manpage.diff
#              saigkill@opensuse.org 09/5/10 --adjust installion
Patch2:         %{name}-setup.install.py.diff
#              make calibre work with python-cssutils 0.9.8
Patch3:         %{name}-cssutils.diff

#
# A note on BuildRequires and Requires:
#
# Requires should always be a subset of BuildRequires. If there are packages
# that are only Required
# * there is no way to check whether these packages are available in the given
#   repositories unless you install the package (the build environment only
#   contains packages from the given repositories and the project
# * the project's repository might become inconsistent, because Required
#   packages do not block a build. So a package might get published, although
#   a Required package does not build

BuildRequires:  chmlib-devel >= 0.40
BuildRequires:  fdupes
BuildRequires:  help2man
BuildRequires:  ImageMagick-devel >= 6.5.9
BuildRequires:  liberation-fonts
BuildRequires:  libicu-devel >= 4.4.0
BuildRequires:  libpodofo-devel
BuildRequires:  libpoppler-qt4-devel >= 0.12.0
BuildRequires:  libqt4-devel >= 4.6.0
BuildRequires:  libwmf-devel >= 0.2.8
BuildRequires:  podofo >= 0.8.2
BuildRequires:  poppler >= 0.12.0
BuildRequires:  python-beautifulsoup >= 3.0.5
BuildRequires:  python-cherrypy
BuildRequires:  python-cssutils >= 0.9.7a3
BuildRequires:  python-dateutil >= 1.4.1
BuildRequires:  python-devel
BuildRequires:  python-dnspython >= 1.6.0
# python-genshi is a required package, see above
BuildRequires:  python-genshi
BuildRequires:  python-imaging >= 1.1.6
BuildRequires:  python-lxml >= 2.2.1
BuildRequires:  python-mechanize >= 0.1.11
BuildRequires:  python-odfpy
BuildRequires:  python-pypdf
BuildRequires:  python-qt4-devel >= 4.7.0
BuildRequires:  python-setuptools
BuildRequires:  python-sip-devel >= 4.12
BuildRequires:  sqlite3-devel
BuildRequires:  update-desktop-files
BuildRequires:  xdg-utils >= 1.0.2

Requires:       chmlib >= 0.40
Requires:       dbus-1-python
Requires:       hal
Requires:       ImageMagick >= 6.5.9
Requires:       libicu >= 4.4
Requires:       liberation-fonts
Requires:       libwmf >= 0.2.8
Requires:       poppler-qt4 >= 0.12.0
Requires:       libqt4 >= 4.6.0
Requires:       podofo >= 0.8.2
Requires:       python-beautifulsoup >= 3.0.5
Requires:       python-cherrypy
Requires:       python-cssutils >= 0.9.7a3
Requires:       python-dateutil >= 1.4.1
Requires:       python-dnspython >= 1.6.0
Requires:       python-imaging >= 1.1.6
Requires:       python-lxml >= 2.2.1
Requires:       python-mechanize >= 0.1.11
Requires:       python-odfpy
Requires:       python-pypdf
Requires:       python-qt4 >= 4.7.0
Requires:       python-setuptools
Requires:       python-sip >= 4.12.1
Requires:       python-genshi
Requires:       sqlite3
Requires:       xdg-utils >= 1.0.2

%{py_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# http://lists.opensuse.org/opensuse-packaging/2009-08/msg00110.html

%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 a few
ebook reader devices. It can go out to the internet and fetch
metadata for your books. It can download newspapers and convert them
into ebooks for convenient reading. It is cross platform, running on
Linux, Windows and OS X.


Author
------
   Kovid Goyal <kovid@kovidgoyal.net>

%prep
%setup -q -n %{name}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3

# dos2unix newline conversion
%{__sed} -i 's/\r//' src/calibre/web/feeds/recipes/*

# remove the executable flag from files
find src/calibre -name "*.py" -type f  | xargs %{__chmod} -x
%{__chmod} -x resources/recipes/*

%{__cp} -v %{S:2} %{S:3}  .

%build
#export CFLAGS="$CFLAGS $RPM_OPT_FLAGS"
#OVERRIDE_CFLAGS="% { optflags } -fno-strict-aliasing"
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%{__python} setup.py build

%install
rm -rf %{buildroot}  
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/ \
             $RPM_BUILD_ROOT/usr/share/qt4/translations/

%{__python} setup.py install \
   --prefix=%{_prefix} \
   --root=$RPM_BUILD_ROOT \
   --staging-bindir=$RPM_BUILD_ROOT%{_bindir} \
   --staging-libdir=$RPM_BUILD_ROOT%{_libdir} \
   --staging-sharedir=$RPM_BUILD_ROOT%{_datadir} \
   --staging-mandir=$RPM_BUILD_ROOT%{_mandir} \
   --libdir=%{_libdir}

%suse_update_desktop_file -i -n calibre Office Viewer

%find_lang %{name}
%find_lang iso639

%fdupes $RPM_BUILD_ROOT%{_libdir}/%{name}/
%fdupes $RPM_BUILD_ROOT%{_datadir}/%{name}/

# packages aren't allowed to register mimetypes like this
rm -f %{buildroot}%{_datadir}/applications/defaults.list

# 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

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT

%files -f %{name}.lang  -f iso639.lang
%defattr(-,root,root)
%config %{_sysconfdir}/bash_completion.d/%{name}
%{_bindir}/*
%exclude %{_bindir}/calibre-uninstall
%{_libdir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/%{name}/
# # these languages are not supported
%if 0%{?suse_version} <= 1130
%exclude %{_datadir}/locale/ast/LC_MESSAGES/*
%endif
%exclude %{_datadir}/locale/sc/LC_MESSAGES/*
%{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by