aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-stdlib/APKBUILD
blob: 023dbf8ad5bb5e267f37c193bf1794ae49209482 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-stdlib
pkgver=41.2.1
pkgrel=0
pkgdesc="Lua library of modules for common programming tasks"
url="https://github.com/lua-stdlib/lua-stdlib"
arch="noarch"
license="MIT/X"
makedepends="autoconf automake"
subpackages="$pkgname-doc"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v lua$_v-dev"
	subpackages="$subpackages lua$_v-stdlib:split_${_v/./_}"
done
source="$pkgname-$pkgver.tar.gz::https://github.com/lua-stdlib/lua-stdlib/archive/release-v$pkgver.tar.gz"
_sdir="$srcdir"/lua-stdlib-release-v$pkgver

prepare() {
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	aclocal && autoconf && automake --add-missing
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		msg "build for Lua $_i"
		cd "$srcdir"/build-$_i
		LUA=lua$_i LUA_INCLUDE=$(pkg-config lua$_i --cflags) \
			./configure --prefix=/usr \
			--libdir=/usr/lib/lua/$_i \
			--datadir=/usr/share/lua/$_i
		make
	done
}

package() {
	cd "$_builddir"
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make DESTDIR="$pkgdir" luadir="/usr/share/lua/$_i" install
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="$pkgdesc for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	depends=
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d
			mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/
		fi
	done
}


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


sha512sums="8b0dc34fbaee68f5a8e0d22c253b513faa782a679b1adb7d79418469623f6ff921249641c630d69d8bb1eee59dfd5c7f1b8d2b02a517c8e21f3632880f3540cd  lua-stdlib-41.2.1.tar.gz"