File tuwunel.spec of Package tuwunel

#
# spec file for package tuwunel
#
# 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 home_dir /var/lib/tuwunel
%global services %{name}.service

Name:           tuwunel
Version:        1.4.1+git0.a1677f05
Release:        0
Summary:        A very cool, featureful fork of conduit
License:        Apache-2.0
URL:            https://github.com/matrix-construct/tuwunel
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        %{name}.sysusers
BuildRequires:  zstd
BuildRequires:  cargo-packaging
BuildRequires:  cargo
BuildRequires:  gcc-c++
BuildRequires:  clang-devel
BuildRequires:  llvm-devel
BuildRequires:  pkgconfig(liburing)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  rocksdb-devel
BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools
%{?systemd_ordering}
%{?sysusers_requires}

%description
Tuwunel is a featureful Matrix homeserver you can use instead of Synapse with
your favorite client, bridge or bot. It is written entirely in Rust to be a
scalable, lightweight, low-cost, community-driven alternative covering all but
the most niche uses.

This project is the official successor to conduwuit, which was a featureful and
high-performance fork of Conduit, all community-lead homeservers implementing
the compatible Matrix Specification.

Tuwunel is operated by enterprise users with a vested interest in sponsoring
its continued development. It is now maintained by full-time staff.

%prep
%autosetup -p1 -a1

%build
# env needed which is not present in our shipped `.cargo/config.toml`
export RUMA_UNSTABLE_EXHAUSTIVE_TYPES="true"
#export CC=clang
#export CXX=clang++
%{cargo_build}
chmod a-x *.md
%sysusers_generate_pre %{SOURCE2} %{name} %{name}.conf

%install
install -D -m 0755 -t %{buildroot}%{_sbindir} target/release/tuwunel
install -D -m 0750 -d %{buildroot}%{_sysconfdir}/%{name} %{buildroot}%{home_dir}
install -D -m 0640 tuwunel-example.toml %{buildroot}%{_sysconfdir}/%{name}/%{name}.toml
install -D -m 0644 %{SOURCE2}                  %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -m 0644                          -t %{buildroot}%{_unitdir}/ debian/%{name}.service



%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 *.md docs/
%{_sbindir}/tuwunel
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/%{name}
%dir %attr(-,%{name},%{name}) %{home_dir}
%{_sysusersdir}/%{name}.conf
%{_unitdir}/%{services}

%changelog
openSUSE Build Service is sponsored by