SUMMARY="A framework to make 2D games in Lua"
DESCRIPTION="LÖVE is a framework to make 2D games in Lua.
It's free, open-source, and works also on Windows, Mac OS X and Linux."
HOMEPAGE="http://love2d.org/"
LICENSE="Zlib"
REVISION="1"

ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

SOURCE_URI="https://bitbucket.org/rude/love/downloads/love-$portVersion-linux-src.tar.gz"
CHECKSUM_SHA256="04dd0946bd82ec839c454c161bf0e5da870f393af62d09dc229990f5176833de"
COPYRIGHT="2010-2014 Löve"
PATCHES="love-$portVersion.patchset"

PROVIDES="
	love$secondaryArchSuffix = $portVersion
	cmd:love$secondaryArchSuffix = $portVersion
	lib:liblove$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix >= 0.8.0
	lib:libphysfs$secondaryArchSuffix
	lib:libluajit_5.1$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libIL$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libmpg123$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libmng$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libjasper$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	"
PROVIDES_devel="
	love${secondaryArchSuffix}_devel = $portVersion
	devel:liblove$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	love$secondaryArchSuffix == $portVersion base
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL2$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix >= 0.8.0
	devel:libphysfs$secondaryArchSuffix
	devel:libluajit_5.1$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libIL$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libmpg123$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libmng$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libjasper$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:awk
	"

BUILD()
{
	runConfigure ./configure
	# The pkg-config for freetype doesn't give this directory, which means
	# there is no good way of finding it...
	make $jobArgs CXXFLAGS="-I/system/develop/headers/x86/freetype2/ --std=c++11"
}

INSTALL()
{
	make install

	prepareInstalledDevelLib liblove
	packageEntries devel $developDir
}

TEST()
{
	make check
}
