aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-copas/APKBUILD
blob: 0e40aef50c6d05e51151e8a25d6fc232d50650e7 (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-copas
_rockname=copas
pkgver=4.7.1
_pkgver=${pkgver//./_}
pkgrel=0
pkgdesc="Coroutine Oriented Portable Asynchronous Services for Lua"
url="https://lunarmodules.github.io/copas/"
arch="noarch"
license="MIT"
depends="
	lua-binaryheap
	lua-coxpcall
	lua-socket
	lua-timerwheel
	"
checkdepends="lua-sec"
source="$pkgname-$pkgver.tar.gz::https://github.com/keplerproject/$_rockname/archive/v$_pkgver.tar.gz
	ipv4-only.patch
	"
builddir="$srcdir/$_rockname-$_pkgver"

case "$CARCH" in
	ppc64le|riscv64) _luajit="";;
	*) checkdepends="$checkdepends luajit"; _luajit="jit";;
esac

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	checkdepends="$checkdepends lua$_v"
	# for backward compatibility (Alpine <3.18)
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"
done

prepare() {
	default_prepare

	# FIXME: Theses tests fail, most likely due to lua-socket >=3.0, see
	#  https://github.com/lunarmodules/copas/issues/159.
	#  I don't know if it affects only tests or copas is broken now. :(
	sed -i \
		-e '/tests\/httpredirect.lua/d' \
		-e '/tests\/largetransfer.lua/d' \
		-e '/tests\/starve.lua/d' \
		-e '/tests\/tls-sni.lua/d' \
		Makefile
}

check() {
	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on lua$lver"
		make test LUA=lua$lver
	done
}

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	cd "$builddir"
	make LUA_DIR="$pkgdir/usr/share/lua/common" install

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

sha512sums="
906e7eeabdd343fd0c4ab03cc13b868981cdc3294e733fa1d7641c2a1b4de031fec8dda2c8e47a2bbfdd490f2864d352fc6b4c34274a74f3926a6fcb3fd96132  lua-copas-4.7.1.tar.gz
20acb34bc3cd0e974d2b7c9e54ade4e29cfa3e5dd7d52351bb0e06760301dc354c964c450080d61df2ebb3577e9407caea24582fbd9d2576485ae4aad7bafcf7  ipv4-only.patch
"