Blame gearhead1.spec

4c32077
# There is Gearhead 2 in development right now,
4c32077
# and upstream always refers to the first game as "Gearhead 1",
4c32077
# so let's stick with that and use "gearhead1" instead of just "gearhead"
4c32077
Name: gearhead1
4c32077
%global reponame gearhead-1
4c32077
%global prettyname GearHead: Arena
4c32077
4c32077
%global about_game Roguelike mecha role-playing game
4c32077
Summary: %{about_game}
4c32077
License: LGPLv2
4c32077
4c32077
Version: 1.310
7bdadec
Release: 7%{?dist}
4c32077
4c32077
URL: http://gearheadrpg.com
4c32077
Source0: https://github.com/jwvhewitt/%{reponame}/archive/v%{version}/%{reponame}-%{version}.tar.gz
4c32077
4c32077
Source10: %{name}-icon-128px.png
4c32077
Source11: %{name}-icon-96px.png
4c32077
Source12: %{name}-icon-48px.png
4c32077
4c32077
Source20: %{name}-sdl.appdata.xml
4c32077
4c32077
ExclusiveArch: %{fpc_arches}
4c32077
4c32077
BuildRequires: desktop-file-utils
4c32077
BuildRequires: dos2unix
4c32077
BuildRequires: fpc
4c32077
BuildRequires: fpc-srpm-macros
4c32077
BuildRequires: glibc-devel
4c32077
BuildRequires: libappstream-glib
4c32077
BuildRequires: SDL-devel
4c32077
BuildRequires: SDL_image-devel
4c32077
BuildRequires: SDL_ttf-devel
4c32077
4c32077
%global fontlist font(bitstreamverasans) font(bitstreamverasansmono) font(bitstreamveraserif)
4c32077
BuildRequires: fontconfig
4c32077
BuildRequires: %{fontlist}
4c32077
4c32077
Requires: %{name}-bin%{?_isa} = %{version}-%{release}
4c32077
Suggests: %{name}-SDL%{?_isa} = %{version}-%{release}
4c32077
4c32077
4c32077
%description
4c32077
Set a century and a half after nuclear war, in this game you explore a world
4c32077
where various factions compete to determine the future of the human race.
4c32077
4c32077
Features include random plot generation and over two hundred mecha designs.
4c32077
Pilot a giant robot, a city smashing tank, a living jet fighter, or
4c32077
anything else that can be built using the game's sophisticated design system.
4c32077
4c32077
4c32077
%package textmode
4c32077
Summary: %{about_game} (textmode version)
4c32077
Provides: %{name}-bin%{?_isa} = %{version}-%{release}
4c32077
4c32077
Requires: %{name}-data = %{version}-%{release}
4c32077
4c32077
%description textmode
4c32077
Textmode build of %{prettyname}.
4c32077
4c32077
4c32077
%package SDL
4c32077
Summary: %{about_game} (SDL version)
4c32077
Provides: %{name}-bin%{?_isa} = %{version}-%{release}
4c32077
4c32077
Requires: %{name}-data = %{version}-%{release}
4c32077
Requires: %{name}-data-gfx = %{version}-%{release}
4c32077
4c32077
%description SDL
4c32077
Graphical build of %{prettyname}, based on the SDL library.
4c32077
4c32077
4c32077
%package data
4c32077
Summary: Data files for %{name}
4c32077
BuildArch: noarch
4c32077
4c32077
%description data
4c32077
Data files required to play %{prettyname}.
4c32077
4c32077
4c32077
%package data-gfx
4c32077
Summary: Graphics and fonts for %{name}-SDL
4c32077
BuildArch: noarch
4c32077
4c32077
Requires: %{name}-data = %{version}-%{release}
4c32077
4c32077
Requires: %{fontlist}
4c32077
Requires: hicolor-icon-theme
4c32077
4c32077
%description data-gfx
4c32077
Images and fonts required to play the graphical version of %{prettyname}.
4c32077
4c32077
4c32077
%prep
4c32077
%setup -q -n %{reponame}-%{version}
4c32077
4c32077
# Convert files from \r\n to \n
4c32077
find doc/ -type f -exec dos2unix '{}' ';'
4c32077
dos2unix readme.md
4c32077
4c32077
# Copy over the icons
4c32077
cp -a %{SOURCE10} %{SOURCE11} %{SOURCE12} ./
4c32077
4c32077
# Copy over the appdata.xml file
4c32077
cp -a %{SOURCE20} ./
4c32077
4c32077
# Upsteam does not ship a desktop file
4c32077
cat > %{name}-sdl.desktop << EOF
4c32077
[Desktop Entry]
4c32077
Type=Application
4c32077
Name=%{prettyname}
4c32077
Comment=%{about_game}
4c32077
Exec=%{name}-sdl
4c32077
Icon=%{name}
4c32077
Terminal=false
4c32077
Categories=Game;
4c32077
EOF
4c32077
4c32077
# The game looks for the data files in the current working directory
4c32077
cat > wrapper-textmode.sh << EOF
4c32077
#!%{_bindir}/bash
4c32077
cd %{_datadir}/%{name}
4c32077
%{_libexecdir}/%{name}/%{name}-textmode \$@
4c32077
EOF
4c32077
4c32077
cat > wrapper-sdl.sh << EOF
4c32077
#!%{_bindir}/bash
4c32077
cd %{_datadir}/%{name}
4c32077
%{_libexecdir}/%{name}/%{name}-sdl \$@
4c32077
EOF
4c32077
4c32077
4c32077
%build
4c32077
%global buildflags -gw -O2
4c32077
# -- build the terminal version of the game
4c32077
fpc %{buildflags} -o'gharena-textmode' gharena.pas
4c32077
4c32077
# -- remove all compilation leftovers (the equivalent of "make clean")
4c32077
rm *.a || true
4c32077
rm *.o || true
4c32077
rm *.ppu || true
4c32077
4c32077
# -- build the SDL version of the game
4c32077
fpc %{buildflags} -d'SDLMODE' -o'gharena-sdl' gharena.pas
4c32077
4c32077
4c32077
%install
4c32077
install -m 755 -d %{buildroot}%{_bindir}
4c32077
install -m 755 -d %{buildroot}%{_libexecdir}/%{name}
4c32077
4c32077
for BUILD in textmode sdl; do
4c32077
	install -m 755  "wrapper-${BUILD}.sh"  "%{buildroot}%{_bindir}/%{name}-${BUILD}"
