aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-lyaml/APKBUILD
blob: a61021775b282735db9752204f9ae09db06387b8 (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
88
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"
_name=lyaml
pkgname=lua-$_name
pkgver=5.1.4
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-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
		rm "$pkgdir"/usr/lib/lua/*/*.la || 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="52e44331e2af7797b340920c8fd3b942  lyaml-5.1.4.tar.gz"
sha256sums="7893744d32facf8c98a8b570f5b783ee7a213c09a9f049b9f6254c767c471837  lyaml-5.1.4.tar.gz"
sha512sums="2fafe985f3a23f88d2a1e2bd4d5ff080a99266ac795bc0cae3ea50d545624d4c7f9b9041912a250876898be2800a4a308425442ad7c60172c4d28a036a859d4e  lyaml-5.1.4.tar.gz"