File qBittorrent-Enhanced-Edition.spec of Package qBittorrent-Enhanced-Edition

#
# spec file for package qBittorrent-Enhanced-Edition
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           qBittorrent-Enhanced-Edition
Version:        4.6.5.10
Release:        0
Summary:        A BitTorrent client in Qt
License:        GPL-2.0-or-later
Group:          Productivity/Networking/File-Sharing
URL:            https://github.com/c0re100/qBittorrent-Enhanced-Edition
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake >= 3.16
BuildRequires:  fdupes
BuildRequires:  libtorrent-rasterbar-devel
BuildRequires:  libqt5-qtbase-common-devel
BuildRequires:  libqt5-qtbase-private-headers-devel 
BuildRequires:  libQt5Core-devel
BuildRequires:  libqt5-qtsvg-devel
BuildRequires:  libQt5DBus-devel
BuildRequires:  libqt5-linguist
BuildRequires:  libqt5-linguist-devel
# BuildRequires:  libboost_headers-devel
# BuildRequires:  libboost_system-devel
BuildRequires:  libboost_filesystem-devel 
BuildRequires:  zlib-devel
BuildRequires:  libQt5Network-devel
BuildRequires:  libQt5Xml-devel
BuildRequires:  libQt5Sql-devel

%description
qBittorrent is a bittorrent client programmed in C++ / Qt that uses libtorrent
(sometimes called libtorrent-rasterbar) by Arvid Norberg.

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:        qBittorrent-Enhanced-Edition without GUI

%description nox
qBittorrent is a bittorrent client programmed in C++ and Qt that uses
libtorrent-rasterbar. This subpackage contains a command-line version.

%prep
%autosetup -p1

%build
# ref network/qbittorrent
for ui in nox gui; do
    [[ "$ui" == "nox" ]] && ui_opt="-DGUI=OFF" || ui_opt=
    %cmake \
        "$ui_opt" \
        -DSYSTEMD=ON \
        -DSYSTEMD_SERVICES_INSTALL_DIR=%{_unitdir}
    %make_build
    cd ..
    mv build{,.$ui}
done

%install
for ui in nox gui; do
    mv build{.$ui,}
    %cmake_install
    mv build{,.$ui}
done
install -d %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcqbittorrent-nox
%fdupes %{buildroot}%{_datadir}/

%pre
%service_add_pre qbittorrent-nox@.service
%post -p /sbin/ldconfig
%service_add_post qbittorrent-nox@.service
%preun
%service_del_preun qbittorrent-nox@.service
%postun -p /sbin/ldconfig
%service_del_postun qbittorrent-nox@.service

%files
%license COPYING
%doc Changelog README.md AUTHORS
%{_bindir}/qbittorrent
%{_datadir}/applications/org.qbittorrent.qBittorrent.desktop
%dir %{_datadir}/icons/hicolor/*
%dir %{_datadir}/icons/hicolor/*/apps
%dir %{_datadir}/icons/hicolor/*/status
%{_datadir}/icons/hicolor/*/apps/qbittorrent.png
%{_datadir}/icons/hicolor/*/status/qbittorrent-tray.png
%{_datadir}/icons/hicolor/scalable/status/qbittorrent-tray*.svg
%{_datadir}/icons/hicolor/scalable/apps/qbittorrent.svg
%{_datadir}/metainfo/org.qbittorrent.qBittorrent.metainfo.xml
%{_mandir}/man?/qbittorrent.?.gz

%files nox
%license COPYING
%doc Changelog README.md AUTHORS
%{_bindir}/qbittorrent-nox
%{_sbindir}/rcqbittorrent-nox
%{_unitdir}/qbittorrent-nox@.service
%{_mandir}/man?/qbittorrent-nox.?.gz

%changelog

openSUSE Build Service is sponsored by