aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-openrc/APKBUILD
blob: 2e48bf319ae420538a6bcd3f6d9b347dd861688d (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-openrc
pkgver=0.2
pkgrel=1
pkgdesc="Lua module for OpenRC"
url="https://github.com/ncopa/lua-openrc"
arch="all"
license="GPL"
depends=""
install=
makedepends="openrc-dev bsd-compat-headers"
subpackages=""
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-openrc:split_${_i/./_}"
done
source="lua-openrc-$pkgver.tar.gz::https://github.com/ncopa/lua-openrc/archive/v$pkgver.tar.gz"


_sdir="$srcdir"/$pkgname-$pkgver

prepare() {
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i || return 1
	done
}

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

package() {
	for _i in $_luaversions; do
		install -Dm755 "$srcdir"/build-$_i/rc.so \
			"$pkgdir"/usr/lib/lua/$_i/rc.so || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="Lua $_ver module for OpenRC"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends=
	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="764b4ec74d059541acc4bd3fb8581c1c  lua-openrc-0.2.tar.gz"
sha256sums="f7e961386783c6a73301bb0342a7c2c799c34464daff4a3125c6eaf463e251e5  lua-openrc-0.2.tar.gz"
sha512sums="f560cbef63d7d1565dacd9ec2f8dc91d4c08397dfcd546dd446d3834caef8d545cab6d0b7ea5a095090e3069935eb9adfa35e75414d7dcfa2ae8951186221970  lua-openrc-0.2.tar.gz"