File livekit.spec of Package livekit

#
# spec file for package livekit
#
# Copyright (c) 2025 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/
#

%global services livekit.service

Name:           livekit
Version:        1.10.1
Release:        0
Summary:        End-to-end stack for WebRTC. SFU media server and SDKs
License:        Apache-2.0
URL:            https://livekit.io
Source0:        https://github.com/livekit/livekit/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        %{name}.sysusers
Source3:        %{name}.env
Source4:        %{name}.service
Source99:       series
Patch1:         buildmode.patch
BuildRequires:  zstd
BuildRequires:  golang-packaging
BuildRequires:  mage
BuildRequires:  wire
BuildRequires:  pkgconfig(systemd)
BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools
%{?systemd_ordering}
%{?sysusers_requires}

%description
LiveKit is an open source project that provides scalable, multi-user
conferencing based on WebRTC. It's designed to provide everything you need to
build real-time video audio data capabilities in your applications.

LiveKit's server is written in Go, using the awesome Pion WebRTC
implementation.

%prep
%autosetup -p1 -a1

%build
mage -v

%sysusers_generate_pre %{SOURCE2} %{name} %{name}.conf

%install
install -D -m 0755 -t %{buildroot}%{_sbindir} bin/livekit-server

install -D -m 0644 %{SOURCE2}                  %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -m 0644 %{SOURCE4}                  %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0640 %{SOURCE3}                  %{buildroot}%{_sysconfdir}/default/%{name}-server
install -D -d -m 0750                          %{buildroot}/var/lib/%{name}
install -D -d -m 0750                          %{buildroot}%{_sysconfdir}/livekit-server
install -D -m 0640 config-sample.yaml          %{buildroot}%{_sysconfdir}/livekit-server/config.yaml

%pre -f %{name}.pre
%service_add_pre %{services}

%preun
%service_del_preun %{services}

%post
%service_add_post %{services}

%postun
%service_del_postun %{services}

%files
%license LICENSE
%doc CHANGELOG.md NOTICE README.md
%doc deploy/
%{_sbindir}/livekit-server

%{_sysusersdir}/%{name}.conf
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/default/%{name}-server
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/%{name}-server/

%dir %attr(-,%{name},%{name}) /var/lib/%{name}

%changelog
openSUSE Build Service is sponsored by