summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 49e0c555fd97488979aeecc4847f5ed3bc782668 (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
# Maintainer: HelloImWar <helloimwar at proton dot me>

pkgname=tree-sitter-lua-git
pkgver=0.0.14.r0.gfb30e8c
pkgrel=2
epoch=1
pkgdesc="Lua grammar for tree-sitter"
arch=('x86_64')
url="https://github.com/muniftanjim/tree-sitter-lua"
license=('MIT')
groups=('tree-sitter-grammars')
depends=('gcc-libs')
makedepends=('git' 'tree-sitter-cli' 'npm')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=("$pkgname::git+$url")
sha256sums=('SKIP')

pkgver() {
	git -C "$pkgname" describe --long --tags | sed 's/^v//;s/-/.r/;s/-/./'
}

prepare() {
	cd "$pkgname"
	tree-sitter generate
}

build() {
	cd "$pkgname/src/"
	cc $CFLAGS -std=c99 -c parser.c scanner.c
	c++ $LDFLAGS -shared parser.o scanner.o -o "$srcdir/parser.so"
}

package() {
	install -Dvm644 parser.so "$pkgdir/usr/lib/libtree-sitter-lua.so"
	install -dv "$pkgdir/usr/share/nvim/runtime/parser/"
	ln -sv "/usr/lib/libtree-sitter-lua.so" "$pkgdir/usr/share/nvim/runtime/parser/lua.so"
	cd "$pkgname"
	install -Dvm644 LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname/"
	install -Dvm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}