Name:		glob2
Version:	0.8.19
Release:	5%{?dist}
Summary:	A realtime strategy game with a different approach on micromanagement

Group:		Amusements/Games
License:	GPL
URL:		http://www.globulation2.org
Source:		http://globulation2.org/releases/0.8.19/glob2-0.8.19.tar.gz
Patch:		glob2-0.8.19-extra-qualification-fix.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	SDL_ttf-devel SDL_image-devel SDL_net-devel
BuildRequires:	speex-devel freetype-devel boost-devel
BuildRequires:	mesa-libGLU-devel mesa-libGL-devel
BuildRequires:	libXext-devel libXxf86vm-devel libjpeg-devel libpng-devel
BuildRequires:	libvorbis-devel libXau-devel libXdmcp-devel desktop-file-utils
# The configure scripts looks for automake14 and the test fails
# if a new version is installed instead of 1.4

# Unsure if this is really necessary, next 'mocking' will confirm

%description
Globulation 2 is a realtime strategy game
with a different approach on micromanagement.
You control a swarm of globs that need to grow and fight enemies.

%prep
%setup -q
%patch -p 1
chmod -x src/*.cpp src/*.h


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
for i in $RPM_BUILD_ROOT%{_datadir}/pixmaps/glob2-*.png; do
	# Takes the XXxYY.png from the filename and then remove the .png
	# getting only the XXxYY token.
	SIZE=`basename $i | cut -d- -f3 | cut -d. -f1`
	mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/$SIZE/apps
	mv $RPM_BUILD_ROOT%{_datadir}/pixmaps/glob2-icon-$SIZE.png \
		$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/$SIZE/apps/glob2.png
done
rm -R $RPM_BUILD_ROOT%{_datadir}/pixmaps/
# Fixes the desktop file icon name
sed -i "s@Icon=glob2-icon-48x48.png@Icon=glob2.png@" \
	${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop
desktop-file-install --delete-original --vendor fedora \
	--dir ${RPM_BUILD_ROOT}%{_datadir}/applications --add-category X-Fedora \
	${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/AUTHORS


%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
	%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
	%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc COPYING README AUTHORS
%{_bindir}/glob2
%{_datadir}/applications/fedora-glob2.desktop
%{_datadir}/%{name}
%{_datadir}/icons/hicolor/*/apps/glob2.png

%changelog
* Sat Jul 08 2006 Nikolai <brkamikaze at gmail.com> 0.8.19-5%{?dist}
- Just a fine tuning on the spec, like adding spacing on the ChangeLog.
- Removed the '-Rc' parameter from the chmod, because no recursion is needed and no verboseness too.

* Tue Jul 06 2006 Nikolai <brkamikaze at gmail.com> 0.8.19-4%{?dist}
- Figured out how to get rid of the 'no-version-in-last-changelog' error.
- Trimmed every line to 80 characters tops, except the changelog ones. Two lines weren't trimmable, but they're ok, I guess.
- Fixed error when not building as root
- Install all icons on the proper location

* Thu Jul 04 2006 Nikolai <brkamikaze at gmail.com> 0.8.19-3%{?dist}
- Fixed almost all rpmlint errors; can't figure out how to get rid of the 'no-version-in-last-changelog' error.
- Fixed the desktop file and the icons to use more standard standards :-)

* Tue Jun 27 2006 Nikolai <brkamikaze at gmail.com> 0.8.19-2%{?dist}
- Added the automake14 to BuildRequires to help 'mocking' the package.

* Sun May 7 2006 Nikolai <brkamikaze at gmail.com> 0.8.19-1%{?dist}
- First created.