aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-lpeg/APKBUILD
blob: a777a01025eaab2fa574609d8d90a0f60d4b6b87 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-lpeg
_pkgname=lpeg
pkgver=1.0.0
pkgrel=0
pkgdesc="Pattern-matching library for Lua"
url="http://www.inf.puc-rio.br/~roberto/lpeg"
arch="noarch"
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"
	arch="all"
	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="0aec64ccd13996202ad0c099e2877ece  lpeg-1.0.0.tar.gz"
sha256sums="10190ae758a22a16415429a9eb70344cf29cbda738a6962a9f94a732340abf8e  lpeg-1.0.0.tar.gz"
sha512sums="a245d2e0b8604121d8b4466052ab5da4f2b1f81c1c4b2579d8d5498920fc351d46fe4159a0b5948d1b377ef9bda410c4bf40ffd228b9f26bf346dfba2a7b9fb7  lpeg-1.0.0.tar.gz"