SUMMARY="A free version of the game Gish"
DESCRIPTION="FreeGish is an open-source, freely redistributable version of Gish, a \
physics-based platforming game featuring a ball of tar."
HOMEPAGE="https://github.com/freegish/freegish"
COPYRIGHT="2012-2014 Joris van de Donk"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="8795cd7adc95957883f2d3465eb9036a774667a7"
SOURCE_URI="https://github.com/freegish/freegish/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d19dfb679832e55fba50479455badc22e44e572131651198b7d9e411f7e589e8"
SOURCE_FILENAME="freegish-$portVersion-$srGitRev.tar.gz"
SOURCE_DIR="freegish-8795cd7adc95957883f2d3465eb9036a774667a7"
PATCHES="freegish-1.0.patchset"
ADDITIONAL_FILES="freegish.rdef"

ARCHITECTURES="?all"

PROVIDES="
	freegish = $portVersion
	app:FreeGish = $portVersion
	"
REQUIRES="
	haiku
	lib:libGL
	lib:libogg
	lib:libopenal
	lib:libpng16
	lib:libSDL_1.2
	lib:libvorbis
	lib:libz
	"

BUILD_REQUIRES="
	haiku_devel
	devel:libogg
	devel:libopenal
	devel:libpng16
	devel:libSDL
	devel:libvorbis
	devel:libz
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc
	cmd:make
	"

BUILD()
{
	mkdir -p build && cd build
	cmake .. -DCMAKE_INSTALL_PREFIX=$prefix \
		-DBIN_DIR=$appsDir \
		-DDATA_DIR=$dataDir/freegish \
		-DMAN_DIR=$manDir
	make
}

INSTALL()
{
	cd build
	make install
	rm -rf $prefix/share

	mv $appsDir/freegish $appsDir/FreeGish

	local MAJOR="1"
	local MIDDLE="0"
	local MINOR="0"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		$portDir/additional-files/freegish.rdef > freegish.rdef

	addResourcesToBinaries freegish.rdef \
		$appsDir/FreeGish

	addAppDeskbarSymlink $appsDir/FreeGish
}
