%define origname sauerbraten_2009_05_04_trooper_edition_linux
Name: sauerbraten
Version: 0.0
Release: alt0
Summary: Cube 2: Sauerbraten is a free multiplayer/singleplayer first person shooter, built as a major redesign of the Cube FPS

Group: Games/Other
License: GPL
Packager: Andrew Clark <andyc@altlinux.ru>
Url: http://sauerbraten.org/
Source0: http://downloads.sourceforge.net/sauerbraten/%origname.tar.bz2
Patch0: %name-makefile.patch

# Automatically added by buildreq on Mon Jun 08 2009
BuildRequires: gcc-c++ libGL-devel libSDL-devel libSDL_image-devel libSDL_mixer-devel libX11-devel zlib-devel

%description
Cube 2: Sauerbraten is a free multiplayer/singleplayer first person shooter, built as a major redesign of the Cube FPS

%prep
%setup -q -n %name
%patch0 -p1

%build
%make -C src/

%install
mkdir -p %buildroot%_bindir

cat <<EOF> %buildroot%_bindir/sauerbraten_client
#!/bin/sh

SAUER_DATA=/usr/share/games/sauerbraten
SAUER_BIN=/usr/bin/sauer_client
SAUER_OPTIONS="-q${HOME}/.sauerbraten -r"

cd %_datadir/games/%name
exec %_bindir/sauer_client -q`cd ~`/.sauerbraten -r "$@"
EOF

cat <<EOF> %buildroot%_bindir/sauerbraten_server

#!/bin/sh
SAUER_DATA=/usr/share/games/sauerbraten
SAUER_SERV_BIN=/usr/bin/sauer_server
SAUER_SERV_OPTIONS="-q${HOME}/.sauerbraten"

cd %_datadir/games/%name
exec %_bindir/sauer_client -q`cd ~`/.sauerbraten -r "$@"
EOF

chmod +x %buildroot%_bindir/sauerbraten_client
chmod +x %buildroot%_bindir/sauerbraten_server

mkdir -p %buildroot%_datadir/doc/%name/
mkdir -p %buildroot%_datadir/games/%name/
mv %_builddir/%name/src/sauer_client %buildroot%_bindir/
mv %_builddir/%name/src/sauer_server %buildroot%_bindir/
mv %_builddir/%name/docs %buildroot/%_datadir/doc/%name/
mv %_builddir/%name/README.html %buildroot/%_datadir/doc/%name/
mv %_builddir/%name/server-init.cfg %buildroot/%_datadir/games/%name/
mv %_builddir/%name/data/ %buildroot/%_datadir/games/%name/
mv %_builddir/%name/packages %buildroot/%_datadir/games/%name/

%files
%_bindir/*
%_datadir/doc/%name
%_datadir/games/%name

%changelog
* Mon Jun  8 2009 Andrew Clark <andyc@altlinux.ru> 0.0-alt0
- initial build for ALT.

