aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-cqueues-pushy/APKBUILD
blob: 64698039ae3908ee1d31efc1e984d2dcaa16fca6 (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
# Maintainer: Timo Teräs <timo.teras@iki.fi>
_luaversions="5.2 5.3"
pkgname=lua-cqueues-pushy
pkgver=0.20180530
_commitid=5c4dc58a83490e18e977d880ca7cdee5ec5e70e5
pkgrel=1
pkgdesc="Framework for logic control (based on cqueues)"
url="https://github.com/rameplayerorg/lua-cqueues-pushy"
arch="all"
license="GPL-2.0-only"
makedepends="linux-headers"
source="$pkgname-$pkgver.tar.gz::https://github.com/rameplayerorg/lua-cqueues-pushy/archive/$_commitid.tar.gz
	cqpushy.initd
	"

builddir="$srcdir"/$pkgname-$_commitid

_subpkg_depends="cqueues>=20150616 struct posix ldbus socket cjson penlight"
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	# add all subpackage's depends to makedepends so they are built first
	for _dep in $_subpkg_depends; do
		makedepends="$makedepends lua$_i-$_dep"
	done
	subpackages="$subpackages lua$_i-cqueues-pushy:split_${_i/./_}"
done

prepare() {
	default_prepare
	for _v in $_luaversions; do
		cp -r "$builddir" "$srcdir"/build-$_v
	done
}

build() {
	for _v in $_luaversions; do
		cd "$srcdir"/build-$_v
		make LUA_VERSION=$_v
	done
}

package() {
	for _v in $_luaversions; do
		cd "$srcdir"/build-$_v
		make LUA_VERSION=$_v install DESTDIR="$pkgdir"
	done
	install -m755 -D "$srcdir"/cqpushy.initd \
		"$pkgdir"/etc/init.d/cqpushy
}

_split() {
	local _ver=$1
	pkgdesc="$pkgdesc - Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends=
	for _dep in $_subpkg_depepends; do
		depends="$depends lua$_ver-$_dep"
	done

	mkdir -p "$subpkgdir"/usr/share/lua "$subpkgdir"/usr/lib/lua
	mv "$pkgdir"/usr/share/lua/$_ver "$subpkgdir"/usr/share/lua
	mv "$pkgdir"/usr/lib/lua/$_ver "$subpkgdir"/usr/lib/lua
}

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

sha512sums="09a671122b694d52af775496417c3dd375507032c7e57f84d74e20e2ffdf882f393b69894732c658283cdd0f9de43ebc28a8af198fda79a180684786a41451cd  lua-cqueues-pushy-0.20180530.tar.gz
9599db364c3a2e77a7fee61304182961cb6132ce9cb58e9b6837312f52a582e838fdb54eb932c3204b558e3db7228a0412870d0a02125d1017f3402155647bd0  cqpushy.initd"