File stardust-xr-server.spec of Package stardust-xr-server
%define _bin_name server
%if "%{_vendor}" == "debbuild"
%define cargo_build cargo build -j${RPM_BUILD_NCPUS} --offline --locked --release
%define cargo_install cargo install -j${RPM_BUILD_NCPUS} --offline --locked --no-track --root=%{buildroot}/usr --path .
%define cargo_test cargo test j${RPM_BUILD_NCPUS} --offline --locked --no-fail-fast
%endif
Name: stardust-xr-server
Version: 0.51.1~0
Release: 0
Summary: The Stardust XR server, required to run and connect clients
License: GPL-2.0-only
Url: https://github.com/StardustXR/server
Source0: %{_bin_name}-%{version}.tar.zst
Source1: vendor.tar.zst
BuildRequires: cargo
BuildRequires: cmake
%if 0%{?suse_version}
BuildRequires: cargo-packaging
BuildRequires: OpenXR-SDK-devel
%else
%if "%{_vendor}" != "debbuild"
BuildRequires: rust-srpm-macros
BuildRequires: cargo-rpm-macros
BuildRequires: openxr-devel
%endif
%endif
%if "%{_vendor}" == "debbuild"
Group: misc
Packager: luna <luna@nullrequest.com>
BuildRequires: zstd
BuildRequires: libfontconfig-dev
BuildRequires: libasound2-dev
BuildRequires: libwayland-dev
BuildRequires: g++
BuildRequires: libopenxr-dev
%else
BuildRequires: gcc-c++
BuildRequires: fontconfig-devel
BuildRequires: glibc
BuildRequires: alsa-lib-devel
BuildRequires: wayland-devel
Provides: stardust-server
%endif
%description
The Stardust XR server, required to run and connect clients.
%prep
%autosetup -p1 -a1 -n %{_bin_name}-%{version}
%build
%if 0%{?fedora}
/usr/bin/mkdir -p target/rpm
/usr/bin/ln -s rpm target/release
cat >> .cargo/config.toml <<'EOF'
[build]
rustc = "/usr/bin/rustc"
rustdoc = "/usr/bin/rustdoc"
[target.x86_64-unknown-linux-gnu]
rustflags = ["-Clinker-features=-lld"]
[target.aarch64-unknown-linux-gnu]
rustflags = ["-Clinker-features=-lld"]
[profile.rpm]
inherits = "release"
EOF
%endif
%{cargo_build}
#fedora copies these in /usr/src and some are exectuable and break the build
%if 0%{?fedora}
find ./vendor -type f -executable -name '*.rs' -exec chmod -x {} +
%endif
%install
mkdir -p %{buildroot}%{_bindir}/
install -Dm755 target/release/%{name} %{buildroot}%{_bindir}/
%files
%license LICENSE
%{_bindir}/%{name}
%changelog