# Contributor: Curtis Smith <kman922002@gmail.com>
pkgname=odamex-svn
pkgver=477
pkgrel=5
pkgdesc="A free client/server multiplayer game engine for the classic FPS Doom"
arch=(i686 x86_64)
url="http://odamex.net/"
license="GPL"
conflicts=('odamex')
provides=('odamex')
depends=('wxgtk' 'sdl' 'sdl_mixer>=1.2.6')
makedepends=('subversion')
source=(odamex.desktop \
	odasrv.desktop \
        odalaunch.desktop )
md5sums=('b353a68ffb46a61c27272367e625ce50'
         '937a0effa783659dd2c38f3c3ae109f7'
         '0e1555286931a74c172582714756298f')

_svntrunk=http://odamex.net/svn/root/trunk/
_svnmod=odamex

build() {
cd $startdir/src
  msg "Connecting to SVN server..."
  msg "Checking out $_svnmod"
  yes "p" | svn co $_svntrunk $_svnmod
  msg "SVN checkout done or server timeout"
  msg "Starting build..."
  cp -r $_svnmod $_svnmod-build
  cd $_svnmod-build
# fix cflags
sed -i 's/-O2/-O0/g' $startdir/src/$_svnmod-build/Makefile
# change iwad directory
sed -i 's|getenv("DOOMWADDIR")|"/usr/share/doom"|g' {client,server}/src/d_main.cpp

make || return 1
make INSTALLDIR=$startdir/pkg/usr/bin install

cd $startdir/src/$_svnmod-build/odalaunch
make || return 1
cd $startdir/src/$_svnmod-build/

mkdir -p $startdir/pkg/usr/share/applications
install -m755 -D odalaunch/odalaunch $startdir/pkg/usr/bin/odalaunch
install -m644 -D odamex.wad $startdir/pkg/usr/share/doom/odamex.wad
install -m644 -D media/icon_odamex_96.png $startdir/pkg/usr/share/pixmaps/odamex.png
install -m644 -D media/icon_odasrv_96.png $startdir/pkg/usr/share/pixmaps/odasrv.png
install -m644 -D media/icon_odalaunch_96.png $startdir/pkg/usr/share/pixmaps/odalaunch.png
install -m644 $startdir/oda{mex,srv,launch}.desktop $startdir/pkg/usr/share/applications

}

