File coolreader3-qt.spec of Package coolreader3-qt

#
# spec file for package coolreader3-qt
#
# Copyright (c) 2014 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/
#


%define crengine  cr3

Name:           coolreader3-qt
Version:        3.1.2
Release:        0
License:        GPL-2.0+
Summary:        E-Book Viewer for Comfort Reading (Qt4 Based GUI)
Url:            http://coolreader.org/e-index.htm
Group:          Productivity/Other
Source0:        %{crengine}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM coolreader3-3.0.45-desktop.patch lazy.kent@opensuse.org -- correct desktop file
Patch0:         coolreader3-3.0.45-desktop.patch
# PATCH-FIX-UPSTREAM coolreader3-qt-3.0.56-save_settings.patch sf#3520822 -- fix save settings
Patch1:         coolreader3-qt-3.0.56-save_settings.patch
# PATCH-FIX-UPSTREAM coolreader3-3.1.2-use-recommended-freetype-include.patch lazy.kent@opensuse.org -- use freetype recommended include style
Patch2:         coolreader3-3.1.2-use-recommended-freetype-include.patch
BuildRequires:  ImageMagick
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  xz
BuildRequires:  pkgconfig(QtCore)
BuildRequires:  pkgconfig(QtGui)
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Conflicts:      coolreader3-wx

%description
Cool Reader is an e-book viewer. Understands a number of text document
formats. Fully customizable palette, text reformatting with any font
size, font antialiasing, extra smooth scrolling and a lot of other
features turn reading into a pleasure.

This is a version with Qt4 based GUI.

%lang_package

%prep
%setup -qn %{crengine}-%{version}
%patch0
%patch1 -p1
%patch2 -p1

%build
mkdir build
cd build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
cmake .. \
    -DGUI=QT \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DMAX_IMAGE_SCALE_MUL=2 \
    -DDOC_DATA_COMPRESSION_LEVEL=3 \
    -DDOC_BUFFER_SIZE=0x1400000
make %{?_smp_mflags} VERBOSE=1

%install
pushd build
%make_install
popd
rm -f \
    %{buildroot}%{_datadir}/{pixmaps/%{crengine}.{png,xpm},doc/%{crengine}/changelog.gz}
# Install icons of various sizes.
for size in 64x64 48x48 32x32 22x22 16x16 ; do
    install -dm 0755 \
        %{buildroot}%{_datadir}/icons/hicolor/${size}/apps/
    convert -strip -resize ${size} cr3gui/data/desktop/%{crengine}.png \
        %{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{crengine}.png
done
%fdupes -s %{buildroot}
%find_lang %{crengine} --with-qt
%suse_update_desktop_file %{crengine}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root,-)
%doc %{crengine}gui/{AUTHORS,COPYING} changelog
%{_bindir}/%{crengine}
%{_datadir}/%{crengine}/
%exclude %{_datadir}/%{crengine}/i18n
%{_datadir}/applications/%{crengine}.desktop
%{_datadir}/icons/hicolor/*/*/%{crengine}.*
%doc %{_mandir}/man?/*

%files lang -f %{crengine}.lang
%defattr(-,root,root,-)
# FIXME: Check cr3gui/data/manual/cr3-manual-uk.fb2. Don't install now.
# It is a copy of cr3-manual-ru.fb2 (at least in version 3.1.2)
%doc %{crengine}gui/data/manual/%{crengine}-manual-ru.fb2
%dir %{_datadir}/%{crengine}/i18n/

%changelog
openSUSE Build Service is sponsored by