aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-cqueues/APKBUILD
blob: 53a4c98f4c4c6900b49c035ba2ce5674544df146 (plain) (blame)
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
71
72
73
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-cqueues
pkgver=20150811
_commitid=e3af1f6334c3efe4b432f4aa38e29e4c1270bc8b
pkgrel=0
pkgdesc="Lua event loop using coroutines"
url="http://25thandclement.com/~william/projects/cqueues.html"
arch="all"
license="MIT"
depends=""
depends_dev=""
subpackages=""
makedepends="$depends_dev openssl-dev m4 bsd-compat-headers"
install=""
source="cqueues-$pkgver.tar.gz::https://github.com/wahern/cqueues/archive/$_commitid.tar.gz
	"

for _i in $_luaversions; do
	makedepends="$makedepends lua${_i}-dev"
	subpackages="$subpackages lua${_i}-cqueues:_split_${_i/./}"
done

_builddir="$srcdir"/cqueues-$_commitid
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	# Override the HAVE_* tests that depend on GLIBC. grep for "#define HAVE_" on new releases.
	export CFLAGS="$CFLAGS -DHAVE_EVENTFD=1 -DHAVE_EPOLL_CREATE1=1 -DHAVE_PIPE2=1"
	for _i in $_luaversions; do
		msg "Build for Lua $_i"
		make all${_i} || return 1
	done
}

package() {
	cd "$_builddir"
	for _i in $_luaversions; do
		msg "Install for Lua $_i"
		make DESTDIR="$pkgdir" prefix=/usr install${_i} || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="$pkgdesc - for Lua $_ver"
	depends=
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d
			mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
		fi
	done
}

for _i in $_luaversions; do
	eval "_split_${_i/./}() { _split $_i; }"
done


md5sums="532236da61e203fbeafd61e6ba023d2c  cqueues-20150811.tar.gz"
sha256sums="971760a4ea4795286730a51e614536429cd7992aec155c99b41a4082298d0cb1  cqueues-20150811.tar.gz"
sha512sums="6655f98a32b6d0ef6c06db9b2f6d2748208d3d0d7f948561f606782acf10c29351639969e6462e5a8fc25b18a015ebeaffadd448a1466067f2110de00a9a1339  cqueues-20150811.tar.gz"