# Maintainer: Natanael Copa _luaversions="5.1 5.2 5.3 5.4" pkgname=lua-posix _name=luaposix pkgver=36.2.1 pkgrel=0 pkgdesc="POSIX library for Lua $_luaver" url="https://github.com/luaposix/luaposix" arch="all" license="MIT" makedepends="linux-headers lua-bit32" for _i in $_luaversions; do makedepends="$makedepends lua$_i-dev lua$_i" subpackages="$subpackages lua$_i-posix:_posix_${_i/./_}" done source="luaposix-$pkgver-2.tar.gz::https://github.com/luaposix/luaposix/archive/v$pkgver.tar.gz" builddir="$srcdir"/$_name-$pkgver prepare() { default_prepare for _i in $_luaversions; do cp -r "$builddir" "$srcdir"/build-$_i done } build() { for _i in $_luaversions; do msg "build for Lua $_i" cd "$srcdir"/build-$_i lua$_i build-aux/luke done } package() { for _i in $_luaversions; do cd "$srcdir"/build-$_i lua$_i build-aux/luke install PREFIX="$pkgdir"/usr done } _split() { depends= local d= _ver=$1 _f=$2 if [ "$_ver" != "5.2" ]; then # use versioned dep to work around # http://bugs.alpinelinux.org/issues/4063 depends="lua$_ver-bit32<26" fi for d in usr/lib/lua usr/share/lua; do if [ -d "$pkgdir"/$d/$_ver ]; then mkdir -p "$subpkgdir"/$d/$_ver mv "$pkgdir"/$d/$_ver/$_f* "$subpkgdir"/$d/$_ver/ rmdir "$pkgdir"/$d/$_ver 2>/dev/null || true fi done } _split_posix() { local _ver=$1 pkgdesc="POSIX library for Lua $_ver" install_if="lua$_ver lua-posix=$pkgver-r$pkgrel" _split $_ver posix } for _i in $_luaversions; do eval "_posix_${_i/./_}() { _split_posix $_i; }" done sha512sums=" cd7deeaa9179306f90bafdc6cfb2668cf42d5378e72e5baa09419198f2d42c5eab5d881e5584ac511f317bbfd850f2ad46b8cb743f1ae5e1a96f8153e03599d8 luaposix-36.2.1-2.tar.gz "