File fbreader.spec of Package fbreader

#
# spec file for package fbreader
#
# Copyright (c) 2012 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/
#


Name:           fbreader
Version:        0.12.10
Release:        0
Summary:        E-book reader
License:        GPL-2.0+
Group:          Productivity/Other
Url:            http://www.fbreader.org/
Source0:        fbreader-%{version}.tar.bz2
Source1:        FBReader.desktop
Source2:        README.SuSE
Source3:        fbreader.xml
# PATCH-FIX-UPSTREAM fbreader-0.12.10-c++.patch http://www.fbreader.org/mantis/view.php?id=283 -- fix build with gcc 4.5
Patch0:         fbreader-0.12.10-c++.patch
Requires:       zlibrary = %{version}
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
BuildRequires:  enca-devel
BuildRequires:  expat
BuildRequires:  fdupes
BuildRequires:  fribidi-devel
BuildRequires:  gcc-c++
BuildRequires:  libbz2-devel
BuildRequires:  libcurl-devel
BuildRequires:  libexpat-devel
BuildRequires:  liblinebreak-devel
BuildRequires:  libqt4-devel
BuildRequires:  sqlite3-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
FBReader is an e-book reader for various platforms.
Main features:
    * Supported formats are
          o fb2 e-book format (style attributes are not supported yet).
          o HTML format (tables are not supported).
          o CHM format (tables are not supported).
          o plucker format (tables are not supported).
          o Palmdoc (aportis doc).
          o zTxt (Weasel format).
          o TCR (psion text) format.
          o RTF format (stylesheets and tables are not supported).
          o OEB format (css and tables are not supported).
          o OpenReader format (css and tables are not supported).
          o Non-DRM'ed mobipocket format (tables are not supported).
          o Plain text format.
    * Direct reading from tar, zip, gzip and bzip2 archives.
      (Multiple books in one archive are supported.)
    * Automatic library building.
    * Automatic encoding detection is supported.
    * Automatically generated contents table.
    * Embedded images support.
    * Footnotes/hyperlinks support.
    * Position indicator.
    * Keeps the last open book and the last read positions for all opened
      books between runs.
    * List of last opened books.
    * Automatic hyphenations. Liang's algorithm is used. The same algorithm is
      used in TeX, and TeX hyphenation patterns are used in FBReader. Patterns
      for Czech, English, Esperanto, French, German and Russian are included
      in the current version.
    * Text search.
    * Full-screen mode.
    * Screen rotation by 90, 180 and 270 degrees.

%package -n     zlibrary
Summary:        Cross-platform GUI library
Group:          Development/Libraries/C and C++
Requires:       zlibrary-ui = %{version}

%description -n zlibrary
ZLibrary is a cross-platform library to build applications running on
desktop Linux, Windows, and different Linux-based PDAs.

%package -n     zlibrary-devel
Summary:        Development files for zlibrary
Group:          Development/Libraries/C and C++
Requires:       zlibrary = %{version}

%description -n zlibrary-devel
This package contains the libraries amd header files that are needed
for writing applications with Zlibrary.

%package -n     zlibrary-ui-gtk
Summary:        GTK+ interface module for ZLibrary
Group:          Development/Libraries/C and C++
Provides:       zlibrary-ui = %{version}

%description -n zlibrary-ui-gtk
This package provides a GTK+-based UI for ZLibrary.

%package -n     zlibrary-ui-qt
Summary:        Qt4 interface module for ZLibrary
Group:          Development/Libraries/C and C++
Provides:       zlibrary-ui = %{version}

%description -n zlibrary-ui-qt
This package provides a Qt4-based UI for ZLibrary.

%prep
%setup -q
%patch0
cp %{SOURCE2} .

%build
sed -i 's/moc-qt4/moc/' makefiles/arch/desktop.mk
make %{?_smp_mflags} -C zlibrary/core TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=dummy
make %{?_smp_mflags} -C zlibrary/text TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=dummy
make %{?_smp_mflags} -C zlibrary/ui TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=gtk
make %{?_smp_mflags} -C zlibrary/ui TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=qt4
make %{?_smp_mflags} -C fbreader TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=dummy

