# Template file for 'xonotic'
pkgname=xonotic
version=0.6.0
wrksrc="Xonotic"
homepage="http://xonotic.org"
license="GPL-2, GPL-3"
distfiles="http://dl.xonotic.org/xonotic-${version}-source.zip"
depends="desktop-file-utils xonotic-data>=0.6.0"
makedepends="unzip gmp-devel MesaLib-devel SDL-devel libcurl-devel alsa-lib-devel libmodplug-devel libvorbis-devel libXpm-devel jpeg-devel"
revision=1
short_desc="A free, fast-paced crossplatform first-person shooter"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=5cdf60597631d126cb8f2b0dae086075152b553da11353463ea828cb0cce3c98
long_desc="
 This is Xonotirc, $short_desc."



do_build() {
	make ${makejobs} -C source/darkplaces CPUOPTIMIZATIONS="${CFLAGS}" \
		DP_FS_BASEDIR=/usr/share/xonotic/ DP_LINK_TO_LIBJPEG=1 cl-release
	make ${makejobs} -C source/darkplaces CPUOPTIMIZATIONS="${CFLAGS}" \
		DP_FS_BASEDIR=/usr/share/xonotic/ DP_LINK_TO_LIBJPEG=1 sdl-release
	make ${makejobs} -C source/darkplaces CPUOPTIMIZATIONS="${CFLAGS}" \
		DP_FS_BASEDIR=/usr/share/xonotic/ DP_LINK_TO_LIBJPEG=1 sv-release

	cd source/d0_blind_id
	./configure --prefix=/usr --disable-rijndael
	make ${makejobs}
}

do_install() {
	# binaries
	vinstall source/darkplaces/darkplaces-dedicated 755 usr/bin xonotic-dedicated
	vinstall source/darkplaces/darkplaces-glx 755 usr/bin xonotic-glx
	vinstall source/darkplaces/darkplaces-sdl 755 usr/bin xonotic-sdl

	# convenience files
	vmkdir usr/share/applications
	install -Dm644 $FILESDIR/*.desktop -t $DESTDIR/usr/share/applications
	install -Dm644 misc/logos/icons_png/xonotic_512.png \
		$DESTDIR/usr/share/pixmaps/xonotic.png

	# crypto stuff
	cd source/d0_blind_id
	make DESTDIR=$DESTDIR install

	# Remove devel stuff
	rm -rf $DESTDIR/usr/include $DESTDIR/usr/lib/pkgconfig $DESTDIR/usr/lib/*.a
}