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-2018 Juan Linietsky, Ariel Manzur"
LICENSE="MIT"
REVISION="5"
SOURCE_URI="https://github.com/godotengine/godot/archive/$portVersion-stable.tar.gz"
CHECKSUM_SHA256="50431e021ee5ec21002cc23435f530f8fde518c6eb7085c9f7f1027abaae2581"
SOURCE_DIR="godot-$portVersion-stable"
PATCHES="godot-3.0.6.patchset"

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

PROVIDES="
	godot$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libenet$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:libpcre2_32$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libspeex$secondaryArchSuffix
	lib:libtheora$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvpx$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libenet$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:libpcre2_32$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libspeex$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvpx$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix >= 7
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:python
	cmd:scons
	cmd:yasm
	"

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

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

	addAppDeskbarSymlink $appsDir/Godot/Godot "Godot"
}
