File nzbget.spec of Package nzbget

#
# spec file for package nzbget
#
# Copyright (c) 2024 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:           nzbget
Version:        21.1
Release:        0
Summary:        A binary newsgrabber
License:        GPL-2.0-only
Group:          Productivity/Networking/News/Clients
URL:            https://nzbget.net/
Source:         https://github.com/nzbget/nzbget/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1:        %{name}.service
Source2:        %{name}.sh
Source3:        %{name}.apache.conf
# fix for OpenSSL v3
Patch0:         nzbget-21.1-openssl3.patch
BuildRequires:  gcc-c++
BuildRequires:  libgnutls-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libxml2-devel
BuildRequires:  ncurses-devel
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
%{?systemd_ordering}

%description
NZBGet is a binary newsgrabber, which downloads files from usenet
based on information given in nzb-files. NZBGet can be used in
standalone and in server/client modes.

%prep
%setup -q
%patch -P 0

%build
%configure
%make_build

%install
%make_install
make DESTDIR=%{buildroot} install-conf

install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
mkdir -p %{buildroot}%{_sbindir}
ln -s service %{buildroot}%{_sbindir}/rc%{name}

mkdir -p %{buildroot}%{_prefix}/lib/systemd/scripts
install -D -m 755 %{SOURCE2} %{buildroot}%{_prefix}/lib/systemd/scripts/%{name}.sh

mkdir -p %{buildroot}%{_sysconfdir}/apache2/conf.d
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/apache2/conf.d/%{name}.conf

rm -r %{buildroot}%{_datadir}/doc/%{name}

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
%license COPYING
%doc %attr(644,root,root) ChangeLog README
%{_bindir}/%{name}
%{_sbindir}/rc%{name}
%{_datadir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}.conf
%{_unitdir}/%{name}.service
%dir %{_prefix}/lib/systemd/scripts
%{_prefix}/lib/systemd/scripts/%{name}.sh
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/conf.d
%config %{_sysconfdir}/apache2/conf.d/%{name}.conf

%changelog
openSUSE Build Service is sponsored by