aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-http/APKBUILD
blob: 6072724743b8e2cb33da38906e0f4c631a9e041e (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-http
pkgver=0.2
pkgrel=0
pkgdesc="HTTP Library for Lua that supports HTTP(S) 1.0, 1.1 and 2.0"
url="https://github.com/daurnimator/lua-http"
arch="noarch"
license="MIT"
depends="lua-cqueues lua-basexx lua-fifo lua-lpeg lua-lpeg_patterns lua-ossl"
checkdepends="lua-busted lua-compat53 lua5.1-bit32"
makedepends=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/daurnimator/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

case "$CARCH" in
	# luajit is not available for s390x
	s390x) _luajit="";;
	# XXX: Some tests fail with "Address not available".
	aarch64 | armhf) options="!check";;
	*) checkdepends="$checkdepends luajit" _luajit="jit";;
esac

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
	checkdepends="$checkdepends lua$_v"
done

check() {
	cd "$builddir"

	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on lua$lver"
		lua$lver /usr/bin/busted
	done
}

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver ${depends//lua-/lua$lver-}"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local lmod_dir="$subpkgdir/usr/share/lua/$lver"

	if [ "$lver" != "5.3" ]; then
		depends="$depends lua$lver-compat5.3"
	fi
	if [ "$lver" = "5.1" ]; then
		depends="$depends lua5.1-bit32"
	fi

	mkdir -p "$lmod_dir"
	cp -r "$builddir"/http "$lmod_dir"/
}

sha512sums="ed71ac09277e8602e3d4954541f06c09ef444db20e5b4e39a17b9ed4893046b1442969902c0ba84fc4c3c922a6d1c8ebf853fceda261b12bf10ea9aa24389587  lua-http-0.2.tar.gz"