File blobAndConquer.spec of Package blobAndConquer

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

Name:			blobAndConquer
Version:		1.11
Summary:		Blob Wars : Episode II
License:		GPLv2
URL:			http://www.parallelrealities.co.uk/projects/blobAndConquer.php
Group:			Games/Arcade
Release:		1
Source0:		%{name}-%{version}-1.tar.gz
Source1:		%{name}-icons.tar
Patch0:			blobAndConquer-1.11_makefile.patch
BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:		desktop-file-utils
BuildRequires:		hicolor-icon-theme
BuildRequires:		gcc-c++
BuildRequires:		pkg-config
BuildRequires:		update-desktop-files
BuildRequires:  	Mesa-devel
BuildRequires:  	freeglut-devel
BuildRequires:		SDL-devel
BuildRequires:		SDL_image-devel
BuildRequires:		SDL_mixer-devel
BuildRequires:		SDL_ttf-devel
BuildRequires:		SDL_net-devel
BuildRequires:		zlib-devel
Requires:		hicolor-icon-theme

%description
With the apparent defeat of Galdov and the reclaiming of the Fire, Time, Space
and Reality Crystals the Blobs' battle was only just beginning. Bob had rescued
many Blobs and fought many battles, but now he had an ever bigger task ahead of
him. The Blobs' homeworld is still littered with the alien forces and Bob once
again makes it his task to lead the counter attack. But even without Galdov the
aliens are still extremely well organised...


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


%build
export CFLAGS="${CFLAGS} %{optflags}"
%{__make} %{?jobs:-j%jobs} VERSION=%{version} RELEASE=%{release} DOCDIR=%{_docdir}/%{name}/ ICONDIR=%{_icondir}/


%install
./pak data gfx music sound textures %{name}.pak                                                                             

mkdir -p %{buildroot}/%{_gamesbindir}
mkdir -p %{buildroot}/%{_gamesdatadir}/%{name}
mkdir -p %{buildroot}/%{_icondir}/16x16/apps
mkdir -p %{buildroot}/%{_icondir}/32x32/apps
mkdir -p %{buildroot}/%{_icondir}/64x64/apps
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/locale/pl/LC_MESSAGES
install -m 755 %{name} %{buildroot}/%{_gamesbindir}/%{name}
install -m 644 %{name}.pak %{buildroot}/%{_gamesdatadir}/%{name}/%{name}.pak
install -m 644 icons/%{name}-large.png %{buildroot}/%{_icondir}/64x64/apps/%{name}.png
install -m 644 icons/%{name}.png %{buildroot}/%{_icondir}/32x32/apps/%{name}.png
install -m 644 icons/%{name}-mini.png %{buildroot}/%{_icondir}/16x16/apps/%{name}.png

pushd locale
for f in *.po
do
	if [ "${f}" == "*.po" ]
	then
		break
	fi
	lang=$(echo ${f} | sed -e 's/\.po$//')
	mkdir -p %{buildroot}%{_datadir}/locale/${lang}/LC_MESSAGES/
	install -m 644 ${f} %{buildroot}%{_datadir}/locale/${lang}/LC_MESSAGES/%{name}.mo
done
popd

cat <<_EOF_ >icons/%{name}.desktop
[Desktop Entry]
Name=Blob Wars : Episode II
Comment=Blob Wars : Episode II
Type=Application
Categories=Game;ArcadeGame;
Exec=%{name}
Icon=%{name}
Terminal=false
_EOF_

install -D -m644 icons/%{name}.desktop %{buildroot}/%{_datadir}/applications/%{name}.desktop
%suse_update_desktop_file -i %{name}

%find_lang %{name}

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

%files -f %{name}.lang
%defattr(-,root,root)
%doc doc/*
%{_datadir}/applications/*%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%dir %{_gamesdatadir}/%{name}
%attr(-,root,games) %{_gamesbindir}/%{name}
%attr(-,root,games) %{_gamesdatadir}/%{name}/%{name}.pak

%changelog
* Wed Jun 30 2010 David Bolt <davjam@davjam.org> 1.11
- First package for openSUSE