aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-lyaml/APKBUILD
blob: b9ab78ad9d35b4b7b84af8ae551e8d4092fd87a1 (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.1
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="e11c2bf29b539674dfc5b4a094550dc5  lyaml-6.1.tar.gz"
sha256sums="7063e50dfcee25f87f1a29fc2d75d12e5d8fd83522a99936d51841c3f374851a  lyaml-6.1.tar.gz"
sha512sums="0730001fcd171f88a8fe8917f9fb8c403d5d7461dda8dfee73a555ac7899dc6c6042fda1ce0e69bb335ba0930ff650763a3e15b363ce61832bb3bb838de22bd6  lyaml-6.1.tar.gz"