SUMMARY="A deployment and management system for Lua modules"
DESCRIPTION="LuaRocks allows you to install modules as self-contained \
packages called rocks, which also contain version dependency information."
HOMEPAGE="https://luarocks.org"
COPYRIGHT="2007-2014 Kepler Project"
LICENSE="MIT"
REVISION="3"
SOURCE_URI="https://luarocks.org/releases/luarocks-$portVersion.tar.gz"
CHECKSUM_SHA256="0e1ec34583e1b265e0fbafb64c8bd348705ad403fe85967fd05d3a659f74d2e5"
SOURCE_DIR="luarocks-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

GLOBAL_WRITABLE_FILES="
	settings/config-5.3.lua keep-old
	"

PROVIDES="
	luarocks$secondaryArchSuffix = $portVersion
	cmd:luarocks$secondaryArchSuffix = $portVersion
	cmd:luarocks_5.3$secondaryArchSuffix = $portVersion
	cmd:luarocks_admin$secondaryArchSuffix = $portVersion
	cmd:luarocks_admin_5.3$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liblua$secondaryArchSuffix >= 5.3
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:liblua$secondaryArchSuffix >= 5.3
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:lua5.3$secondaryArchSuffix
	cmd:make
	cmd:md5sum
	cmd:sed
	cmd:wget
	"

BUILD()
{
	./configure --prefix=$prefix \
		--with-lua-include="$(finddir B_SYSTEM_HEADERS_DIRECTORY)$secondaryArchSubDir/lua53" \
		--sysconfdir=$settingsDir \
		--rocks-tree=/boot/home/config/non-packaged/data \
		--versioned-rocks-dir \
		--force-config
	make build
}

INSTALL()
{
	make BINDIR=$binDir LUADIR=$libDir/lua/5.3 install
}
