summaryrefslogtreecommitdiff
path: root/main/lua-lyaml/APKBUILD
blob: 386897bf59e3115c9d75860d0692e4b252878842 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_pkgname=lyaml
pkgname=lua-$_pkgname
pkgver=6.2.8
pkgrel=1
pkgdesc="LibYAML binding for Lua"
url="https://github.com/gvvaughan/lyaml"
arch="all"
license="MIT"
makedepends="yaml-dev lua-stdlib-normalize"
replaces="lua-yaml"
source="$_pkgname-$pkgver.tar.gz::https://github.com/gvvaughan/lyaml/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-$_pkgname:_subpackage"
done

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		cp -r "$builddir" "$srcdir"/build-$lver
		cd "$srcdir"/build-$lver
		lua$lver build-aux/luke
	done
}

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

_subpackage() {
	local lver="${subpkgname%-lyaml}"
	lver=${lver#lua}
	pkgdesc="$pkgdesc $lver"
	depends="lua$lver lua$lver-stdlib-normalize"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"

	cd "$srcdir"/build-$lver

	lua$lver build-aux/luke PREFIX="$subpkgdir"/usr install
	rm -Rf "$subpkgdir"/usr/share/doc

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

sha512sums="
d9166d89f2275a1050218425c1365d6bda42294ab2629c71da3a2007eac7e8018e13d6e69181ea204eb7f051a49533e4b67227468b161df1f3450a073e2dbeab  lyaml-6.2.8.tar.gz
"