aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-lpeg/APKBUILD
blob: 763cda08c4122fc19b5bc959cb6b1b37c9e22d24 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-lpeg
_pkgname=lpeg
pkgver=1.0.1
pkgrel=0
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
}

md5sums="52928c84a843eecbaa78c761cbcccc72  lpeg-1.0.1.tar.gz"
sha256sums="62006bcda4f73f0cd7a8164f9559397d4e928568fa55aa496cc8b861fb140fb3  lpeg-1.0.1.tar.gz"
sha512sums="680925ea539e4a5eb7508a0fb3cbc1ba3da51dced962ddf90714a700a7c3b3d5e062d5e0b5eb097ab74d5aee018cb1a831cb6247fac825f72ba071b76f896e5b  lpeg-1.0.1.tar.gz"