aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-alt-getopt/APKBUILD
blob: 08d8191bd085fceb577aab2a1c6787fa941a65c0 (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
# Maintainer: Natanael Copa <ncopa@alpinlinux.org>
_luaversions="5.1 5.2"
pkgname=lua-alt-getopt
pkgver=0.7.0
pkgrel=5
pkgdesc="Lua module for processing options similar to getopt_long(3)"
url="http://luaforge.net/projects/alt-getopt/"
arch="noarch"
license="MIT"
depends="lua5.1-alt-getopt lua5.2-alt-getopt"
makedepends=
install=
subpackages=""
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-alt-getopt:split_${_v/./_}"
done
source="http://mova.org/~cheusov/pub/lua_alt_getopt/lua-alt-getopt-$pkgver.tar.gz"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
}

build() {
	cd "$_builddir"
}

package() {
	cd "$_builddir"
	for _i in $_luaversions; do
		mkdir -p "$pkgdir"/usr/share/lua/$_i
		install -Dm644 alt_getopt.lua \
			"$pkgdir"/usr/share/lua/$_i/alt_getopt.lua \
			|| 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="f504578b1287ea02759add231b972812  lua-alt-getopt-0.7.0.tar.gz"