APKBUILD 2.21 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2 3 4

_luaversions="5.1 5.2"

5 6
pkgname=lua-posix
_name=luaposix
7
pkgver=5.1.28
8
pkgrel=1
9
pkgdesc="POSIX library for Lua $_luaver"
10
url="https://github.com/luaposix/luaposix"
11
arch="all"
Natanael Copa's avatar
Natanael Copa committed
12
license="MIT"
13 14 15 16 17 18 19 20 21 22 23
depends="lua5.1-posix"
makedepends="perl ncurses-dev"
subpackages="$pkgname-doc"

for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-posix:_posix_${_i/./_}
		lua$_i-curses:_curses_${_i/./_}"
done
source="luaposix-$pkgver.tar.gz::https://github.com/luaposix/luaposix/archive/release-v$pkgver.tar.gz"

24

25

26
_sdir="$srcdir"/$_name-release-v$pkgver
Natanael Copa's avatar
Natanael Copa committed
27

28
prepare() {
29
	cd "$_sdir"
30 31 32 33 34
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
35 36 37
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
38
}
39

Natanael Copa's avatar
Natanael Copa committed
40
build() {
41 42 43 44 45 46 47 48 49 50
	for _i in $_luaversions; do
		msg "build for Lua $_i"
		cd "$srcdir"/build-$_i
		LUA=lua$_i LUA_INCLUDE=$(pkg-config lua$_i --cflags) \
			./configure --prefix=/usr \
			--libdir=/usr/lib/lua/$_i \
			--datadir=/usr/share/lua/$_i \
			|| return 1
		make || return 1
	done
51 52 53
}

package() {
54 55 56 57 58
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make DESTDIR="$pkgdir" install || return 1
	done
	rm "$pkgdir"/usr/lib/lua/*/*.la || return 1
Natanael Copa's avatar
Natanael Copa committed
59 60
}

61 62 63 64 65 66
_split() {
	depends=
	local d= _ver=$1 _f=$2
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d/$_ver
67 68
			mv "$pkgdir"/$d/$_ver/$_f* "$subpkgdir"/$d/$_ver/ \
				|| return 1
69 70 71 72 73 74 75 76 77
			rmdir "$pkgdir"/$d/$_ver 2>/dev/null || true
		fi
	done
}

_split_curses() {
	local _ver=$1
	pkgdesc="ncurses binding for Lua $_ver"
	_split $_ver curses
78
}
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

_split_posix() {
	local _ver=$1
	pkgdesc="POSIX library for Lua $_ver"
	replaces="lua-posix"
	_split $_ver posix
}

for _i in $_luaversions; do
	eval "_curses_${_i/./_}() { _split_curses $_i; }"
	eval "_posix_${_i/./_}() { _split_posix $_i; }"
done

md5sums="f543b8cc4fae5379ad8ed9cc1cfc2efc  luaposix-5.1.28.tar.gz"
sha256sums="d82a322cb93d25ef16ba2cbab79f6fa1d94806249542d771c2c89a5f9cc4345f  luaposix-5.1.28.tar.gz"
sha512sums="1ac95ea831d2eb81aec63f316335cea71c7435d06ad830c95f972ea87893b210dd7c684ca3da42111d02420e474dbfca20d7eb47db16ac096af8fff0f7fbc36f  luaposix-5.1.28.tar.gz"