aboutsummaryrefslogblamecommitdiffstats
path: root/main/lua-optarg/APKBUILD
blob: 7a39b8b4d7388d7530d98649709a6d698b954454 (plain) (tree)






























































                                                                                                                                                                    
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-optarg
pkgver=0.1
pkgrel=0
pkgdesc="Simple command line option parser for Lua"
url="https://github.com/ncopa/lua-optarg"
arch="noarch"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-optarg:split_${_v/./_}"
done
source="lua-optarg-$pkgver.tar.gz::https://github.com/ncopa/lua-optarg/archive/v$pkgver.tar.gz"

_builddir="$srcdir"/lua-optarg-$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
}

build() {
	cd "$_builddir"
}

package() {
	cd "$_builddir"
	for _i in $_luaversions; do
		install -D optarg.lua "$pkgdir"/usr/share/lua/$_i/optarg.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="764d8969e5ec7c38309a030c09b33351  lua-optarg-0.1.tar.gz"
sha256sums="2c20a69d37d0f9af8df0991bb82a4aad7ceef1a4ccbe37773ddad5bc762277c9  lua-optarg-0.1.tar.gz"
sha512sums="d110b0a9bee079c48c234c6e77a56951c809b5c924a81975607d68cde432a63b76353800c2fc6a04f6b29503d19f65cd3b7bbd50cd1ce612f4c18e775b5c27a8  lua-optarg-0.1.tar.gz"