File stardust-xr-flatland.spec of Package stardust-xr-flatland

%define _bin_name flatland
Name:           stardust-xr-flatland
#               This will be set by osc services, that will run after this.
Version:        0.50.0~0
Release:        0
Summary:        Flatland for 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/Flatland
Source0:        %{_bin_name}-%{version}.tar.zst
Source1:        vendor.tar.zst
%if 0%{?suse_version}
BuildRequires:  cargo
BuildRequires:  cargo-packaging
%else
BuildRequires: rust-srpm-macros
BuildRequires: cargo-rpm-macros
%endif

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

export STARDUST_RES_PREFIXES=%_datadir
%{cargo_build} \
%if 0%{?fedora}
	--frozen --locked
%endif


%install
mkdir -p %buildroot/%{_bindir}
install -Dm755 target/release/%{_bin_name}  %{buildroot}%{_bindir}/
mkdir -p %buildroot%_datadir
cp -r res/* %buildroot%_datadir/


%check
%{cargo_test}

%files
%license LICENSE
%{_bindir}/%{_bin_name}
%_datadir/%{_bin_name}/

%changelog
openSUSE Build Service is sponsored by