File an-anime-game-launcher.spec of Package AAGL
#
# spec file for package an-anime-game-launcher
#
# Copyright 2022 Marie/Maroxy
Name: an-anime-game-launcher
Version: 3.9.6
Release: 0%{?dist}
License: GPL-3.0
Group: Amusements/Games/3D/Other
Summary: An Launcher for GI
Url: https://github.com/an-anime-team/an-anime-game-launcher
Source0: an-anime-game-launcher-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: an-anime-game-launcher.desktop
Source3: icon.png
Source4: cargo_config
Requires: unzip
Requires: cabextract
Requires: tar
Requires: libadwaita
Requires: gtk4
Requires: git
Requires: bzip2
BuildRequires: gtk4
BuildRequires: libadwaita
BuildRequires: git
BuildRequires: rust
BuildRequires: cargo
BuildRequires: gtk4-devel
BuildRequires: openssl-devel
BuildRequires: python3
BuildRequires: python3-gobject
BuildRequires: libadwaita-devel
BuildRequires: cmake
Requires: xdelta3
Requires: libbz2-1
BuildRequires: libbz2-1
BuildRequires: cargo-packaging
Requires: curl
BuildRequires: desktop-file-utils
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
%description
An Launcher for GI with auto-patching, discord rpc and time tracking
%prep
%autosetup -a1
mkdir .cargo
cp %{SOURCE4} .cargo/config
%build
%{cargo_build}
%install
# configure desktop and icon
install -Dm644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/512x512/apps/%{name}.png
desktop-file-install \
--dir=%{buildroot}%{_datadir}/applications \
--set-key=Exec \
--set-value=%{_bindir}/%{name} \
%{SOURCE2}
# install resources
mkdir -p %{buildroot}%{_libdir}/%{name}
shopt -s extglob
cp %{_builddir}/%{name}-%{version}/target/release/anime-game-launcher %{buildroot}%{_libdir}/%{name}
shopt -u extglob
# fix missing icon in some environments
ln -sf %{_datadir}/icons/hicolor/512x512/apps/%{name}.png %{buildroot}%{_libdir}/%{name}
ln -sf %{_datadir}/icons/hicolor/512x512/apps/%{name}.png %{buildroot}%{_datadir}/icons/moe.launcher.%{name}.png
# symlink to bin
mkdir -p %{buildroot}%{_bindir}
ln -s %{_libdir}/%{name}/anime-game-launcher %{buildroot}%{_bindir}/%{name}
%post
%if 0%{?suse_version} < 1500
%desktop_database_post
%endif
chmod 0755 %{_libdir}/%{name}/anime-game-launcher
%if 0%{?suse_version} < 1500
%postun
%desktop_database_postun
%endif
%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/512x512/apps/%{name}.png
%{_datadir}/icons/moe.launcher.%{name}.png
%{_libdir}/%{name}
%dir %{_datadir}/icons/hicolor/512x512
%dir %{_datadir}/icons/hicolor/512x512/apps
%dir %{_datadir}/icons/hicolor
%changelog