File nextcloud-spreed-signaling.spec of Package nextcloud-spreed-signaling
#
# spec file for package nextcloud-spreed-signaling
#
# Copyright (c) 2023 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/
#
%define service_user nc-talk-sig
Name: nextcloud-spreed-signaling
Version: 2.0.4
Release: 0
Summary: Spreed standalone signaling server
License: AGPL-3.0
Group: Productivity/Networking/Talk/Servers
URL: https://github.com/strukturag/nextcloud-spreed-signaling
Source: https://github.com/strukturag/%name/releases/download/v%version/%name-v%version.tar.gz
Source2: %name.service.in
Patch0: unpin-protoc-gen-go.patch
BuildRequires: systemd-rpm-macros
BuildRequires: protobuf-devel
BuildRequires: go >= 1.23
Suggests: janus-gateway >= 1.1.0
%{?systemd_ordering}
%description
Spreed standalone signaling server, a.k.a. Nextcloud Talk High Performance Backend.
%prep
%autosetup -n %name-v%version
sed 's,@@SERVICE_USER@@,%service_user,;s,@@CONFIG_DIR@@,%name,;s,@@INSTALL_PATH@@,%{_libexecdir}/%{name},;' %{S:2} > dist/init/systemd/signaling.service
%build
%make_build common GOPROXY=off VERSION=%version
go build -mod=vendor -buildmode=pie -ldflags "-X main.version=%version -B 0x$(od -An -tx1 -N20 -w40 /dev/urandom | tr -d ' ')" -o bin/signaling ./server/...
go build -mod=vendor -buildmode=pie -ldflags "-X main.version=%version -B 0x$(od -An -tx1 -N20 -w40 /dev/urandom | tr -d ' ')" -o bin/proxy ./proxy/...
%install
install -D -m 755 bin/signaling %{buildroot}%{_libexecdir}/%{name}/signaling
install -D -m 755 bin/proxy %{buildroot}%{_libexecdir}/%{name}/proxy
sed 's/@@BIN_NAME@@/proxy/;s/@@SERVICE_NAME@@/proxy/;' dist/init/systemd/signaling.service > dist/init/systemd/proxy.service
sed -i 's/@@BIN_NAME@@/signaling/;s/@@SERVICE_NAME@@/server/;' dist/init/systemd/signaling.service
install -D -m 644 dist/init/systemd/proxy.service %{buildroot}%{_unitdir}/%name-proxy.service
install -D -m 644 dist/init/systemd/signaling.service %{buildroot}%{_unitdir}/%name-server.service
install -D -m 600 proxy.conf.in %{buildroot}%{_sysconfdir}/%name/proxy.conf
install -D -m 600 server.conf.in %{buildroot}%{_sysconfdir}/%name/server.conf
%if 0%{?suse_version}
%pre
%service_add_pre %name-proxy.service %name-server.service
%post
%service_add_post %name-proxy.service %name-server.service
%preun
%service_del_preun %name-proxy.service %name-server.service
%postun
%service_del_postun %name-proxy.service %name-server.service
%endif
%if 0%{?rhel} || 0%{?fedora}
%post
%systemd_post %name-proxy.service %name-server.service
%preun
%systemd_preun %name-proxy.service %name-server.service
%postun
%systemd_postun %name-proxy.service %name-server.service
%endif
%files
%license LICENSE
%doc CHANGELOG.md README.md
%config(noreplace) %{_sysconfdir}/%name
%{_libexecdir}/%{name}
%{_unitdir}/%name-proxy.service
%{_unitdir}/%name-server.service
%changelog