SUMMARY="A brick-matching puzzle-game"
DESCRIPTION="Wizznic! is a brick-matching puzzle-game, an improved version of \
Puzznic.

The challenge is to clear each level of bricks by moving the bricks next to \
each other, this sounds a lot easier than it is. The bricks are heavy, so you \
can only push them, not lift them up."
HOMEPAGE="http://wizznic.org/"
COPYRIGHT="2011-2020 Jimmy Christensen"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/DusteDdk/Wizznic/archive/refs/tags/1.1.tar.gz"
CHECKSUM_SHA256="6de6d8c1c6f7e7d62e303cf94e966d4f23c23ed252ccf39b68fbaf508fe8aed6"
SOURCE_FILENAME="wizznic-$portVersion.tar.gz"
SOURCE_DIR="Wizznic-$portVersion"
PATCHES="wizznic-$portVersion.patchset"

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

# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	wizznic$secondaryArchSuffix = $portVersion
	cmd:wizznic$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

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

BUILD()
{
	DATADIR=$dataDir/wizznic/ \
		BINDIR=$commandBinDir/ \
		WITH_OPENGL=false \
		CFLAGS=`sdl-config --cflags` make -f Makefile.linux
}

INSTALL()
{
	DATADIR=$dataDir/wizznic/ \
		BINDIR=$commandBinDir/ \
		make -f Makefile.linux install

	install -d $manDir/man6
	install -m 644 doc/wizznic.6 $manDir/man6

	addAppDeskbarSymlink $commandBinDir/wizznic "WizzNic!"
}
