summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 67cf31a447919444391f13a14301da17b4a1fe83 (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
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Aaron McDaniel (mcd1992) <'aur' at the domain 'fgthou.se'>

_pkgname=penlight
pkgname=("lua-$_pkgname-git" "lua53-$_pkgname-git" "lua52-$_pkgname-git" "lua51-$_pkgname-git")
pkgver=1.12.0.r9.ga7b9f88
pkgrel=1
pkgdesc='Lua libraries for on input data handling, functional programming, and OS interface'
url="https://github.com/lunarmodules/${_pkgname^}"
arch=(any)
license=(MIT)
_luadeps=(filesystem)
makedepends=(git
             lua
             lua51
             lua52
             lua53
             luarocks)
options=(debug)
_rockspec="$_pkgname-dev-1.rockspec"
_rock="${_rockspec%.rockspec}.all.rock"
source=("$_pkgname::git+https://github.com/lunarmodules/Penlight.git")
sha256sums=('SKIP')

pkgver() {
	cd "$_pkgname"
	git describe --long --tags --abbrev=7 HEAD |
		sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$_pkgname"
	for LUAVER in 5.{1,2,3,4}; do
		luarocks --lua-version "$LUAVER" \
			make --pack-binary-rock --deps-mode none -- "$_rockspec"
		install -Dm0644 -t "lua-$LUAVER/" "$_rock"
	done
}

_package() {
	cd "$_pkgname"
	depends=("${pkgname%-*}" "${_luadeps[@]/#/${pkgname%-*}-}")
	provides=("${pkgname/%-git}")
	conflicts=("${pkgname/%-git}")
	luarocks --lua-version "$1" --tree "$pkgdir/usr/" \
		install --deps-mode none --no-manifest -- "lua-$1/$_rock"
	install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" CONTRIBUTING.md CHANGELOG.md README.md
	install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/manual/" docs/manual/*
	install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/examples/" examples/*
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE.md
}

package_lua-penlight-git() {
	_package 5.4
}

package_lua51-penlight-git() {
	_package 5.1
}

package_lua52-penlight-git() {
	_package 5.2
}

package_lua53-penlight-git() {
	_package 5.3
}