aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-posix/APKBUILD
blob: cec6f6aabf157feb4eacd83d65529754d01b5f85 (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
104
105
106
107
108
109
110
111
112
113
114
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"

pkgname=lua-posix
_name=luaposix
pkgver=33.3.1
pkgrel=3
pkgdesc="POSIX library for Lua $_luaver"
url="https://github.com/luaposix/luaposix"
arch="all"
license="MIT"
depends=""
makedepends="perl ncurses-dev automake autoconf lua-bitlib"
subpackages="$pkgname-doc lua-curses:_curses"

for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev lua$_i"
	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
	fix-sched-header.patch
	add-cloexec.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" luadir="/usr/share/lua/$_i" install \
			|| return 1
	done
}

_curses() {
	depends=
	pkgdesc="ncurses binding for Lua - meta package"
	mkdir -p "$subpkgdir"
}

_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-bitlib<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/ \
				|| return 1
			rmdir "$pkgdir"/$d/$_ver 2>/dev/null || true
		fi
	done
}

_split_curses() {
	local _ver=$1
	pkgdesc="ncurses binding for Lua $_ver"
	install_if="lua$_ver lua-curses=$pkgver-r$pkgrel"
	_split $_ver curses
}

_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 "_curses_${_i/./_}() { _split_curses $_i; }"
	eval "_posix_${_i/./_}() { _split_posix $_i; }"
done

md5sums="1d07112a5582b539930066d7c834643f  luaposix-33.3.1.tar.gz
d4165a01aa0d606315a35cbb956ed763  fix-sched-header.patch
b5420275eb73d12514a4b95cc9ae8923  add-cloexec.patch"
sha256sums="49e1eda64d0c03d0f2977fc1e04ce8c620dc3bb9a5c54c342904751d21b1b3cf  luaposix-33.3.1.tar.gz
b49102e3c08418c6298f4ce4cea1856082e17e016551c16633851e35de115128  fix-sched-header.patch
375d23dce99da756927563f1e1511fe61bb11c2170284ce2bf5f8b9fc956f6ca  add-cloexec.patch"
sha512sums="76d4d9feb44f857a98dd3ad76d8ca4e4f917a4f75b04e72fdce70b092aa825a91a51cb19cf8046cbe551a92e281008664ef103301543756a646e7bab31538e33  luaposix-33.3.1.tar.gz
2b80759b1803059c1424ad7564ff8ec70aeff85faf817db1f2fc09b7bab3deac2fd5f98de78657039b39b9817d8978c9a382fb687975e381e95c369389b76b2a  fix-sched-header.patch
3f61742bed2f5114d0a4c1f32446901d9664ed44a03344e3cdac4e41727a91871fc13a397338b0bd24a7a859466c712dc238e48a32dffe89635044abf94d69e2  add-cloexec.patch"