aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/lua-llthreads/APKBUILD
blob: 7ca39dbfa72f9cee7a800cdffef14eb9aa2562e7 (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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2"

pkgname=lua-llthreads
pkgver=1.2
pkgrel=3
pkgdesc="Low-Level native threads module for Lua"
url="https://github.com/Neopallium/lua-llthreads"
arch="all"
license="MIT"
depends=""
makedepends="cmake"
install=""
subpackages=
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-llthreads:split_${_i/./_}"
done
source="lua-llthreads-$pkgver.tar.gz::https://github.com/Neopallium/lua-llthreads/archive/v$pkgver.tar.gz
	bindings-1.patch
	bindings-2.patch
	lua-5.2.patch"

_sdir="$srcdir"/lua-llthreads-$pkgver

prepare() {
	local i
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	cd "$srcdir"
	for _i in $_luaversions; do
		mkdir -p "$srcdir"/build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		msg "build for Lua $_i"
		CFLAGS="$CFLAGS $(pkg-config --cflags lua$_i)" cmake \
			-DCMAKE_INSTALL_PREFIX=/usr \
			-DINSTALL_CMOD=/usr/lib/lua/$_i \
			"$_sdir" || return 1
		make VERBOSE=1 || return 1
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make install DESTDIR="$pkgdir" || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="Low-Level native threads module 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
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

md5sums="d4adb2e6d4859bf33ebdb3bd6b6c6bb5  lua-llthreads-1.2.tar.gz
399fa42d7dfa7ec2335bd7111b17935e  bindings-1.patch
f892e9cb699eef2d5df406063a26d044  bindings-2.patch
5f4a0b8c23968a521072c96c42435475  lua-5.2.patch"
sha256sums="32df7dc903760825536def63fba834466c42e6bd17022d430893c9a6ca3ba8f2  lua-llthreads-1.2.tar.gz
20c2cc64f09dd601fb85d867e7e57b8849a66d9b1992c647282a84af92127902  bindings-1.patch
3bb62563bdd5e4b5261612b5d0498bed4b327f02c7b5ff4a85329b9bc7867b3c  bindings-2.patch
5c7f28e7a3ef4e8d1ac6f0ef5cf5680ba58d0aa76e77260d6fe1c4ed74c4b586  lua-5.2.patch"
sha512sums="d8b006e7f135e9c45d88c93d6acf30d41024bee66bd0747ba8112e28c2fe03fbd8f869d6235261108f3df30a08f3a812595a763c82a57674b5ec54a8ca915fa7  lua-llthreads-1.2.tar.gz
eace4eb6226527697aa82b5e455b7ece3d651966f3525471f07476d84714550bb4f75447be34569d57f2ed52bbfd708458305b527621179cfa2f843ae684d931  bindings-1.patch
fd5be1ec7293c0e279877ee139de53c1772c28957c30e276f5fe8e05314c31e81ae6ea18553fe67d912b3f9902b48cd88b962480f5855037783477bbb633e019  bindings-2.patch
234e0afe81bbd2a40689a858febec8778962273553da6d7b876871bd996ed0ad28ca33a15b7e155c313b63f10b0f8bab3ee0a83c0cd14d3378884d0031df720d  lua-5.2.patch"