aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-lustache/APKBUILD
blob: 771cc12060c24842fa9150f94e1edf9302e6510a (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
71
72
73
74
75
76
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
_name=lustache
pkgname=lua-$_name
pkgver=1.3
pkgrel=3
pkgdesc="Logic-less {{mustache}} templates with Lua"
url="http://olivinelabs.com/lustache/"
arch="noarch"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages="$pkgname-common"
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-$_name:split_${_i/./_}"
done
source="lua-lustache-$pkgver.tar.gz::https://github.com/Olivine-Labs/lustache/archive/v$pkgver.tar.gz"

_builddir="$srcdir"/lustache-$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
}

build() {
	cd "$_builddir"
}

package() {
	cd "$_builddir"
	mkdir -p "$pkgdir"/usr/share/lua/common/lustache

	install -m644 src/lustache/*.lua \
		"$pkgdir"/usr/share/lua/common/lustache/ || return 1
	install -m644 src/lustache.lua \
		"$pkgdir"/usr/share/lua/common/

	for _v in $_luaversions; do
		mkdir -p "$pkgdir"/usr/share/lua/$_v
		for i in lustache lustache.lua; do
			ln -s ../common/$i "$pkgdir"/usr/share/lua/$_v/$i \
				|| return 1
		done
	done
}


common() {
	pkgdesc="Logic-less {{mustache}} templates with Lua $1"
	mkdir -p "$subpkgdir"/usr/share/lua/
	mv "$pkgdir"/usr/share/lua/common "$subpkgdir"/usr/share/lua/
}

_split() {
	pkgdesc="Logic-less {{mustache}} templates with Lua $1"
	install_if="lua$1 $pkgname=$pkgver-r$pkgrel"
	depends="$pkgname-common"
	mkdir -p "$subpkgdir"/usr/share/lua/
	mv "$pkgdir"/usr/share/lua/$1 "$subpkgdir"/usr/share/lua/ || return 1
}

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

md5sums="4ac0cd6dfda1e5f3ba44375b560da58b  lua-lustache-1.3.tar.gz"
sha256sums="e694b9bc58fb5e6cebf7840137a5b5ecafcc27a75c33a5da5b0cf6fef1a6906d  lua-lustache-1.3.tar.gz"
sha512sums="c98a18476150faa330ae99401da227f84af7c1e6c5a5f37653ba0a9b92e3d878b67f47c8163d5b90fc2e731a0786e45ce41fbdaaf977c4370e77a3f2cf3b1ec9  lua-lustache-1.3.tar.gz"