aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-alt-getopt/APKBUILD
blob: 20d15fc81b19a8286c1b58fd01315153c803bd61 (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
# Maintainer: Natanael Copa <ncopa@alpinlinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-alt-getopt
pkgver=0.7
pkgrel=7
pkgdesc="Lua module for processing options similar to getopt_long(3)"
url="http://luaforge.net/projects/alt-getopt/"
arch="noarch"
license="MIT"
depends=""
makedepends=
install=
subpackages=""
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-alt-getopt:split_${_v/./_}"
done
source="alt-getopt-$pkgver.tar.gz::https://github.com/LuaDist/alt-getopt/archive/$pkgver.tar.gz
	lua5.2-compat.patch
	"

_builddir="$srcdir"/alt-getopt-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

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="6fb65337dda22614ad1bc633a813996e  alt-getopt-0.7.tar.gz
de4d4609ee6b07b7c79a6a958df0bdeb  lua5.2-compat.patch"
sha256sums="69ee2d386797087ba57ba48f7d1d4ed369793efde64341a2c9bbf7ff3408e222  alt-getopt-0.7.tar.gz
5920af61a938cf56dd4cdcbf6500d113907ce016e86869f7638852269191db19  lua5.2-compat.patch"
sha512sums="8e7d1a2686a320a47199a71d09da1d3fad51bfa086dd6b1a95414325a24c66c4bef9ac9dd1ec9d866248a3b292a47e6c12cef47e88ce79a7f99bc5eaea68afc7  alt-getopt-0.7.tar.gz
9c4f44c811e1dd6164fb332bb95c23cff63f3347ee2e130b4bac08683a394cd3578425716a7cd49873ee35344d40414f03f5a30130c6a8fa4f94cd78cb0004f9  lua5.2-compat.patch"