summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9c515c2d61aad66d6a4c539dd7c6101acd813b9b (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
# Maintainer: Kevin Schoon <me at kevinschoon dot com>

pkgname=tree-sitter-ocaml
pkgver=0.20.4
pkgrel=2
pkgdesc="ocaml grammar for tree-sitter"
arch=('x86_64')
url="https://github.com/tree-sitter/tree-sitter-ocaml"
license=('MIT')
groups=('tree-sitter-grammars')
makedepends=('tree-sitter' 'tree-sitter-cli' 'npm')
provides=('libtree-sitter-ocaml')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('834dc225b6a00871bd4ba98efcec7f3882f3ec7043c6203fdc12396e77bcde6c')

prepare() {
	cd "$pkgname-$pkgver/ocaml"
	tree-sitter generate
	cd ../interface
	tree-sitter generate
}

build() {
	cd "$pkgname-$pkgver/ocaml/src"
	cc -shared -fno-exceptions -g -fPIC \
		-o "$srcdir/parser.so" scanner.c parser.c
	cd ../../interface/src
	cc -shared -fno-exceptions -g -fPIC \
		-o "$srcdir/parser-interface.so" scanner.c parser.c

}

package() {
	install -Dvm644 parser.so "$pkgdir/usr/lib/libtree-sitter-ocaml.so"
	# NOTE: some applications may not be aware of this distinction
	install -Dvm644 parser-interface.so "$pkgdir/usr/lib/libtree-sitter-ocaml_interface.so"
	install -dv "$pkgdir/usr/share/tree-sitter/queries/ocaml"
	cd "$pkgname-$pkgver"
	install -Dvm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
	install -Dvm644 "queries/highlights.scm" "$pkgdir/usr/share/tree-sitter/queries/ocaml/highlights.scm"
	install -Dvm644 "queries/locals.scm" "$pkgdir/usr/share/tree-sitter/queries/ocaml/locals.scm"
	install -Dvm644 "queries/tags.scm" "$pkgdir/usr/share/tree-sitter/queries/ocaml/tags.scm"
}