SUMMARY="Addicting retro break-out game ported from the Amiga"
DESCRIPTION="A exciting Brick Breaker with 50 levels of game and 11 special \
levels, distributed on the 2 modes of game to give the player a sophisticated \
system of attack weapons with an enormous power of fire that can be build by \
gaining bonuses.
Numerous decors, musics and sounds complete this great game.
This game was ported from the Commodore Amiga. "
HOMEPAGE="https://linux.tlk.fr/games/TecnoballZ/"
REVISION="2"
COPYRIGHT="1991-2016 TLK Games"
LICENSE="GNU GPL v3"
srcGitRev="921c5c0ef8e245d5f7cf87dce19d89167413abf1"
SOURCE_URI="https://github.com/brunonymous/tecnoballz/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="a210f18a9b0c20e5d13fd80007f3e9d223b08ba0b244d878623e87d74c77f258"
SOURCE_FILENAME="tecnoballz-$portVersion.tar.gz"
SOURCE_DIR="tecnoballz-$srcGitRev"
PATCHES="tecnoballz-$portVersion.patchset"
ADDITIONAL_FILES="tecnoballz.rdef.in"

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

GLOBAL_WRITABLE_FILES="
	settings/tecnoballz/tecnoballz.hi keep-old
	"

PROVIDES="
	tecnoballz$secondaryArchSuffix = $portVersion
	app:TecnoballZ
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libmikmod$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libtinyxml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libmikmod$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	devel:libtinyxml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:awk
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	mv $appsDir/tecnoballz $appsDir/TecnoballZ

	local APP_SIGNATURE="application/x-vnd.teknoballz"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3 | cut -d~ -f1`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/tecnoballz.rdef.in > $sourceDir/tecnoballz.rdef
	addResourcesToBinaries $sourceDir/tecnoballz.rdef $appsDir/TecnoballZ
	addAppDeskbarSymlink $appsDir/TecnoballZ
}
