aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-lyaml/APKBUILD
blob: 5217cae46d2f4af925b92ff26554a5c95718ee02 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"
_name=lyaml
pkgname=lua-$_name
pkgver=6.0
pkgrel=0
pkgdesc="LibYAML binding for Lua"
url="https://github.com/gvvaughan/lyaml"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev yaml-dev"
subpackages=""
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i lua$_i-dev"
	subpackages="$subpackages lua$_i-$_name:_${_i/./}"
done

install=""
replaces="lua-yaml"
source="lyaml-$pkgver.tar.gz::https://github.com/gvvaughan/lyaml/archive/release-v$pkgver.tar.gz"

_builddir="$srcdir"/lyaml-release-v$pkgver
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
	for _i in $_luaversions; do
		mkdir build-$_i
	done
}

build() {
	cd "$_builddir"
	for _i in $_luaversions; do
		cd build-$_i && \
		LUA=lua$_i \
		LUA_INCLUDE="$(pkg-config --cflags lua$_i)" \
		../configure \
			--build=$CBUILD \
			--host=$CHOST \
			--prefix=/usr \
			--sysconfdir=/etc \
			--mandir=/usr/share/man \
			--infodir=/usr/share/info \
			--localstatedir=/var \
			|| return 1
		make || return 1
		cd ..
	done
}

package() {
	for _i in $_luaversions; do
		cd "$_builddir"/build-$_i
		make DESTDIR="$pkgdir" install || return 1
	done
}

_split() {
	local d= _ver=$1
	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/$_ver
			mv "$pkgdir"/$d/$_ver/* "$subpkgdir"/$d/$_ver/ \
				|| return 1
			rmdir "$pkgdir"/$d/$_ver 2>/dev/null || true
		fi
	done
}

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


md5sums="dc3494689a0dce7cf44e7a99c72b1f30  lyaml-6.0.tar.gz"
sha256sums="9d7cf74d776999ff6f758c569d5202ff5da1f303c6f4229d3b41f71cd3a3e7a7  lyaml-6.0.tar.gz"
sha512sums="0409636838c1283c2d56e77920cf776050c3c56c358e43d1d9523772420f2b4a65673f688be9eeed9483aadccf55e2383186855ffcbd770ce6065054a707f186  lyaml-6.0.tar.gz"