SUMMARY="Exterminate your opponent in a 2D environment with toon-style scenery"
DESCRIPTION="Have the mascots of your favorite free software battle in the \
Warmux arena. Using dynamite, grenades, baseball bats and other weapons... \
exterminate your opponent in a 2D toon style scenery and a funny environment.

Each player (2 minimum, on the same PC) controls the team of his choice (tux, \
gnu, firefox, wilder,...) and must destroy his adversary using more or less \
casual weapons.

Although a minimum of strategy is required to vanquish, Warmux is \
pre-eminently a \"convival mass murder\" game where, turn by turn, each \
member of each team attemps to produce a maximum of damage to his opponents."
HOMEPAGE="https://github.com/a-team/wormux"
COPYRIGHT="2001-2011 Warmux Team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="e0dc503460055a14a0d7fd94e66d7484264ee62b"
SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d5e66808de2e4912a64b583e3be4b8ea52cd220b8617a113507cca2c2291c6d3"
SOURCE_FILENAME="warmux-$srcGitRev.tar.gz"
SOURCE_DIR="wormux-$srcGitRev"
PATCHES="warmux-$portVersion.patch"

ARCHITECTURES="all !x86_gcc2 ?x86"
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$prefix/bin
fi

PROVIDES="
	warmux$secondaryArchSuffix = $portVersion
	app:Warmux = $portVersion
	cmd:warmux_list_games
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_gfx$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_net_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libintl$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_gfx$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_net_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	devel:libSDL_ttf_2.0$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage warmux$secondaryArchSuffix \
	"$appsDir/Warmux" \
	"$commandBinDir/warmux-list-games"

BUILD()
{
	export LIBS="-lnetwork"
	runConfigure --omit-dirs binDir ./configure \
		--bindir="$commandBinDir" \
		--build=x86 \
		--enable-fribidi
	make $jobArgs
}

INSTALL()
{
	make install
	install -m 755 -d "$appsDir" "$dataDir"
	mv "$prefix/share"/* "$dataDir"
	rm -rf "$dataDir/applications" "$dataDir/pixmaps" "$prefix/share"

	mv "$commandBinDir/warmux" "$appsDir/Warmux"
	addAppDeskbarSymlink "$appsDir/Warmux"
}
