936485d
Name: anarch
8a9f585
License: CC0-1.0
936485d
936485d
%global summ_text Suckless, anarcho-pacifist Doom clone that runs everywhere
936485d
Summary: %{summ_text}
936485d
8a611dc
%global git_date 20230123
8a611dc
%global git_commit eeb04a079784ccd9c4b37909795ae781902712eb
936485d
%global git_commit_short %(c='%{git_commit}'; echo "${c:0:8}")
936485d
8a9f585
Version: 1.1^%{git_date}git%{git_commit_short}
8a9f585
Release: 1%{?dist}
936485d
936485d
URL: https://drummyfish.gitlab.io/anarch/
936485d
Source0: https://gitlab.com/drummyfish/%{name}/-/archive/%{git_commit}/%{name}-%{git_commit}.tar.gz
936485d
936485d
Source100: %{name}.desktop
936485d
Source101: %{name}.metainfo.xml
936485d
c5781a3
# The game stores its save file in the current running directory.
c5781a3
# This patch makes it use XDG_DATA_HOME instead.
c5781a3
Patch0: 0000-store-savefile-in-XDG_DATA_HOME.patch
c5781a3
936485d
BuildRequires: desktop-file-utils
936485d
BuildRequires: libappstream-glib
936485d
936485d
BuildRequires: gcc
936485d
BuildRequires: CSFML-devel
936485d
BuildRequires: SDL2-devel
936485d
936485d
936485d
%global desc_text Anarch is an extremely small, completely Public Domain, no-dependency, \
936485d
no-file, portable suckless anarcho-pacifist from-scratch 90s-style Doom clone \
936485d
that runs everywhere, made for the benefit of all living beings. \
936485d
936485d
936485d
%description
936485d
%{desc_text}
936485d
936485d
936485d
%package SDL2
936485d
Summary: %{summ_text} (SDL2 version)
936485d
Requires: hicolor-icon-theme
936485d
936485d
%description SDL2
936485d
%{desc_text}
936485d
936485d
This version of the game runs using the SDL2 library.
936485d
936485d
936485d
%package CSFML
936485d
Summary: %{summ_text} (CSFML version)
936485d
Requires: hicolor-icon-theme
936485d
936485d
%description CSFML
936485d
%{desc_text}
936485d
936485d
This version of the game runs using the CSFML library.
936485d
936485d
936485d
%prep
c5781a3
%autosetup -p1 -n %{name}-%{git_commit}
936485d
936485d
936485d
%build
c5781a3
# The game can be built in many versions.
936485d
# The Linux ones are: terminal, SDL2, CSFML.
936485d
#
936485d
# The terminal version is experimental and needs to be ran as root,
936485d
# as it uses /dev/input and /dev/tty for IO.
c5781a3
#
c5781a3
# This leaves us with the CSFML and the SDL2 versions.
936485d
for LIBRARY in \
936485d
	'CSFML:csfml:main_csfml.c:-lcsfml-graphics -lcsfml-window -lcsfml-system -lcsfml-audio' \
936485d
	'SDL2:sdl2:main_sdl.c:-lSDL2'
936485d
do
936485d
	LIB_NAME="$(echo "${LIBRARY}" | cut -d: -f1)"
936485d
	LIB_SUFFIX="$(echo "${LIBRARY}" | cut -d: -f2)"
936485d
	LIB_SOURCE="$(echo "${LIBRARY}" | cut -d: -f3)"
936485d
	LIB_LDFLAGS="$(echo "${LIBRARY}" | cut -d: -f4)"
936485d
936485d
	gcc -D_DEFAULT_SOURCE \
936485d
		%{optflags} -std=c99 -Wall -Wextra -Wpedantic \
936485d
		${LIB_LDFLAGS} %{build_ldflags} \
936485d
		-o "%{name}-${LIB_SUFFIX}" "${LIB_SOURCE}"
936485d
936485d
	sed -e "s|LIB_NAME|${LIB_NAME}|g" -e "s|LIB_SUFFIX|${LIB_SUFFIX}|g" \
936485d
		< "%{SOURCE100}" > "%{name}-${LIB_SUFFIX}.desktop"
936485d
936485d
	sed -e "s|LIB_NAME|${LIB_NAME}|g" -e "s|LIB_SUFFIX|${LIB_SUFFIX}|g" \
936485d
		< "%{SOURCE101}" > "%{name}-${LIB_SUFFIX}.metainfo.xml"
