aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-http/APKBUILD
blob: fa9f5709581ccc55bec9b1e120ef27056d031041 (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
69
70
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-http
pkgver=0.2
pkgrel=4
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>=0.5 lua-ossl"
checkdepends="lua-busted lua5.1-compat53 lua5.2-compat53 lua5.1-bit32"
makedepends=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/daurnimator/$pkgname/archive/v$pkgver.tar.gz
	lpeg_patterns-0.5.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

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

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	checkdepends="$checkdepends lua$_v lua$_v-busted"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
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"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$pkgname/$pkgver-1"

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

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

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="ed71ac09277e8602e3d4954541f06c09ef444db20e5b4e39a17b9ed4893046b1442969902c0ba84fc4c3c922a6d1c8ebf853fceda261b12bf10ea9aa24389587  lua-http-0.2.tar.gz
9ce9038c69bb6d4730cf7717fde9c47447eafbe050dd88a6e60930a9cca63f80598f379885627b06f45e744fe6d59531c58d25565834a1963c81b884560710cc  lpeg_patterns-0.5.patch"