From 27abf36e91d66a0f7c5b860d211efa34daf99bf9 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 6 Apr 2015 12:29:13 +0000 Subject: main/lua-alt-getopt: use install_if --- main/lua-alt-getopt/APKBUILD | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'main/lua-alt-getopt/APKBUILD') diff --git a/main/lua-alt-getopt/APKBUILD b/main/lua-alt-getopt/APKBUILD index a1d05ffd1a..08d8191bd0 100644 --- a/main/lua-alt-getopt/APKBUILD +++ b/main/lua-alt-getopt/APKBUILD @@ -1,7 +1,8 @@ # Maintainer: Natanael Copa +_luaversions="5.1 5.2" pkgname=lua-alt-getopt pkgver=0.7.0 -pkgrel=4 +pkgrel=5 pkgdesc="Lua module for processing options similar to getopt_long(3)" url="http://luaforge.net/projects/alt-getopt/" arch="noarch" @@ -9,7 +10,11 @@ license="MIT" depends="lua5.1-alt-getopt lua5.2-alt-getopt" makedepends= install= -subpackages="lua5.1-alt-getopt:_51 lua5.2-alt-getopt:_52" +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 @@ -23,22 +28,29 @@ build() { package() { cd "$_builddir" - mkdir -p "$pkgdir"/usr/share/lua/5.1 "$pkgdir"/usr/share/lua/5.2 - install -Dm644 alt_getopt.lua "$pkgdir"/usr/share/lua/5.2/alt_getopt.lua - ln -s ../5.2/alt_getopt.lua "$pkgdir"/usr/share/lua/5.1/alt_getopt.lua + 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 } -_52() { - depends="" - mkdir -p "$subpkgdir"/usr/share/lua/ - mv "$pkgdir"/usr/share/lua/5.2 "$subpkgdir"/usr/share/lua/ +_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 } -_51() { - replaces="lua-alt-getopt" - depends="lua5.2-alt-getopt" - mkdir -p "$subpkgdir"/usr/share/lua/ - mv "$pkgdir"/usr/share/lua/5.1 "$subpkgdir"/usr/share/lua/ -} +for _v in $_luaversions; do + eval "split_${_v/./_}() { _split $_v; }" +done md5sums="f504578b1287ea02759add231b972812 lua-alt-getopt-0.7.0.tar.gz" -- cgit v1.2.3