File qupzilla-qt5.spec of Package qupzilla

#
# spec file for package qupzilla-qt5
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2015 Mariusz Fik <fisiu@opensuse.org>
#
# 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/
#


%bcond_without qt5
Name:           qupzilla-qt5
Version:        1.8.7
Release:        0
Summary:        A very fast open source browser based on WebKit core
License:        GPL-3.0+
Group:          Productivity/Networking/Web/Browsers
Url:            http://qupzilla.com/
Source0:        https://github.com/QupZilla/qupzilla/releases/download/v%{version}/QupZilla-%{version}.tar.xz
# Search engine favicons
Source1:        obs.png
Source2:        opensusesoftware.png
# DB shipping openSUSE project bookmark icon
Source3:        browsedata.db
# PATCH-FEATURE-OPENSUSE qupzilla-defaults.patch
Patch0:         qupzilla-defaults.patch
BuildRequires:  fdupes
%if %{with qt5}
%if 0%{?suse_version} > 1310
BuildRequires:  kwallet-devel
BuildRequires:  libQt5Gui-private-headers-devel
%else
BuildRequires:  libqt5-qtbase-private-headers-devel
%endif
BuildRequires:  libqt5-qttools-devel
%else
BuildRequires:  libkde4-devel
%endif
BuildRequires:  pkgconfig(gnome-keyring-1)
BuildRequires:  pkgconfig(hunspell)
%if %{with qt5}
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5Script)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5WebKitWidgets)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
%else
BuildRequires:  pkgconfig(QtCore) >= 4.7
BuildRequires:  pkgconfig(QtGui) >= 4.7
BuildRequires:  pkgconfig(QtNetwork) >= 4.7
BuildRequires:  pkgconfig(QtWebKit)
%endif
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(openssl)
%if %{with qt5}
Conflicts:      qupzilla
%endif

%description
QupZilla is modern web browser based on WebKit core and Qt Framework.
WebKit guarante fast browsing and Qt availability on all major platforms.

%if 0%{?suse_version} > 1310 || !0%{with qt5}
%package kwallet
Summary:        Kwallet plugin for qupzilla
Group:          Productivity/Networking/Web/Browsers
Requires:       %{name} = %{version}
%if %{with qt5}
Requires:       kwalletd5
Supplements:    packageand(%{name};plasma5-workspace)
%else
Requires:       kdebase4-runtime
Supplements:    packageand(%{name};kdebase4-workspace)
%endif
%if %{with qt5}
Conflicts:      qupzilla-kwallet
%endif

%description kwallet
Kwallet plugin for QupZilla browser which allows to store passwords in kwallet.

%package gnome-keyring
Summary:        Gnome keyring plugin for qupzilla
Group:          Productivity/Networking/Web/Browsers
Requires:       %{name} = %{version}
%if %{with qt5}
Conflicts:      qupzilla-gnome-keyring
%endif

%description gnome-keyring
Gnome keyring plugin for QupZilla browser which allows to store passwords in 
gnome keyring.
%endif

%prep
%setup -q -n QupZilla-%{version}
# Remove BUILDTIME usage from build.
sed -i '/BUILDTIME;^/d' src/lib/app/qzcommon.h
sed -i '/BUILDTIME = /d' src/lib/app/qzcommon.cpp
sed -i '/Qz::BUILDTIME/d' src/lib/other/aboutdialog.cpp
sed -i '/Qz::BUILDTIME/d' src/lib/app/commandlineoptions.cpp
sed -i '/Qz::BUILDTIME/d' src/lib/app/qzcommon.cpp
sed -i '/Qz::BUILDTIME/d' src/lib/network/schemehandlers/qupzillaschemehandler.cpp
%if %{with qt5}
# Adjust KWallet include for KF5 library
sed -i 's|<KDE/KWallet/Wallet>|<KWallet>|g' src/plugins/KWalletPasswords/kwalletpasswordbackend.h
%endif
# QupZilla defaults
%patch0 -p1
# openSUSE icons 
cp {%{SOURCE1},%{SOURCE2}} src/lib/data/icons/sites/
cp %{SOURCE3} src/lib/data/data/

%build
export USE_WEBGL=true
%if 0%{?suse_version} > 1310 || !0%{with qt5}
# Enable better KDE integration, it is also needed for KWallet plugin.
export KDE_INTEGRATION=true
# Enable GNOME Keyring support.
export GNOME_INTEGRATION=true
%endif
# Set proper LIBPATH.
export USE_LIBPATH=%{_libdir}
%if !0%{with qt5}
# Debug config is needed for -debuginfo and -debugsource packages.
%{_libdir}/qt4/bin/qmake \
  QMAKE_CFLAGS="%{optflags}"   \
  QMAKE_CXXFLAGS="%{optflags}" \
  CONFIG+=debug \
  CONFIG-=gdb_dwarf_index
%else
%qmake5 CONFIG-=gdb_dwarf_index
%endif
make %{?_smp_mflags}

%install
make INSTALL_ROOT=%{buildroot} install
# FIXME: split library into separate package and build also -devel with libqupzilla.so ???
rm -vf %{buildroot}%{_libdir}/libQupZilla.so
# We don't need a test plugin which does nothing.
rm -vf %{buildroot}%{_libdir}/qupzilla/libTestPlugin.so
# End
%suse_update_desktop_file qupzilla
%fdupes -s %{buildroot}%{_datadir}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYRIGHT FAQ GPLv3
%{_bindir}/qupzilla
%{_libdir}/libQupZilla.so.*
%dir %{_libdir}/qupzilla/
%{_libdir}/qupzilla/libAccessKeysNavigation.so
%{_libdir}/qupzilla/libAutoScroll.so
%{_libdir}/qupzilla/libMouseGestures.so
%{_libdir}/qupzilla/libGreaseMonkey.so
%{_libdir}/qupzilla/libFlashCookieManager.so
%{_libdir}/qupzilla/libPIM.so
%{_libdir}/qupzilla/libStatusBarIcons.so
%{_libdir}/qupzilla/libTabManager.so
%{_datadir}/appdata/
%{_datadir}/applications/qupzilla.desktop
%{_datadir}/pixmaps/qupzilla.png
%{_datadir}/icons/hicolor/
%{_datadir}/qupzilla/
%{_datadir}/bash-completion/

%if 0%{?suse_version} > 1310 || !0%{with qt5}
%files kwallet
%defattr(-,root,root)
%{_libdir}/qupzilla/libKWalletPasswords.so

%files gnome-keyring
%defattr(-,root,root)
%{_libdir}/qupzilla/libGnomeKeyringPasswords.so
%endif

%changelog
openSUSE Build Service is sponsored by