aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-posix/APKBUILD
blob: 3589247265914978e87139928ca69e0dfeaa43f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2"

pkgname=lua-posix
_name=luaposix
pkgver=31
pkgrel=1
pkgdesc="POSIX library for Lua $_luaver"
url="https://github.com/luaposix/luaposix"
arch="all"
license="MIT"
depends="lua5.1-posix"
makedepends="perl ncurses-dev automake autoconf"
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
	lua-version.patch
	"



_sdir="$srcdir"/$_name-release-v$pkgver

prepare() {
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	aclocal && autoconf && automake --add-missing || return 1
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
}

build() {
	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
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make DESTDIR="$pkgdir" install || return 1
	done
	rm "$pkgdir"/usr/lib/lua/*/*.la || return 1
}

_split() {
	depends=
	local d= _ver=$1 _f=$2
	if [ "$_ver" = "5.1" ]; then
		depends="lua-bitlib"
	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/ \
				|| return 1
			rmdir "$pkgdir"/$d/$_ver 2>/dev/null || true
		fi
	done
}

_split_curses() {
	local _ver=$1
	pkgdesc="ncurses binding for Lua $_ver"
	_split $_ver curses
}

_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="a25ff76d54bbbebf7a1f3b20c9806ee3  luaposix-31.tar.gz
30da8a857ac8026b6cf6932decdccc61  lua-version.patch"
sha256sums="c5ed2f6c16b9f31d3ca0db05f9b660db69c966baab244878480ab6658abbbe24  luaposix-31.tar.gz
68a3e67e61b853927a4113a3603d528afe97999fae3bc37b9669e1045ddce299  lua-version.patch"
sha512sums="263d0ffdb4043199a37bccc2f74419e72d6d812f74104fae6bd979a13217ab58275c6d6e21a0aaa4232851fa29941eececa22bc441fb37bebbdc2842b1c37c3f  luaposix-31.tar.gz
7cde55168dd183ea9a922c2ddfee78a0d43dcc5fa313725c1718693d327fcdc682bb692b4d3a9968322ce53f1dba42990a5b7b150a6d892fcc3f887538a4dea5  lua-version.patch"