tree-sitter: Import tree-sitter-0.20.0
authorLeonardo Taccari <leot@NetBSD.org>
Tue, 10 Aug 2021 17:11:38 +0000 (19:11 +0200)
committerLeonardo Taccari <leot@NetBSD.org>
Tue, 10 Aug 2021 17:11:38 +0000 (19:11 +0200)
Tree-sitter is a parser generator tool and an incremental parsing
library. It can build a concrete syntax tree for a source file and
efficiently update the syntax tree as the source file is edited.
Tree-sitter aims to be:

 * General: enough to parse any programming language
 * Fast: enough to parse on every keystroke in a text editor
 * Robust: enough to provide useful results even in the presence
   of syntax errors
 * Dependency-free: so that the runtime library (which is written in pure C)
   can be embedded in any application

tree-sitter/DESCR [new file with mode: 0644]
tree-sitter/Makefile [new file with mode: 0644]
tree-sitter/PLIST [new file with mode: 0644]
tree-sitter/buildlink3.mk [new file with mode: 0644]
tree-sitter/distinfo [new file with mode: 0644]
tree-sitter/patches/patch-Makefile [new file with mode: 0644]

diff --git a/tree-sitter/DESCR b/tree-sitter/DESCR
new file mode 100644 (file)
index 0000000..c90f609
--- /dev/null
@@ -0,0 +1,11 @@
+Tree-sitter is a parser generator tool and an incremental parsing
+library. It can build a concrete syntax tree for a source file and
+efficiently update the syntax tree as the source file is edited.
+Tree-sitter aims to be:
+
+ * General: enough to parse any programming language
+ * Fast: enough to parse on every keystroke in a text editor
+ * Robust: enough to provide useful results even in the presence
+   of syntax errors
+ * Dependency-free: so that the runtime library (which is written in pure C)
+   can be embedded in any application
diff --git a/tree-sitter/Makefile b/tree-sitter/Makefile
new file mode 100644 (file)
index 0000000..bce3aec
--- /dev/null
@@ -0,0 +1,17 @@
+# $NetBSD$
+
+DISTNAME=      tree-sitter-0.20.0
+CATEGORIES=    devel
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=tree-sitter/}
+GITHUB_TAG=    v${PKGVERSION_NOREV}
+
+MAINTAINER=    pkgsrc-users@NetBSD.org
+HOMEPAGE=      https://tree-sitter.github.io/
+COMMENT=       Incremental parsing system for programming tools
+LICENSE=       mit
+
+USE_TOOLS+=    gmake
+
+PKGCONFIG_OVERRIDE+=   tree-sitter.pc.in
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/tree-sitter/PLIST b/tree-sitter/PLIST
new file mode 100644 (file)
index 0000000..bebbf67
--- /dev/null
@@ -0,0 +1,8 @@
+@comment $NetBSD$
+include/tree_sitter/api.h
+include/tree_sitter/parser.h
+lib/libtree-sitter.a
+lib/libtree-sitter.so
+lib/libtree-sitter.so.0
+lib/libtree-sitter.so.0.0
+lib/pkgconfig/tree-sitter.pc
diff --git a/tree-sitter/buildlink3.mk b/tree-sitter/buildlink3.mk
new file mode 100644 (file)
index 0000000..d663117
--- /dev/null
@@ -0,0 +1,12 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=       tree-sitter
+
+.if !defined(TREE_SITTER_BUILDLINK3_MK)
+TREE_SITTER_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.tree-sitter+=    tree-sitter>=0.20.0
+BUILDLINK_PKGSRCDIR.tree-sitter?=      ../../wip/tree-sitter
+.endif # TREE_SITTER_BUILDLINK3_MK
+
+BUILDLINK_TREE+=       -tree-sitter
diff --git a/tree-sitter/distinfo b/tree-sitter/distinfo
new file mode 100644 (file)
index 0000000..f619cde
--- /dev/null
@@ -0,0 +1,7 @@
+$NetBSD$
+
+SHA1 (tree-sitter-0.20.0.tar.gz) = 8f4332cf35059717ce3129373a4b10d8dd278327
+RMD160 (tree-sitter-0.20.0.tar.gz) = 8563780e6f33137b7d36e7db3abfd379ba866f66
+SHA512 (tree-sitter-0.20.0.tar.gz) = a51fa0af45a6a99bb74ff53c15a4d7939eb24c6720e65ec7a96f74ffbce54801f14539e071ec6a4891dae778d7dea5edcecc6dd57716cc70a891c9e6cfa55013
+Size (tree-sitter-0.20.0.tar.gz) = 2876764 bytes
+SHA1 (patch-Makefile) = 9dcde8bb8924cfe80ff4e24fad56528b271a86cf
diff --git a/tree-sitter/patches/patch-Makefile b/tree-sitter/patches/patch-Makefile
new file mode 100644 (file)
index 0000000..f85255c
--- /dev/null
@@ -0,0 +1,26 @@
+$NetBSD$
+
+- Avoid to possibly pass extra optimization CFLAGS
+- Do not override PCLIBDIR for FreeBSD, NetBSD and DragonFly
+
+--- Makefile.orig      2021-06-30 00:18:39.000000000 +0000
++++ Makefile
+@@ -18,7 +18,7 @@ endif
+ OBJ := $(SRC:.c=.o)
+ # define default flags, and override to append mandatory flags
+-CFLAGS ?= -O3 -Wall -Wextra -Werror
++CFLAGS ?= -Wall -Wextra -Werror
+ override CFLAGS += -std=gnu99 -fPIC -Ilib/src -Ilib/include
+ # ABI versioning
+@@ -37,9 +37,6 @@ else
+       SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR)
+       LINKSHARED += -shared -Wl,-soname,libtree-sitter.so.$(SONAME_MAJOR)
+ endif
+-ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
+-      PCLIBDIR := $(PREFIX)/libdata/pkgconfig
+-endif
+ all: libtree-sitter.a libtree-sitter.$(SOEXTVER)