Commit 27abf36e authored by Natanael Copa's avatar Natanael Copa

main/lua-alt-getopt: use install_if

parent 96664e6d
# Maintainer: Natanael Copa <ncopa@alpinlinux.org>
_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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment