SUMMARY="An extension of toLua, a tool to integrate C/Cpp code with Lua"
DESCRIPTION="tolua++ is an extension of toLua, a tool to integrate C/C++ code with \
Lua. tolua++ includes new features oriented to c++, such as class templates."
HOMEPAGE="https://github.com/LuaDist/toluapp"
COPYRIGHT="2009 Ariel Manzur"
LICENSE="MIT"
REVISION="1"
srcGitRev="b34075b76835b778bb6b2ce0aa224afd9d182887"
SOURCE_URI="https://github.com/LuaDist/toluapp/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="a86eada2ec3fcc162d2986686eba36e51d095aa471b898d4c641715423310974"
SOURCE_FILENAME="toluapp-$portVersion-$srcGitRev.tar.gz"
SOURCE_DIR="toluapp-$srcGitRev"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	tolua++$secondaryArchSuffix = $portVersion
	cmd:tolua++$secondaryArchSuffix = $portVersion
	lib:libtolua++$secondaryArchSuffix = $portVersion
	lib:libtoluapp$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liblua$secondaryArchSuffix >= 5.1
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:liblua$secondaryArchSuffix >= 5.1
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cmake . -DLUA_INCLUDE_DIR="`pkg-config --variable=includedir lua`" \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DCMAKE_INSTALL_BINDIR=$binDir \
		-DCMAKE_INSTALL_INCLUDEDIR=$includeDir \
		-DCMAKE_INSTALL_LIBDIR=$libDir \
		-DCMAKE_INSTALL_MANDIR=$manDir \
		-DCMAKE_BUILD_TYPE=Release
	make
}

INSTALL()
{
	mkdir -p $includeDir
	mkdir -p $binDir
	mkdir -p $libDir
	cp include/tolua++.h $includeDir/
	cp toluapp $binDir/tolua++
	cp libtoluapp.so $libDir/libtolua++.so
	cp libtoluapp.so $libDir/libtoluapp.so
}
