%global repo_owner dextero %global repo_name LD30 %global repo_commit 3f2aa589dd68c8f00366c7172816269c5428bdcf %global repo_date 20180114 %global snap_commit %(c=%{repo_commit}; echo ${c:0:7}) %global snapdata %{repo_date}git%{snap_commit} Name: gravity-beams-and-evaporating-stars Version: 0 Release: 4.%{snapdata}%{?dist} Summary: A game about hurling asteroids into the sun License: MIT URL: https://github.com/%{repo_owner}/%{repo_name} Source0: %{URL}/archive/%{repo_commit}/%{repo_name}-%{repo_commit}.tar.gz Patch0: %{name}-chdir-at-game-start.patch Patch1: %{name}-store-hiscores-in-XDG_DATA_HOME.patch BuildRequires: cmake gcc-c++ make SFML-devel BuildRequires: desktop-file-utils hicolor-icon-theme libappstream-glib Requires: dejavu-sans-fonts hicolor-icon-theme %description You are a lone planet whose star is dying. Use your gravity beams to hurl nearby asteroids into the star, feeding it some extra matter. While saving the star, be sure to avoid being hit by the asteroids yourself. %prep %autosetup -p1 -n %{repo_name}-%{repo_commit} # Change the preferred compiler from clang to gcc sed -e 's|CMAKE_CXX_COMPILER clang++|CMAKE_CXX_COMPILER g++|' -i build/CMakeLists.txt # Inject the RPM data dir sed -e 's|__DATA_DIR__|"%{_datadir}/%{name}"|' -i src/main.cpp %build export CFLAGS="${RPM_OPT_FLAGS}" export CXXFLAGS="${RPM_OPT_FLAGS}" cd build cmake . make %{?_smp_mflags} %install install -m 755 -d %{buildroot}%{_bindir} install -m 755 bin/game %{buildroot}%{_bindir}/%{name} install -m 755 -d %{buildroot}%{_datadir}/%{name} cp -a data %{buildroot}%{_datadir}/%{name}/data # Replace the bundled DejaVuSans font # with a symlink to the system-provided one rm %{buildroot}%{_datadir}/%{name}/data/DejaVuSans.ttf ln -s \ %{_datadir}/fonts/dejavu/DejaVuSans.ttf \ %{buildroot}%{_datadir}/%{name}/data/DejaVuSans.ttf install -m 755 -d %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/ install -m 644 -p \ data/planet.png \ %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png install -m 755 -d %{buildroot}%{_datadir}/applications/ desktop-file-install \ --dir=%{buildroot}%{_datadir}/applications/ \ packaging/%{name}.desktop appstream-util validate-relax --nonet packaging/%{name}.appdata.xml install -m 755 -d %{buildroot}%{_datadir}/metainfo/ install -m 644 -p \ packaging/%{name}.appdata.xml \ %{buildroot}%{_datadir}/metainfo/%{name}.appdata.xml install -m 755 -d %{buildroot}%{_mandir}/man1/ install -m 755 -p \ packaging/%{name}.man \ %{buildroot}%{_mandir}/man1/%{name}.1 %files %license LICENSE %{_bindir}/%{name} %{_datadir}/%{name} %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/*/apps/%{name}.png %{_datadir}/metainfo/%{name}.appdata.xml %{_mandir}/man1/%{name}.* %changelog * Wed Apr 04 2018 Artur Iwicki - 0.4.20180114git3f2aa58 - Update to new upstream snapshot - Remove Source1, Source2 and Source3 - files accepted upstream - Move the appdata file from appdata/ to metainfo/ - Use a patch file to make the game chdir() at start (instead of sed wizardry) * Tue Apr 03 2018 Artur Iwicki - 0-3.20180110git727d759 - Add a patch to store the game hi-scores in XDG_DATA_HOME * Sun Jan 14 2018 Artur Iwicki - 0-2.20180110git727d759 - Add man page, desktop and appdata files * Thu Jan 11 2018 Artur Iwicki - 0-1.20180110git727d759 - Initial packaging