SUMMARY="2D and 3D cross-platform game engine"
DESCRIPTION="Godot Engine is a feature-packed, cross-platform game engine \
to create 2D and 3D games from a unified interface. It provides a \
comprehensive set of common tools, so that users can focus on making \
games without having to reinvent the wheel. Games can be exported in one \
click to a number of platforms, including the major desktop platforms \
(Linux, Mac OSX, Windows) as well as mobile (Android, iOS) and web-based \
(HTML5) platforms."
HOMEPAGE="https://godotengine.org/"
COPYRIGHT="2007-2017 Juan Linietsky, Ariel Manzur"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://github.com/godotengine/godot/archive/$portVersion-stable.tar.gz"
CHECKSUM_SHA256="5bfc57f2ee24dccfdcefe491a3be1a07b39299f2fcfa03202b8b4c6c2dd5122b"
SOURCE_DIR="godot-$portVersion-stable"
PATCHES="godot-$portVersion.patchset"

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

PROVIDES="
	godot$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
#	lib:libfreetype$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libglew$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libmpcdec$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
#	lib:libopus$secondaryArchSuffix
#	lib:libopusfile$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
#	lib:libspeex$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libtheora$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
#	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libglew$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libmpcdec$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
#	devel:libopus$secondaryArchSuffix
#	devel:libopusfile$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
#	devel:libspeex$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:python
	cmd:scons
	"

BUILD()
{
	scons $jobArgs \
		build=release \
		platform=haiku \
		builtin_glew=no \
		builtin_libmpcdec=no \
		builtin_libogg=no \
		builtin_libpng=no \
		builtin_libtheora=no \
		builtin_libvorbis=no \
		builtin_libwebp=no \
		builtin_openssl=no \
		builtin_zlib=no \
		unix_global_settings_path=`finddir B_USER_SETTINGS_DIRECTORY`/Godot
		#builtin_speex=no
		#builtin_opus=no
		#builtin_freetype=no
		#builtin_squish=no
}

INSTALL()
{
	mkdir -p $appsDir/Godot
	mv bin/godot.haiku.tools* $appsDir/Godot/Godot

	addAppDeskbarSymlink $appsDir/Godot/Godot "Godot"
}