4c32077
	install -m 755  "gharena-${BUILD}"  "%{buildroot}%{_libexecdir}/%{name}/%{name}-${BUILD}"
4c32077
done
4c32077
4c32077
install -m 755 -d %{buildroot}%{_datadir}/%{name}
4c32077
cp -a Design GameData Image Series  %{buildroot}%{_datadir}/%{name}
4c32077
4c32077
# Replace the bundled Bitstream Vera fonts
4c32077
# with symlinks to fonts provided by bitstream-vera-* packages
4c32077
for FONT in  \
4c32077
	"Vera/Sans:regular" "VeraBd/Sans:bold" "VeraIt/Sans:italic" "VeraBI/Sans:bold:italic"  \
4c32077
	"VeraMono/Sans Mono:regular" "VeraMoBd/Sans Mono:bold" "VeraMoIt/Sans Mono:italic" "VeraMoBI/Sans Mono:bold:italic"  \
4c32077
	"VeraSe/Serif:regular" "VeraSeBd/Serif:bold";
4c32077
do
4c32077
	FONT_FILE="$(echo "$FONT" | cut '-d/' -f1)"
4c32077
	FONT_NAME="Bitstream Vera $(echo "$FONT" | cut '-d/' -f2-)"
4c32077
	ln -sf  \
4c32077
		"$(fc-match -f "%%{file}" "${FONT_NAME}")"  \
4c32077
		"%{buildroot}%{_datadir}/%{name}/Image/${FONT_FILE}.ttf"
4c32077
done
4c32077
4c32077
install -m 755 -d %{buildroot}%{_datadir}/applications
4c32077
install -m 644 %{name}-sdl.desktop %{buildroot}%{_datadir}/applications/
4c32077
4c32077
install -m 755 -d %{buildroot}%{_metainfodir}
4c32077
install -m 644 %{name}-sdl.appdata.xml %{buildroot}%{_metainfodir}/
4c32077
4c32077
for SIZE in 128 96 48; do
4c32077
	ICONDIR="%{buildroot}%{_datadir}/icons/hicolor/${SIZE}x${SIZE}/apps"
4c32077
	install -m 755 -d "${ICONDIR}"
4c32077
	install -m 644 "%{name}-icon-${SIZE}px.png" "${ICONDIR}/%{name}.png"
4c32077
done
4c32077
4c32077
4c32077
%check
4c32077
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{name}-sdl.appdata.xml
4c32077
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}-sdl.desktop
4c32077
4c32077
4c32077
%files
4c32077
# empty
4c32077
4c32077
%files textmode
4c32077
%{_bindir}/%{name}-textmode
4c32077
%dir %{_libexecdir}/%{name}/
4c32077
     %{_libexecdir}/%{name}/%{name}-textmode
4c32077
4c32077
%files SDL
4c32077
%{_bindir}/%{name}-sdl
4c32077
%dir %{_libexecdir}/%{name}/
4c32077
     %{_libexecdir}/%{name}/%{name}-sdl
4c32077
%{_datadir}/applications/%{name}-sdl.desktop
4c32077
%{_metainfodir}/%{name}-sdl.appdata.xml
4c32077
4c32077
%files data
4c32077
%doc doc/
4c32077
%doc readme.md
4c32077
%license license.txt
4c32077
%{_datadir}/%{name}
4c32077
%exclude %{_datadir}/%{name}/Image/
4c32077
4c32077
%files data-gfx
4c32077
%{_datadir}/%{name}/Image/
4c32077
%{_datadir}/icons/hicolor/*/apps/%{name}.png
4c32077
4c32077
4c32077
%changelog
7bdadec
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.310-7
7bdadec
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
7bdadec
ef7b12d
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.310-6
ef7b12d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
ef7b12d
253dc4c
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.310-5
253dc4c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
253dc4c
4c32077
* Mon May 18 2020 Artur Iwicki <fedora@svgames.pl> - 1.310-4
4c32077
- Fix DOS line endings in files
4c32077
4c32077
* Fri May 15 2020 Artur Iwicki <fedora@svgames.pl> - 1.310-3
4c32077
- Use fc-match to find system fonts instead of using hard-coded paths
4c32077
- Add an appdata.xml file
4c32077
4c32077
* Wed Apr 22 2020 Artur Iwicki <fedora@svgames.pl> - 1.310-2
4c32077
- Build both the SDL and the textmode version of the game
4c32077
- Put the SDL and textmode versions in separate subpackages
4c32077
- Move images and fonts out of -data into -data-gfx
4c32077
- Fix one of the fonts being symlinked wrong
4c32077
- Add some icons and a desktop file
4c32077
4c32077
* Sat Apr 11 2020 Artur Iwicki <fedora@svgames.pl> - 1.310-1
4c32077
- Initial packaging