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/"
COPYRIGHT="2010-2016 Löve"
LICENSE="Zlib"
REVISION="2"
SOURCE_URI="https://bitbucket.org/rude/love/downloads/love-$portVersion-linux-src.tar.gz"
CHECKSUM_SHA256="b26b306b113158927ae12d2faadb606eb1db49ffdcd7592d6a0a3fc0af21a387"
PATCHES="love-$portVersion.patchset"
ADDITIONAL_FILES="love.rdef.in"

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

PROVIDES="
	love$secondaryArchSuffix = $portVersion
	cmd:love$secondaryArchSuffix = $portVersion
	lib:liblove$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libIL$secondaryArchSuffix
	lib:libjasper$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libluajit_5.1$secondaryArchSuffix
	lib:libmng$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix
	lib:libmpg123$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libphysfs$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libtheora$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	love${secondaryArchSuffix}_devel = $portVersion
	devel:liblove$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	love$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libIL$secondaryArchSuffix
	devel:libjasper$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libluajit_5.1$secondaryArchSuffix
	devel:libmng$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix
	devel:libmpg123$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libphysfs$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:cmp
	cmd:dd
	cmd:diff
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	runConfigure ./configure

	make $jobArgs
}

INSTALL()
{
	make install

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		$portDir/additional-files/love.rdef.in > love.rdef

	addResourcesToBinaries love.rdef $binDir/love

	prepareInstalledDevelLib liblove
	packageEntries devel $developDir
}

TEST()
{
	make check
}
