
%global app_name paktool
%global debug_package %{nil}

Name:           %{app_name}
Version:        0.0.4
Release:        1%{?dist}
Summary:        A tool for expanding and creating Dead Cells PAK archives.

License:        MIT
URL:            https://github.com/N3rdL0rd/alivecells
Source0:        %{app_name}-%{version}.tar.gz

Requires:       dotnet-runtime-9.0

BuildArch:      x86_64

# =============================================================================
%description
A command-line tool for expanding and creating PAK resource archives for the
game Dead Cells. This version has been recompiled from decompiled sources to
run natively on modern .NET and Linux. Now with v1 PAK support >=v35!

# =============================================================================
%prep
# This section prepares the source code.
# The macro automatically unpacks the Source0 tarball.
%setup -q -c

# =============================================================================
%build
# This section is intentionally left empty. We are not compiling anything from
# source here, but rather packaging the pre-compiled binaries generated by the
# 'dotnet publish' command.

# =============================================================================
%install

install -d -m 755 %{buildroot}%{_libdir}/%{app_name}
install -d -m 755 %{buildroot}%{_bindir}
install -m 755 %{_builddir}/%{app_name}-%{version}/* %{buildroot}%{_libdir}/%{app_name}/

cat << 'EOF' > %{buildroot}%{_bindir}/%{app_name}
#!/bin/bash
exec %{_libdir}/%{app_name}/PAKTool "$@"
EOF

chmod 755 %{buildroot}%{_bindir}/%{app_name}

# =============================================================================
%files
%defattr(-,root,root,-)

%{_bindir}/%{app_name}
%{_libdir}/%{app_name}/

# =============================================================================
%changelog
* Thu Jul 31 2025 N3rdL0rd <n3rdl0rd@proton.me> - 0.0.2-1
- Initial RPM packaging for the cross-platform version of PAKTool.
