# Template file for 'warsow'
pkgname=warsow
version=2.1
revision=2
build_wrksrc="source/source"
build_style=cmake
configure_args="-DQFUSION_GAME=Warsow"
make_cmd=make
hostmakedepends="pkg-config"
makedepends="libcurl-devel libvorbis-devel libtheora-devel libjpeg-turbo-devel
 libopenal-devel MesaLib-devel libXi-devel libXxf86dga-devel
 fontconfig-devel SDL2-devel"
# libopenal is dlopen(3)ed at runtime.
depends="desktop-file-utils warsow-data>=2.1 libopenal"
short_desc="Free online multiplayer competitive FPS based on the Qfusion engine"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="http://www.warsow.net/"
distfiles="http://warsow.net/warsow_${version/./}_sdk.tar.gz"
checksum=99c88bc08f5e6055d28534de6e84fc204026dda51dc31e22caca1977f199453a

archs="i686* x86_64*"

export CMAKE_GENERATOR="Unix Makefiles"

CFLAGS="-fcommon"

do_install() {
	# Move Compiled Data to Destination Directory
	vmkdir usr/lib/warsow

	case "$XBPS_TARGET_MACHINE" in
		x86_64*) _arch=x86_64 ;;
		i686*) _arch=i686 ;;
	esac

	vinstall "build/warsow.$_arch"       0755 /usr/lib/warsow warsow
	vinstall "build/wsw_server.$_arch"   0755 /usr/lib/warsow wsw_server
	vinstall "build/wswtv_server.$_arch" 0755 /usr/lib/warsow wswtv_server
	vcopy "build/basewsw" usr/lib/warsow
	vcopy "build/libs" usr/lib/warsow

	vbin ${FILESDIR}/warsow.launcher warsow
	vbin ${FILESDIR}/wsw-server.launcher wsw-server
	vbin ${FILESDIR}/wswtv-server.launcher wswtv-server
	vinstall ${FILESDIR}/warsow.desktop 644 usr/share/applications
	vinstall ${FILESDIR}/warsow.png 644 usr/share/pixmaps
}
