aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-lpeg/APKBUILD
blob: afd28a4579df2b5b8b1722b02b32fdea273568d2 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-lpeg
_pkgname=lpeg
pkgver=1.0.1
pkgrel=1
pkgdesc="Pattern-matching library for Lua"
url="http://www.inf.puc-rio.br/~roberto/lpeg"
arch="all"
license="MIT"
depends=""
makedepends=""
subpackages=""
source="http://www.inf.puc-rio.br/~roberto/lpeg/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-$_pkgname:_package"
done

prepare() {
	default_prepare || return 1

	cd "$builddir"

	sed -i -e 's/^CFLAGS =/CFLAGS +=/' \
		-e 's/^COPT =/# COPT =/' \
		makefile || return 1

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		make -C "$builddir-$lver" LUADIR=/usr/include/lua$lver || return 1
	done
}

package() {
	mkdir -p "$pkgdir"
}

_package() {
	local lver="${subpkgname:3:3}"
	pkgdesc="Pattern-matching library for Lua $lver"
	depends="lua$lver"
	install_if="lua$lver $pkgname=$pkgver-r$pkgrel"

	cd "$builddir-$lver"

	install -Dm755 lpeg.so \
		"$subpkgdir"/usr/lib/lua/$lver/lpeg.so || return 1
	install -Dm644 re.lua \
		"$subpkgdir"/usr/share/lua/$lver/re.lua || return 1
}

sha512sums="7b43fbee7eff443000986684bc56bba6d2796a31cf860740746c70e155bdea1b62a46b93f97e2747e3ef0f63e965148778ac2985d0f2d83e1e37ec4ebbabf4aa  lpeg-1.0.1.tar.gz"