%install
make -C zlibrary/core do_install do_install_dev DESTDIR=%{buildroot} TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=dummy
make -C zlibrary/text do_install do_install_dev DESTDIR=%{buildroot} TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=dummy
make -C zlibrary/ui do_install DESTDIR=%{buildroot} TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=gtk
make -C zlibrary/ui do_install DESTDIR=%{buildroot} TARGET_ARCH=desktop LIBDIR=%{_libdir} UI_TYPE=qt4
make -C fbreader do_install DESTDIR=%{buildroot} TARGET_ARCH=desktop UI_TYPE=dummy
touch %{buildroot}%{_libdir}/zlibrary/ui/zlui-active.so

# desktop file
mkdir -p %{buildroot}%{_datadir}/applications/
install -m644 %{SOURCE1} %{buildroot}%{_datadir}/applications/FBReader.desktop
%suse_update_desktop_file -i -n FBReader Office Viewer Literature

# mime type
mkdir -p %{buildroot}%{_datadir}/mime/packages/
install -m644 %{SOURCE3} %{buildroot}%{_datadir}/mime/packages/fbreader.xml

# man page
mkdir -p %{buildroot}%{_mandir}/man1
install -m644 fbreader/desktop/FBReader.1 %{buildroot}%{_mandir}/man1

%fdupes -s %{buildroot}

%post
%if 0%{?suse_version} > 1130
%desktop_database_post
%endif

%postun
%if 0%{?suse_version} > 1130
%desktop_database_postun
%endif

%post -n zlibrary -p /sbin/ldconfig

%postun -n zlibrary -p /sbin/ldconfig

%post -n zlibrary-ui-gtk
%{_sbindir}/update-alternatives --install \
    %{_libdir}/zlibrary/ui/zlui-active.so \
    zlibrary-ui \
    %{_libdir}/zlibrary/ui/zlui-gtk.so \
    2

%post -n zlibrary-ui-qt
%{_sbindir}/update-alternatives --install \
    %{_libdir}/zlibrary/ui/zlui-active.so \
    zlibrary-ui \
    %{_libdir}/zlibrary/ui/zlui-qt4.so \
    1

%preun -n zlibrary-ui-gtk
if [ "$1" = 0 ] ; then
    %{_sbindir}/update-alternatives --remove \
        zlibrary-ui \
        %{_libdir}/zlibrary/ui/zlui-gtk.so
fi

%preun -n zlibrary-ui-qt
if [ "$1" = 0 ] ; then
    %{_sbindir}/update-alternatives --remove \
        zlibrary-ui \
        %{_libdir}/zlibrary/ui/zlui-qt4.so
fi

%files
%defattr(-,root,root,-)
%doc fbreader/LICENSE README.SuSE
%{_bindir}/FBReader
%{_datadir}/FBReader
%{_datadir}/applications/FBReader.desktop
%{_datadir}/mime/packages/fbreader.xml
%{_datadir}/pixmaps/FBReader
%{_datadir}/pixmaps/FBReader.png
%{_mandir}/man1/FBReader.1.gz

%files -n zlibrary
%defattr(-,root,root,-)
%doc fbreader/LICENSE
%{_libdir}/lib*.so.*
%dir %{_libdir}/zlibrary
%dir %{_libdir}/zlibrary/ui
%exclude %{_datadir}/zlibrary/keynames-*.xml
%{_datadir}/zlibrary

%files -n zlibrary-devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/lib*.so

%files -n zlibrary-ui-gtk
%defattr(-,root,root,-)
%dir %{_libdir}/zlibrary
%dir %{_libdir}/zlibrary/ui
%ghost %{_libdir}/zlibrary/ui/zlui-active.so
%{_libdir}/zlibrary/ui/zlui-gtk.so
%{_datadir}/zlibrary/keynames-gtk.xml

%files -n zlibrary-ui-qt
%defattr(-,root,root,-)
%dir %{_libdir}/zlibrary
%dir %{_libdir}/zlibrary/ui
%ghost %{_libdir}/zlibrary/ui/zlui-active.so
%{_libdir}/zlibrary/ui/zlui-qt4.so
%{_datadir}/zlibrary/keynames-qt4.xml

%changelog
openSUSE Build Service is sponsored by