File battleship-rs.spec of Package battleship-rs

Name:           battleship-rs
#               This will be set by osc services, that will run after this.
Version:        0.1.1~0
Release:        0
Summary:        Battleship game implemented in Rust.
License:        MIT
Url:            https://github.com/orhun/battleship-rs
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        cargo_config
BuildRequires:  cargo-packaging
# Disable this line if you wish to support all platforms.
# In most situations, you will likely only target tier1 arches for user facing components.
ExclusiveArch:  %{rust_tier1_arches}

# the name of the actual binary program when differs from the project
%define bin_name battleship

%description
A Battleship game implemented in Rust.
Mainly for package practice

%prep
# The number passed to -a (a stands for "after") should be equivalent to the Source tag number
# of the vendor tarball, 1 in this case (from Source1).
%autosetup -p1 -a1
install -D -m 644 %{SOURCE2} .cargo/config
# Remove exec bits to prevent an issue in fedora shebang checking. Uncomment only if required.
# find vendor -type f -name \*.rs -exec chmod -x '{}' \;

%build
%{cargo_build}

%install
# using cargo_install (only supports bindir)
#%{cargo_install}
# manual process
install -D -d -m 0755 %{buildroot}%{_bindir}
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{bin_name} %{buildroot}%{_bindir}/%{bin_name}
 
%check
%{cargo_test}

%files
%{_bindir}/%{bin_name}
%license LICENSE
%doc README.md

%changelog
openSUSE Build Service is sponsored by