aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-etlua/APKBUILD
blob: 2bc89c5984013069738f77c6c42ff6c5c3450917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Maintainer: Guilherme Felipe da Silva <gfsilva.eng@gmail.com>
pkgname=lua-etlua
_rockname="${pkgname#lua-}"
pkgver=1.3.0
pkgrel=0
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"
	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"