# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=tolua++
pkgver=1.0.93
pkgrel=2
pkgdesc="a tool to integrate C/C++ code with Lua"
url="http://www.codenix.com/~tolua/"
arch="all"
license="MIT"
depends=
makedepends="lua-dev"
install=
subpackages=
source="$pkgname-$pkgver.tar.gz::https://github.com/LuaDist/toluapp/archive/$pkgver.tar.gz"

_builddir="$srcdir"/toluapp-$pkgver

prepare() {
	cd "$_builddir"
}

build() {
	cd "$_builddir"/src
	# see http://lua-users.org/wiki/CompilingToluappWithoutScons
	gcc -fPIC -c lib/*.c  -I../include
	ar rcsv libtolua++.a *.o
	gcc bin/tolua.c bin/toluabind.c -I../include -L. -llua -ltolua++ \
		-o tolua++
}

package() {
	cd "$_builddir"/src
	install -d "$pkgdir"/usr/lib/ "$pkgdir"/usr/bin "$pkgdir"/usr/include
	install libtolua++.a "$pkgdir"/usr/lib/
	install tolua++ "$pkgdir"/usr/bin/
	install ../include/tolua++.h "$pkgdir"/usr/include/
}

md5sums="689d952034e55d4333fa240f7516e68a  tolua++-1.0.93.tar.gz"
sha256sums="0a1ff87cb74e7531aec57e2a7cfdf282116647dea3b46223e3cc7c362b55b5bb  tolua++-1.0.93.tar.gz"
sha512sums="68f169244f1b37fdeb1a72b0f8fc61a30329c0a828f46af718021c8cfa120fe15379b4b2bc10f0995de90e34735564afd6d302fa1865be60272e52e276e1114f  tolua++-1.0.93.tar.gz"
