File qbittorrent.spec of Package qbittorrent

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


%define _name   qBittorrent
Name:           qbittorrent
Version:        3.2.3
Release:        0
Summary:        A BitTorrent client in Qt
License:        GPL-2.0+
Group:          Productivity/Networking/File-Sharing
Url:            http://qbittorrent.org/
Source:         https://github.com/%{name}/%{_name}/archive/release-%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch1:         bittorrent_missing_ppc64le_in_ax_boost_base.m4.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  boost-devel >= 1.35
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(libtorrent-rasterbar) >= 1.0.6
# For geolocalization.
Requires:       GeoIP
# For search engines.
Requires:       python3
Recommends:     python
%if 0%{?suse_version} >= 1320 || (0%{?suse_version} == 1315 && 0%{?is_opensuse})
BuildRequires:  libqt5-linguist >= 5.2.0
BuildRequires:  pkgconfig(Qt5Core) >= 5.2.0
BuildRequires:  pkgconfig(Qt5DBus) >= 5.2.0
BuildRequires:  pkgconfig(Qt5Gui) >= 5.2.0
BuildRequires:  pkgconfig(Qt5Network) >= 5.2.0
BuildRequires:  pkgconfig(Qt5Widgets) >= 5.2.0
BuildRequires:  pkgconfig(Qt5Xml) >= 5.2.0
%else
BuildRequires:  libqt4-linguist >= 4.8.0
BuildRequires:  pkgconfig(QtCore) >= 4.8.0
BuildRequires:  pkgconfig(QtDBus) >= 4.8.0
BuildRequires:  pkgconfig(QtGui) >= 4.8.0
BuildRequires:  pkgconfig(QtNetwork) >= 4.8.0
BuildRequires:  pkgconfig(QtXml) >= 4.8.0
%endif

%description
qBittorrent is a bittorrent client programmed in C++ / Qt that
uses libtorrent-rasterbar.

It aims to be a good alternative to all other bittorrent clients
out there. qBittorrent is fast, stable and provides unicode support
as well as many features.

%package nox
Summary:        A BitTorrent client in Qt, CLI version
Group:          Productivity/Networking/File-Sharing

%description nox
qBittorrent is a bittorrent client programmed in C++ / Qt that
uses libtorrent-rasterbar, CLI version.

It aims to be a good alternative to all other bittorrent clients
out there. qBittorrent is fast, stable and provides unicode support
as well as many features.

%prep
%setup -q -n %{_name}-release-%{version}
%patch1 -p1

%build
aclocal -I m4
autoconf

%global _configure ../configure
for ui in nox gui; do
    [[ "$ui" == nox ]] && ui_opt='--disable-gui' || ui_opt=
    mkdir $ui
    pushd $ui
    %configure \
%if 0%{?suse_version} >= 1320 || (0%{?suse_version} == 1315 && 0%{?is_opensuse})
      --with-qt5        \
%endif
      $ui_opt           \
      --enable-systemd
    make %{?_smp_mflags}
    popd
done

%install
for ui in nox gui; do
    pushd $ui
    make INSTALL_ROOT=%{buildroot} install
    popd
done

mkdir -p %{buildroot}%{_sbindir}/
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-nox

%fdupes %{buildroot}%{_datadir}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%pre nox
%service_add_pre %{name}-nox.service

%post nox
%service_add_post %{name}-nox.service

%preun nox
%service_del_preun %{name}-nox.service

%postun nox
%service_del_postun %{name}-nox.service

%files
%defattr(-,root,root)
%doc AUTHORS Changelog COPYING README.md TODO
%{_bindir}/%{name}
%{_datadir}/applications/%{_name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/pixmaps/%{name}.png
%dir %{_datadir}/appdata/
%{_datadir}/appdata/%{_name}.appdata.xml
%{_mandir}/man?/%{name}.?%{?ext_man}

%files nox
%defattr(-,root,root)
%doc AUTHORS Changelog COPYING README.md TODO
%{_bindir}/%{name}-nox
%{_sbindir}/rc%{name}-nox
%{_unitdir}/%{name}-nox.service
%{_mandir}/man?/%{name}-nox.?%{?ext_man}

%changelog
openSUSE Build Service is sponsored by