File qupzilla.spec of Package qupzilla

#
# spec file for package qupzilla
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 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/
#


Name:           qupzilla
Version:        2.0.1
Release:        0
Summary:        Cross-platform Qt web browser
License:        GPL-3.0+
Group:          Productivity/Networking/Web/Browsers
Url:            http://qupzilla.com/
Source:         https://github.com/QupZilla/%{name}/releases/download/v%{version}/QupZilla-%{version}.tar.xz
Source1:        %{name}.changes
# Search engine favicons.
Source2:        obs.png
Source3:        opensusesoftware.png
# DB shipping openSUSE project bookmark icon.
Source4:        browsedata.db
# PATCH-FEATURE-OPENSUSE qupzilla-defaults.patch
Patch0:         %{name}-defaults.patch
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  kwallet-devel
BuildRequires:  libQt5Gui-private-headers-devel >= 5.6
BuildRequires:  libqt5-qttools-devel >= 5.6
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(Qt5Concurrent) >= 5.6
BuildRequires:  pkgconfig(Qt5Core) >= 5.6
BuildRequires:  pkgconfig(Qt5DBus) >= 5.6
BuildRequires:  pkgconfig(Qt5Gui) >= 5.6
BuildRequires:  pkgconfig(Qt5Network) >= 5.6
BuildRequires:  pkgconfig(Qt5PrintSupport) >= 5.6
BuildRequires:  pkgconfig(Qt5Script) >= 5.6
BuildRequires:  pkgconfig(Qt5Sql) >= 5.6
BuildRequires:  pkgconfig(Qt5WebEngineCore) >= 5.6
BuildRequires:  pkgconfig(Qt5WebEngineWidgets) >= 5.6
BuildRequires:  pkgconfig(Qt5Widgets) >= 5.6
BuildRequires:  pkgconfig(Qt5X11Extras) >= 5.6
BuildRequires:  pkgconfig(gnome-keyring-1)
BuildRequires:  pkgconfig(hunspell)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(xcb-atom)
# qupzilla-qt5 was last seen in openSUSE Leap 42.1.
Provides:       %{name}-qt5 = %{version}
Obsoletes:      %{name}-qt5 < %{version}

%description
QupZilla is a modern web browser based on Qt Framework.

%package gnome-keyring
Summary:        GNOME keyring plugin for QupZilla
Group:          Productivity/Networking/Web/Browsers
Requires:       %{name} = %{version}
Supplements:    packageand(%{name}:gnome-keyring)
# qupzilla-qt5-gnome-keyring was last seen in openSUSE Leap 42.1.
Provides:       %{name}-qt5-gnome-keyring = %{version}
Obsoletes:      %{name}-qt5-gnome-keyring < %{version}

%description gnome-keyring
Plugin for QupZilla browser that allows to store passwords in
GNOME Keyring.

%package kwallet
Summary:        Kwallet plugin for QupZilla
Group:          Productivity/Networking/Web/Browsers
Requires:       %{name} = %{version}
Requires:       kwalletd5
Supplements:    packageand(%{name}:plasma5-workspace)
# qupzilla-qt5-kwallet was last seen in openSUSE Leap 42.1.
Provides:       %{name}-qt5-kwallet = %{version}
Obsoletes:      %{name}-qt5-kwallet < %{version}

%description kwallet
Plugin for QupZilla browser that allows to store passwords in
KWallet.

%prep
%setup -q -n QupZilla-%{version}
# Remove __DATE__ and __TIME__.
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find .  -type f -regex '.*\.\(h\|c\|cpp\)' | xargs sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g"

# QupZilla defaults.
%patch0 -p1
# openSUSE icons.
cp -f %{SOURCE2} %{SOURCE3} src/lib/data/icons/sites/
cp -f %{SOURCE4} src/lib/data/data/

%build
export USE_WEBGL=true
# Enable GNOME Keyring support.
export GNOME_INTEGRATION=true
# Enable better KDE integration, it is also needed for KWallet plugin.
export KDE_INTEGRATION=true
# Set proper LIBPATH.
export USE_LIBPATH=%{_libdir}
%qmake5 \
  CONFIG-=gdb_dwarf_index
make %{?_smp_mflags}

%install
%qmake5_install

# FIXME: Split library into a separate package and also create qupzilla-devel with libqupzilla.so ???
rm -vf %{buildroot}%{_libdir}/libQupZilla.so
# We don't need a test plugin that does nothing.
rm -vf %{buildroot}%{_libdir}/%{name}/libTestPlugin.so

%suse_update_desktop_file %{name}
%fdupes %{buildroot}%{_datadir}/

%post
%desktop_database_post
%icon_theme_cache_post
/sbin/ldconfig

%postun
%desktop_database_postun
%icon_theme_cache_postun
/sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS CHANGELOG COPYRIGHT FAQ GPLv3
%{_bindir}/%{name}
%{_libdir}/libQupZilla.so.*
%{_libdir}/%{name}/
%exclude %{_libdir}/%{name}/libKWalletPasswords.so
%exclude %{_libdir}/%{name}/libGnomeKeyringPasswords.so
%{_datadir}/%{name}/
%dir %{_datadir}/appdata/
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/bash-completion/

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

%files kwallet
%defattr(-,root,root)
%{_libdir}/%{name}/libKWalletPasswords.so

%changelog
openSUSE Build Service is sponsored by