aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-system/APKBUILD
blob: 372bb001a4c33afa559da1615486be606e3ba4a9 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-system
_pkgname=luasystem
pkgver=0.2.1
pkgrel=0
pkgdesc="Platform independent system calls for Lua"
url="https://github.com/o-lim/luasystem/"
arch="all"
license="MIT"
makedepends=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/o-lim/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
# This module needs lua-busted to run tests, but lua-busted depends on
# lua-system and we wanna avoid circular dependencies.
options="!check"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

prepare() {
	default_prepare || return 1

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building against Lua $lver..."
		make -C "$builddir-$lver"/src \
			LUA_VERSION=$lver \
			MYCFLAGS="$CFLAGS" || return 1
	done
}

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc $lver"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local lmod_dir=$(pkg-config --variable=INSTALL_LMOD lua$lver)

	cd "$builddir-$lver"

	make -C src LUA_VERSION=$lver DESTDIR="$subpkgdir" prefix=/usr \
		install || return 1
	install -m 644 -D system/init.lua "$subpkgdir"/$lmod_dir/system.lua
}

sha512sums="b8a04a83e8e39c98da23484c9eba9ff60da2fb4db3deca0d52784a6c13c7e0faf7a8b326999d88703847107e4fce739062fc04a00266140969c9f57b70064f46  lua-system-0.2.1.tar.gz"