SUMMARY="An online multiplayer 3D tank battle game"
DESCRIPTION="BZFlag is a free online multiplayer 3D tank battle game. The name \
originates from \"Battle Zone Capture The Flag\". It runs on Windows, Mac OSX, \
Linux, BSD, and other platforms. It was one of the most popular games ever on \
Silicon Graphics machines and continues to be developed and improved to this \
day."
HOMEPAGE="https://www.bzflag.org/"
COPYRIGHT="1993-2021 Tim Riker"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://download.bzflag.org/bzflag/source/$portVersion/bzflag-$portVersion.tar.bz2"
CHECKSUM_SHA256="9e64653302b657bd8b5f96fe1150a9ff80a1d53a6d7e8a35138c6b1b02006a4d"
PATCHES="bzflag-$portVersion.patchset"

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

if [ "$targetArchitecture" != x86_gcc2 ]; then
	commandSuffix=$secondaryArchSuffix
	commandBinDir=$binDir
else
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	bzflag$secondaryArchSuffix = $portVersion
	cmd:bzadmin$commandSuffix
	cmd:bzfs$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcares$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libnghttp2$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcares$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:autoheader
	cmd:gawk
	cmd:g++$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal -I m4
	autoconf
	automake --add-missing
	runConfigure --omit-dirs "binDir libDir" ./configure \
		--bindir=$commandBinDir \
		--libdir=$libDir/bzflag \
		--enable-robots
	make $jobArgs
}

INSTALL()
{
	make install-strip

	rm $libDir/bzflag/*.la
}

TEST()
{
	make check
}