936485d
done
936485d
936485d
# Also build the test executable.
936485d
gcc %{optflags} -std=c99 %{build_ldflags} -o %{name}-test main_test.c
936485d
936485d
936485d
%install
936485d
install -m 755 -d %{buildroot}%{_bindir}
936485d
install -m 755 -d %{buildroot}%{_datadir}/applications
936485d
install -m 755 -d %{buildroot}%{_metainfodir}
936485d
936485d
ICON_DIR='%{buildroot}%{_datadir}/icons/hicolor/128x128/apps'
936485d
install -m 755 -d "${ICON_DIR}"
936485d
936485d
for LIBRARY in csfml sdl2; do
936485d
	install -m 755 -p "%{name}-${LIBRARY}" -t %{buildroot}%{_bindir}
936485d
	install -m 644 -p "%{name}-${LIBRARY}.desktop" -t %{buildroot}%{_datadir}/applications
936485d
	install -m 644 -p "%{name}-${LIBRARY}.metainfo.xml" -t %{buildroot}%{_metainfodir}
936485d
	install -m 644 -p media/logo_big.png "${ICON_DIR}/%{name}-${LIBRARY}.png"
936485d
done
936485d
936485d
936485d
%check
936485d
./%{name}-test
936485d
936485d
for LIBRARY in csfml sdl2; do
936485d
	desktop-file-validate "%{buildroot}%{_datadir}/applications/%{name}-${LIBRARY}.desktop"
936485d
	appstream-util validate-relax --nonet "%{buildroot}%{_metainfodir}/%{name}-${LIBRARY}.metainfo.xml"
936485d
done
936485d
936485d
936485d
%files CSFML
936485d
%doc README.md
936485d
%license LICENSE
936485d
%{_bindir}/%{name}-csfml
936485d
%{_datadir}/applications/%{name}-csfml.desktop
936485d
%{_datadir}/icons/hicolor/*/apps/%{name}-csfml.png
936485d
%{_metainfodir}/%{name}-csfml.metainfo.xml
936485d
936485d
936485d
%files SDL2
936485d
%doc README.md
936485d
%license LICENSE
936485d
%{_bindir}/%{name}-sdl2
936485d
%{_datadir}/applications/%{name}-sdl2.desktop
936485d
%{_datadir}/icons/hicolor/*/apps/%{name}-sdl2.png
936485d
%{_metainfodir}/%{name}-sdl2.metainfo.xml
936485d
936485d
936485d
%changelog
8a9f585
* Mon Feb 05 2024 Artur Frenszek-Iwicki <fedora@svgames.pl> - 1.1^20230123giteeb04a07-1
8a9f585
- Rebuilt for CSFML 2.6
8a9f585
- Move snapshot info from Release to Version tag
8a9f585
- Migrate License tag to SPDX
8a9f585
9192ac8
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-4.20230123giteeb04a07
9192ac8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
9192ac8
f1b00f9
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-3.20230123giteeb04a07
f1b00f9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
f1b00f9
0d8beb5
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-2.20230123giteeb04a07
0d8beb5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
0d8beb5
8a611dc
* Wed Mar 22 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 1.1-1.20230123giteeb04a07
8a611dc
- Update to v1.1
8a611dc
b80e587
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.02d-7.20210616gitf6a6a68a
b80e587
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
b80e587
9a43c24
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.02d-6.20210616gitf6a6a68a
9a43c24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
9a43c24
b18744d
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.02d-5.20210616gitf6a6a68a
b18744d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
b18744d
c5781a3
* Mon Oct 04 2021 Artur Frenszek-Iwicki <fedora@svgames.pl> - 1.02d-4.20210617gitf6a6a68a8
c5781a3
- Add a patch to make the game store its save file in XDG_DATA_HOME
c5781a3
936485d
* Thu Sep 30 2021 Artur Frenszek-Iwicki <fedora@svgames.pl> - 1.02d-3.20210617gitf6a6a68a8
936485d
- Fix package Summaries being too long
936485d
- Fix missing package Descriptions
936485d
- Fix "implicit function declaration" compile-time warnings
936485d
- Add a Requires on "hicolor-icon-theme"
936485d
936485d
* Wed Sep 01 2021 Artur Frenszek-Iwicki <fedora@svgames.pl> - 1.02d-2.20210617gitf6a6a68a8
936485d
- Build CSFML version alongside SDL2 version
936485d
- Honor %%{build_ldflags} during build
936485d
- Fix BuildRequiring gcc-c++ instead of plain gcc
936485d
936485d
* Wed Jun 30 2021 Artur Frenszek-Iwicki <fedora@svgames.pl> - 1.02d-1.20210617gitf6a6a68a8
936485d
- Initial packaging