SUMMARY="A futuristic real time strategy game"
DESCRIPTION="Bos Wars is a futuristic real time strategy game (RTS). In a RTS \
game, the player has to combat his enemies while developing his war economy. \
Everything runs in real-time, as opposed to turn-based games, where the player \
always has to wait for his turn. The trick is to balance the effort put into \
building the economy and building an army to defend and attack the enemies.

Bos Wars has a dynamic rate based economy. Energy is produced by power plants \
and magma gets pumped from hot spots. Buildings and mobile units are also \
built at a continuous rate. Control of larger parts of the map creates the \
potential to increase your economy throughput. Holding key points like roads \
and passages allow for different strategies.

It is possible to play against human opponents over LAN, internet, or against \
the computer. Bos Wars successfully runs under Linux, MS Windows, BSD, Mac OS \
X, and Haiku."
HOMEPAGE="https://www.boswars.org/"
COPYRIGHT="2004-2014 Tina Petersen Jensen, Francois Beerten et al."
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://www.boswars.org/dist/releases/boswars-$portVersion-src.tar.gz"
CHECKSUM_SHA256="dc3718f531e9ea413cf37e1333b62a4c5e69f1405502d9c59b9e424635135e3e"
SOURCE_FILENAME="boswars-$portVersion.tar.gz"
SOURCE_DIR="boswars-$portVersion-src"
PATCHES="boswars-$portVersion.patchset"

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

PROVIDES="
	boswars$secondaryArchSuffix = $portVersion
	app:BosWars = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:liblua$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libtheora$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGLU$secondaryArchSuffix
	devel:liblua5.1$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:python2
	"

defineDebugInfoPackage boswars$secondaryArchSuffix \
	"$appsDir/BosWars"

PATCH()
{
	# Some of the PNGs don't work with the current libraries
	# so we must fix them with pngfix
	set -- maps/antarticum.map/terrain.png graphics/ui/ui_*.png \
		units/radar/radar*.png units/tree*/tree*.png
	pngfix --suffix=.fixed "$@" || :
	for f; do
		mv "$f.fixed" "$f"
	done
}

BUILD()
{
	./make.py $jobArgs
}

INSTALL()
{
	install -d "$appsDir" "$dataDir/boswars" "$docDir"
	install -m 755 fbuild/release/boswars "$appsDir/BosWars"
	addAppDeskbarSymlink "$appsDir/BosWars" "Bos Wars"

	cp -r campaigns graphics intro languages maps patches scripts sounds \
		units "$dataDir/boswars"
	cp -r doc/* "$docDir"
}
