File heroic.spec of Package heroic-games-launcher
Name: heroic
Version: 2.18.0
Release: 0
Url: https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher
Summary: A native GUI for Epic Games Launcher, GOG and Amazon Games
Group: System/GUI/KDE
BuildRequires: desktop-file-utils
BuildRequires: update-desktop-files
BuildRequires: hicolor-icon-theme
BuildRequires: -post-build-checks
Requires: zstd
AutoReqProv: no
License: GPL-3.0
Source1: %{name}.png
Source2: Heroic-%{version}-linux-x86_64.AppImage
Source3: %{name}.desktop.txt
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Heroic is an Open Source Game Launcher for Linux, Windows and macOS.
Right now it supports launching games from the Epic Games Store using Legendary,
GOG Games using our custom implementation with gogdl and Amazon Games using Nile.
%build
%install
mkdir -p %{buildroot}/usr/share/pixmaps/
install -D -m 644 %{SOURCE1} %{buildroot}/usr/share/pixmaps/%{name}.png
mkdir -p %{buildroot}/opt/%{name}/
install -D -m 755 %{SOURCE2} %{buildroot}/opt/%{name}/Heroic-%{version}.AppImage
cp -f %{SOURCE3} %{buildroot}/opt/%{name}/%{name}.desktop
%post
# Create .desktop file
rm -f %{_datadir}/applications/%{name}.desktop
cat > %{_datadir}/applications/%{name}.desktop << EOM
[Desktop Entry]
Name=Heroic Games Launcher
Exec=%{name} %U
Terminal=false
Type=Application
Icon=%{name}
StartupWMClass=Heroic
Comment=Game launcher for Epic, GOG and Amazon
GenericName=Game launcher for Epic, GOG and Amazon
MimeType=x-scheme-handler/heroic;
Categories=Game;
EOM
rm -f /usr/bin/%{name}
cat > /usr/bin/%{name} << EOM
#!/bin/bash
env DESKTOPINTEGRATION=1 /opt/%{name}/Heroic-%{version}.AppImage
EOM
chmod a+x /usr/bin/%{name}
%desktop_database_post
%icon_theme_cache_post
%mime_database_post
update-desktop-database
gtk-update-icon-cache
%preun
if [ "$1" = 0 ]; then
# Remove .desktop file
rm -f %{_datadir}/applications/%{name}.desktop
rm -f /usr/bin/%{name}
%desktop_database_post
%icon_theme_cache_post
%mime_database_post
update-desktop-database
gtk-update-icon-cache
fi
%clean
%files
%defattr(755,root,root,755)
/opt/%{name}/Heroic-%{version}.AppImage
%defattr(-,root,root)
/usr/share/pixmaps/%{name}.png
/opt/%{name}/%{name}.desktop
%changelog