SUMMARY="Open-source replacement for Quake 3 Arena"
DESCRIPTION="OpenArena is a free and open-source first-person shooter (FPS) computer game based \
heavily on the Quake III Arena-style deathmatch. The OpenArena project was established on August \
19, 2005, the day after the id Tech 3 GPL source code was released."
HOMEPAGE="http://openarena.ws/"
COPYRIGHT="OpenArena Team"
LICENSE="GNU GPL v2"
REVISION="5"
srcGitRev="e120f49e660aab5420e6acb3a5131992645f39c3"
SOURCE_URI="https://github.com/OpenArena/engine/archive/$srcGitRev.zip"
CHECKSUM_SHA256="5d92a0fab326bb5f80eb662e741add908bafc7b76ee023adf6846c86354b0d7c"
SOURCE_DIR="engine-$srcGitRev"
PATCHES="openarena-$portVersion.patchset"
ADDITIONAL_FILES="openarena.rdef"

ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	openarena = $portVersion
	app:OpenArena
	"
REQUIRES="
	openarena_data
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libxmp$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcurl$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libxmp$secondaryArchSuffix

	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:install
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:which
	"

BUILD()
{
	make $jobArgs USE_LOCAL_HEADERS=0
}

INSTALL()
{
	cd build/release*
	mkdir -p $appsDir/OpenArena
	cp openarena.* $appsDir/OpenArena/OpenArena
	cp oa_ded* $appsDir/OpenArena/OpenArena_dedicated
	addResourcesToBinaries $portDir/additional-files/openarena.rdef \
		$appsDir/OpenArena/OpenArena
	addAppDeskbarSymlink $appsDir/OpenArena/OpenArena OpenArena
}
