SUMMARY="A action-puzzle game, similar to tetris"
DESCRIPTION="Amoebax is a cute and addictive action-puzzle game. \
Due an awful mutation, some amoeba's species have started to multiply \
until they take the world if you can't stop them. Fortunately the \
mutation made then too unstable and lining up four or more will make \
them disappear."
HOMEPAGE="http://www.emma-soft.com/games/amoebax/"
COPYRIGHT="2006-2007 Jordi Fita (Code), Safareig Creatiu (Graphics), Àlex \
Almarza (Music & Sound), Ferran Brugat (Web Page)"
LICENSE="GNU GPL v2
    LALv1.2"
REVISION="3"
SOURCE_URI="http://www.emma-soft.com/games/amoebax/download/amoebax-$portVersion.tar.bz2"
CHECKSUM_SHA256="709c7e657b328a6f7d331298c6264f172528489d28cab107c40c483c392340b2"
PATCHES="amoebax-$portVersion.patchset"
ADDITIONAL_FILES="amoebax.rdef"

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

PROVIDES="
	amoebax$secondaryArchSuffix = $portVersion
	app:AmoeBax = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL$secondaryArchSuffix
	devel:libSDL_image$secondaryArchSuffix
	devel:libSDL_mixer$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	libtoolize -fci
	runConfigure --omit-dirs binDir \
		./configure --bindir=$appsDir \
		--disable-dependency-tracking
}

INSTALL()
{
	make install
	mv $appsDir/amoebax $appsDir/AmoeBax
	rm -rf $dataDir/{applications,pixmaps}

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		$portDir/additional-files/amoebax.rdef > amoebax.rdef

	addResourcesToBinaries amoebax.rdef \
		$appsDir/AmoeBax

	addAppDeskbarSymlink $appsDir/AmoeBax
}
