File stardust-xr-non-spatial-input.spec of Package stardust-xr-non-spatial-input

%define _bin_name non-spatial-input
Name:           stardust-xr-non-spatial-input
#               This will be set by osc services, that will run after this.
Version:        0.50.0~0
Release:        0
Summary:        Tools you can easily snap together to get non-spatial input into Stardust XR
#               If you know the license, put it's SPDX string here.
#               Alternately, you can use cargo lock2rpmprovides to help generate this.
License:        MIT
Url:            https://github.com/StardustXR/non-spatial-input
Source0:        %{_bin_name}-%{version}.tar.zst
Source1:        vendor.tar.zst
# Pull in the latest rust/cargo toolchain
%if 0%{?suse_version}
BuildRequires:  cargo
BuildRequires:  cargo-packaging
%else
BuildRequires: rust-srpm-macros
BuildRequires: cargo-rpm-macros
%endif
BuildRequires: libudev-devel
BuildRequires: libinput-devel
BuildRequires: libxkbcommon-x11-devel
BuildRequires: gcc-c++

%description
%summary.

%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"

[profile.rpm]
inherits = "release"
opt-level = 3
codegen-units = 1
debug = 2
strip = "none"
EOF
%endif

(cd azimuth && %cargo_build) &
(cd eclipse && %cargo_build) &
(cd manifold && %cargo_build) &
(cd simular && %cargo_build) &
wait

%install
mkdir -p %buildroot/%{_bindir}
install -Dm755 target/release/azimuth  %{buildroot}%{_bindir}/
install -Dm755 target/release/eclipse  %{buildroot}%{_bindir}/
install -Dm755 target/release/manifold  %{buildroot}%{_bindir}/
install -Dm755 target/release/simular  %{buildroot}%{_bindir}/

%check
%{cargo_test}

%files
%license LICENSE
%{_bindir}/azimuth
%{_bindir}/eclipse
%{_bindir}/manifold
%{_bindir}/simular

%changelog
openSUSE Build Service is sponsored by