File starfighter.spec of Package starfighter

# Now for the meat of the spec file
#
%define _icondir %{_datadir}/icons/hicolor
%define _gamesbindir %{_prefix}/games/
%define _gamesdatadir %{_datadir}/games/
%define _docdir %{_datadir}/doc/packages

Name:			starfighter
Version:		1.1
Summary:		Starfighter
License:		GPLv2
URL:			http://www.parallelrealities.co.uk/projects/starfighter.php
Source0:		%{name}-%{version}.tar.gz
Source1:		%{name}-icons.tar
Source2:		%{name}.desktop
Group:			Amusements/Games/Action/Arcade
Release:		1
BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:		desktop-file-utils
Patch0:			starfighter-1.1_makefile.diff
Requires:		hicolor-icon-theme
BuildRequires:		hicolor-icon-theme
BuildRequires:		gcc-c++
BuildRequires:		pkg-config
BuildRequires:		update-desktop-files
BuildRequires:		SDL-devel
BuildRequires:		SDL_image-devel
BuildRequires:		SDL_mixer-devel

%description
After decades of war one company, who had gained powerful supplying both sides
with weaponary, steps forwards and crushes both warring factions in one swift
movement. Using far superior weaponary and AI craft, the company was completely
unstoppable and now no one can stand in their way. Thousands began to perish
under the iron fist of the company. The people cried out for a saviour, for
someone to light this dark hour... and someone did.


%prep
%setup -q
%setup -q -a 1
%patch0 -p1


%build
export CFLAGS="`sdl-config --cflags` -Wall -DLINUX %{optflags}"
%{__make} %{?jobs:-j%jobs} VERSION=%{version} PACKLOCATION=%{_gamesdatadir}/parallelrealities/ DOCDIR=%{_docdir}/%{name}/ ICONDIR=%{_icondir}/


%install
mkdir -p %{buildroot}%{_gamesdatadir}/parallelrealities
mkdir -p %{buildroot}%{_gamesbindir}
mkdir -p %{buildroot}/%{_datadir}/applications
strip %{name}
install -m 755 %{name} %{buildroot}/%{_gamesbindir}/%{name}
install -m 644 %{name}.pak %{buildroot}/%{_gamesdatadir}/parallelrealities/%{name}.pak

install -m 644 %{SOURCE2} %{buildroot}/%{_datadir}/applications/%{name}.desktop
%suse_update_desktop_file -i %{name}

for i in 16 32 64 128
do
	mkdir -p %{buildroot}/%{_icondir}/${i}x${i}/apps
	install -m 644 icons/%{name}-${i}.png %{buildroot}/%{_icondir}/${i}x${i}/apps/%{name}.png
done

%clean
%{__rm} -rf %{buildroot}
%{__rm} -rf %{_builddir}/%{name}-%{version}-%{release}-buildroot

%files
%defattr(-,root,root)
%doc docs/*
%{_datadir}/applications/*%{name}.desktop
%{_icondir}/*/apps/%{name}.png
%{_gamesbindir}/%{name}
%dir %{_gamesdatadir}/parallelrealities
%{_gamesdatadir}/parallelrealities/%{name}.pak