# Maintainer: Guilherme Felipe da Silva pkgname=lua-etlua _rockname="${pkgname#lua-}" pkgver=1.3.0 pkgrel=1 pkgdesc="Embedded Lua templates" url="https://github.com/leafo/etlua" license="MIT" arch="all" makedepends="luarocks" checkdepends="lua-busted moonscript" source="$_rockname-$pkgver.tar.gz::https://github.com/leafo/$_rockname/archive/v$pkgver.tar.gz" builddir="$srcdir/$_rockname-$pkgver" case "$CARCH" in aarch64) _luajit="";; *) checkdepends="$checkdepends luajit" _luajit="jit";; esac _luaversions="5.1 5.2" for _v in $_luaversions; do makedepends="$makedepends lua$_v-dev luarocks$_v" subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage" checkdepends="$checkdepends lua$_v lua$_v-busted" done build() { local lver; for lver in $_luaversions; do msg "Building for Lua $lver..." luarocks-$lver \ --deps-mode=none \ LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \ LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \ make --tree="./build" \ "$_rockname-dev-1.rockspec" rm "./build/lib/luarocks/rocks-$lver/manifest" done } check() { mkdir .bin local lver; for lver in $_luaversions $_luajit; do msg "Testing on lua$lver..." ln -sf "/usr/bin/lua$lver" ".bin/lua" LUA_PATH="$builddir/?.lua;;" \ PATH="$builddir/.bin:$PATH" \ lua "/usr/bin/busted" done } package() { mkdir -p "$pkgdir" } _subpackage() { local lver="${subpkgname:3:3}" pkgdesc="$pkgdesc (for Lua $lver)" depends="lua$lver" install_if="$pkgname=$pkgver-r$pkgrel lua$lver" local path; for path in "lib/luarocks/rocks-$lver" "share/lua/$lver"; do mkdir -p "$subpkgdir/usr/${path%/*}" mv "$builddir/build/$path" "$subpkgdir/usr/$path/" done } sha512sums="132a5d7d898b791242abc3b95f47f534d0b0e2a3f9848efb95be04f92049b18c919af8c2ac162e11f78b502d346e78a73935c1ad720f5ffbb1efe90355b39a9a etlua-1.3.0.tar.gz"