aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-lpeg/APKBUILD
blob: 1f603b0ae3fbc50ba91b38b531b0a229e640bfab (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=lua-lpeg
pkgver=0.12.2
_lua_versions="5.1 5.2 5.3"
pkgrel=0
pkgdesc="Pattern-matching library for Lua"
url="http://www.inf.puc-rio.br/~roberto/lpeg"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""
source="http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-$pkgver.tar.gz"
for _v in $_lua_versions; do
        makedepends="$makedepends lua$_v-dev"
        subpackages="$subpackages lua$_v-lpeg:split_${_v/./_}"
done

_builddir="$srcdir"/lpeg-$pkgver

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	
	sed 's/^CFLAGS =/CFLAGS +=/' -i makefile || return 1
	sed 's/^COPT =/# COPT =/' -i makefile || return 1
	
	for _ver in $_lua_versions; do
		cp -r "$_builddir" "$srcdir"/$pkgname-$_ver || return 1
	done
}

build() {
	for _ver in $_lua_versions; do
		cd "$srcdir"/$pkgname-$_ver
		make LUADIR=/usr/include/lua$_ver || return 1
	done
}

package() {
	arch="noarch"
	mkdir -p "$pkgdir"
}

_split() {
	local _ver="$1"
	pkgdesc="Pattern-matching library for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	cd "$srcdir"/$pkgname-$_ver || return 1
	install -Dm755 lpeg.so \
		"$subpkgdir"/usr/lib/lua/$_ver/lpeg.so || return 1
	install -Dm644 re.lua \
		"$subpkgdir"/usr/share/lua/$_ver/re.lua || return 1
}

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

md5sums="fabb614eb46e370d4f6b8fd82d17ca7e  lpeg-0.12.2.tar.gz"
sha256sums="6aad270b91d1b1c6fd75f68e162329a04a644e50e917d55f46cc8384b7120004  lpeg-0.12.2.tar.gz"
sha512sums="81505674473d83e2c777d470cd6ba4eead48ecc32e58e52bc192ca7a167f882e722c5a0cae62937fb3f5f71d6216de1ba4ea3d932e72265028f293d778df5e9e  lpeg-0.12.2.tar.gz"