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

_luaversions="5.1 5.2 5.3"
pkgname=lua-stdlib
pkgver=41.2.0
pkgrel=0
pkgdesc="Lua library of modules for common programming tasks"
url="https://github.com/lua-stdlib/lua-stdlib"
arch="noarch"
license="MIT/X"
depends=
makedepends="autoconf automake"
install=
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 || return 1
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i || return 1
	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 \
			|| return 1
		make || return 1
	done
}

package() {
	cd "$_builddir"
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make DESTDIR="$pkgdir" luadir="/usr/share/lua/$_i" install \
			|| return 1
	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/ || return 1
		fi
	done
}


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


md5sums="5d99d87b95ca64f1e079289fe9e486ff  lua-stdlib-41.2.0.tar.gz"
sha256sums="c9d9d11dcd2e3e956e697f5455b5f62baadf233d8726d80514d0432273cc27e9  lua-stdlib-41.2.0.tar.gz"
sha512sums="27ee578d845b70d28e6cdeefc2d0f9163724d2ef4b5dff69820564d7ef2a3f06184b537c5796bd730653bd28cae28bffa29a28cb256f93914b9a43c50aceb8fe  lua-stdlib-41.2.0.tar.gz"