%define origname AssaultCube_v1.0.2
Name: assaultcube
Version: 1.0.2
Release: alt0
Summary: free first-person-shooter based on the game Cube

Group: Games/Other
License: GPL
Packager: Andrew Clark <andyc@altlinux.ru>
Url: http://assault.cubers.net/
Source0: http://assault.cubers.net/download.html/%origname.tar.bz2
Patch0: %name-%version-makefile.patch

# Automatically added by buildreq on Tue Jun 09 2009
BuildRequires: gcc-c++ libGL-devel libSDL-devel libSDL_image-devel libX11-devel libopenal-devel libvorbis-devel zlib-devel

%description
AssaultCube,formerly ActionCube, is a free first-person-shooter based on the game Cube.
Set in a realistic looking environment, as far as that´s possible with this engine, while
gameplay stays fast and arcade. This game is all about team oriented multiplayer fun.

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

%build
%make -C source/src

%install
mkdir -p %buildroot%_bindir

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

CUBE_DATA=/usr/share/games/assaultcube
CUBE_BIN=/usr/bin/ac_client
CUBE_OPTIONS="--home=${HOME}/.assaultcube_v1.0 --init"

cd %_datadir/games/%name
exec %_bindir/ac_client -home`cd ~`/.assaultcube_v1.0 --init
EOF

cat <<EOF> %buildroot%_bindir/assaultcube_server

#!/bin/sh
CUBE_DATA=/usr/share/games/assaultcube
CUBE_SERV_BIN=/usr/bin/ac_server
CUBE_SERV_OPTIONS=""

cd %_datadir/games/%name
exec %_bindir/ac_server 
EOF

chmod +x %buildroot%_bindir/assaultcube_client
chmod +x %buildroot%_bindir/assaultcube_server

mkdir -p %buildroot%_datadir/doc/%name/
mkdir -p %buildroot%_datadir/games/%name/
mv %_builddir/%origname/source/src/ac_client %buildroot%_bindir/
mv %_builddir/%origname/source/src/ac_server %buildroot%_bindir/
mv %_builddir/%origname/docs %buildroot/%_datadir/doc/%name/
mv %_builddir/%origname/mods %buildroot/%_datadir/doc/%name/
mv %_builddir/%origname/README.html %buildroot/%_datadir/doc/%name/
mv %_builddir/%origname/config %buildroot/%_datadir/games/%name/
mv %_builddir/%origname/bot/ %buildroot/%_datadir/games/%name/
mv %_builddir/%origname/packages %buildroot/%_datadir/games/%name/

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

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

