# Generated by rust2rpm 27
%bcond check 0
%bcond rust_nightly 0
%global debug_package %{nil}
%if %{with rust_nightly}
%define __cargo /usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' $HOME/.cargo/bin/cargo
%define __rustc $HOME/.cargo/bin/rustc
%define __rustdoc $HOME/.cargo/bin/rustdoc
%endif

Name:           lovely-injector
Version:        0.9.0
Release:        1%?dist
Summary:        A runtime lua injector for games built with LÖVE

License:        MIT
# LICENSE.dependencies contains a full license breakdown

URL:            https://github.com/ethangreen-dev/lovely-injector
Requires:       love
BuildRequires:  cmake
BuildRequires:  gcc-c++
Packager:       Cappy Ishihara <cappy@cappuchino.xyz>

BuildRequires:  mold anda-srpm-macros cargo-rpm-macros >= 24
%if %{with rust_nightly}
BuildRequires: rustup
%endif

%global _description %{expand:
%{summary}.}

%description %{_description}

%prep
rm -rf *
%git_clone %{url} v%{version}

%if %{with rust_nightly}
rustup-init -y
. "$HOME/.cargo/env"
rustup toolchain install nightly
rustup override set nightly
%endif
%cargo_prep_online


%build
%{cargo_license_online} > LICENSE.dependencies
pushd crates/lovely-unix
%cargo_build
popd

%install
# install library
install -Dm 644 target/rpm/liblovely.so %{buildroot}%{_libdir}/liblovely.so

%if %{with check}
%check
pushd crates/lovely-unix
%cargo_test
popd
%endif

%files
%license LICENSE.md
# Only include dobby-sys license for versions >= 0.8
# Manually uncomment the next line when updating to 0.8 or later
%license crates/dobby-sys/LICENSE
%license LICENSE.dependencies
%{_libdir}/liblovely.so
%doc README.md

%changelog
* Mon May 26 2025 Cappy Ishihara <cappy@fyralabs.com> - 0.7.1-1
- Initial package
