File ptokax.spec of Package ptokax
#
# spec file for package ptokax
#
# 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: ptokax
Version: 0.5.3.0
Release: 0
Summary: Server application for the Neo-Modus DC++ sharing network
License: GPL-3.0-only
URL: http://www.ptokax.org
Source0: http://www.ptokax.org/files/%{version}-nix-src.tgz
Source1: desert.firewalld
Source2: nature.firewalld
Source3: desert.service
Source4: nature.service
Patch0: nodate.diff
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: tinyxml-devel
BuildRequires: pkgconfig(lua5.1)
BuildRequires: pkgconfig(zlib)
Requires: lua51-luasec
Requires: lua51-luasocket
Requires(pre): shadow
Provides: group(%{name})
Provides: user(%{name})
%description
PtokaX Direct Connect Hub is a server application for Neo-Modus
Direct Connect Peer-To-Peer sharing network.
PtokaX has a comprehensive user interface, tuned built-in features,
scripting-based extendability.
%prep
%autosetup -p1 -n PtokaX
sed -i 's/\r//g' ReadMe.txt Changelog.txt scripting.docs/scripting-interface.txt
sed -i 's/CXXFLAGS = -O -g -Wall -Wextra/CXXFLAGS = %{optflags}/' makefile
sed -i 's/CXXFLAGS = -O -Wall/CXXFLAGS = %{optflags}/' skein/makefile
rm -r tinyxml
%build
%make_build lua51
%install
mkdir -p %{buildroot}/srv/%{name}
install -Dpm0755 PtokaX %{buildroot}%{_bindir}/%{name}
ln -s %{name} %{buildroot}%{_bindir}/desert
ln -s %{name} %{buildroot}%{_bindir}/nature
install -Dpm0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/firewalld/services/desert.xml
install -Dpm0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/firewalld/services/nature.xml
install -Dpm0644 %{SOURCE3} %{buildroot}%{_unitdir}/desert.service
install -Dpm0644 %{SOURCE4} %{buildroot}%{_unitdir}/nature.service
%pre
getent group %{name} &> /dev/null || groupadd -r %{name}
getent passwd %{name} &> /dev/null || useradd -rc 'Ptokax DC++ Hub' -s /bin/false -d /srv/%{name} -g %{name} %{name}
%service_add_pre desert.service
%service_add_pre nature.service
%post
%service_add_post desert.service
%service_add_post nature.service
%preun
%service_del_preun desert.service
%service_del_preun nature.service
%postun
%service_del_postun desert.service
%service_del_postun nature.service
%files
%defattr(0644,root,root,-)
%license License.txt
%doc Changelog.txt ReadMe.txt scripting.docs/scripting-interface.txt
%dir %attr(-,%{name},%{name}) /srv/%{name}
%attr(0755,root,root) %{_bindir}/{%{name},desert,nature}
%dir %{_prefix}/lib/firewalld
%dir %{_prefix}/lib/firewalld/services
%{_prefix}/lib/firewalld/services/{desert,nature}.xml
%{_unitdir}/{desert,nature}.service
%changelog