SUMMARY="A drawing puzzle game in the spirit (and style?) of Crayon Physics"
DESCRIPTION="Harness gravity with your crayon and set about creating blocks, ramps, \
levers, pulleys and whatever else you fancy to get the little red thing to \
the little yellow thing."
HOMEPAGE="http://numptyphysics.garage.maemo.org"
COPYRIGHT="2008-2010 Tim Edmonds
	2008, 2012, 2014-2019 Thomas Perl"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/thp/numptyphysics/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="70347440adcacb3f1b02a2a73a4c23e8a76145a5e6e12237c7512a73b6000c5a"
PATCHES="numptyphysics-$portVersion.patchset"
ADDITIONAL_FILES="numptyphysics.rdef"

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

PROVIDES="
	numptyphysics$secondaryArchSuffix = $portVersion
	app:NumptyPhysics
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libBox2D$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libBox2D$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libSDL$secondaryArchSuffix
	devel:libSDL_image$secondaryArchSuffix
	devel:libSDL_ttf$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	make PLATFORM=sdl1 PREFIX=$appsDir/NumptyPhysics OBJ_DIR=objects $jobArgs
}

INSTALL()
{
	make PLATFORM=sdl1 PREFIX=$appsDir/NumptyPhysics install

	mv $appsDir/NumptyPhysics/bin/numptyphysics "$appsDir/NumptyPhysics/Numpty Physics"
	mv $appsDir/NumptyPhysics/data/numptyphysics/* $appsDir/NumptyPhysics/data
	rm -rf $appsDir/NumptyPhysics/{bin,data/numptyphysics}

	addResourcesToBinaries $portDir/additional-files/numptyphysics.rdef "$appsDir/NumptyPhysics/Numpty Physics"

	addAppDeskbarSymlink "$appsDir/NumptyPhysics/Numpty Physics"
}
