Skip to content

Commit 9852249

Browse files
authored
Merge pull request #1436 from hadfl/tslang
add tree-sitter-langs
2 parents 4fbea77 + 8e08fd2 commit 9852249

File tree

9 files changed

+218
-4
lines changed

9 files changed

+218
-4
lines changed

build/emacs/build.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ SUMMARY="Emacs editor"
2323
DESC="An extensible, customizable, free/libre text editor - and more."
2424

2525
BUILD_DEPENDS_IPS="library/ncurses"
26-
RUN_DEPENDS_IPS="file/gnu-findutils"
26+
RUN_DEPENDS_IPS="
27+
file/gnu-findutils
28+
ooce/text/tree-sitter-langs
29+
"
2730

2831
OPREFIX=$PREFIX
2932
PREFIX+=/$PROG

build/tree-sitter-langs/build.sh

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/bash
2+
#
3+
# {{{ CDDL HEADER
4+
#
5+
# This file and its contents are supplied under the terms of the
6+
# Common Development and Distribution License ("CDDL"), version 1.0.
7+
# You may only use this file in accordance with the terms of version
8+
# 1.0 of the CDDL.
9+
#
10+
# A full copy of the text of the CDDL should have accompanied this
11+
# source. A copy of the CDDL is also available via the Internet at
12+
# http://www.illumos.org/license/CDDL.
13+
# }}}
14+
15+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
16+
17+
. ../../lib/build.sh
18+
19+
PROG=tree-sitter-langs
20+
VER=0.12.171
21+
PKG=ooce/text/tree-sitter-langs
22+
SUMMARY="$PROG"
23+
DESC="Tree-sitter Language Bundle for Emacs"
24+
25+
set_arch 64
26+
27+
NO_SONAME_EXPECTED=1
28+
SKIP_SSP_CHECK=1
29+
30+
build() {
31+
logmsg "Building 64-bit"
32+
33+
pushd $TMPDIR/$BUILDDIR >/dev/null
34+
35+
# a few builds fail; others terminate non-zero although the language
36+
# library built correctly. we don't check for build success but rather
37+
# check whether all libraries are present by comparing to a baseline
38+
logcmd ./script/compile all
39+
40+
popd >/dev/null
41+
42+
destdir="$DESTDIR$PREFIX/${LIBDIRS[amd64]}"
43+
logcmd $MKDIR -p $destdir || logerr "mkdir failed"
44+
45+
pushd $TMPDIR/$BUILDDIR/bin >/dev/null
46+
47+
for f in *.so; do
48+
logcmd $CP $f $destdir/libtree-sitter-$f || logerr "copying $f failed"
49+
done
50+
51+
popd >/dev/null
52+
53+
convert_ctf $destdir
54+
55+
logmsg "comparing baseline"
56+
57+
pushd $destdir >/dev/null
58+
59+
logcmd $DIFF -u $SRCDIR/files/baseline <($LS -1) || logerr "baseline mismatch"
60+
61+
popd >/dev/null
62+
}
63+
64+
init
65+
clone_github_source $PROG "$GITHUB/emacs-tree-sitter/$PROG" $VER
66+
append_builddir $PROG
67+
patch_source
68+
prep_build
69+
build
70+
make_package
71+
clean_up
72+
73+
# Vim hints
74+
# vim:ts=4:sw=4:et:fdm=marker
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
libtree-sitter-ada.so
2+
libtree-sitter-agda.so
3+
libtree-sitter-asm.so
4+
libtree-sitter-bash.so
5+
libtree-sitter-bibtex.so
6+
libtree-sitter-c-sharp.so
7+
libtree-sitter-c.so
8+
libtree-sitter-clojure.so
9+
libtree-sitter-cmake.so
10+
libtree-sitter-css.so
11+
libtree-sitter-csv.so
12+
libtree-sitter-dockerfile.so
13+
libtree-sitter-dtd.so
14+
libtree-sitter-elisp.so
15+
libtree-sitter-elixir.so
16+
libtree-sitter-elm.so
17+
libtree-sitter-fish.so
18+
libtree-sitter-fortran.so
19+
libtree-sitter-git-rebase.so
20+
libtree-sitter-gitattributes.so
21+
libtree-sitter-gitcommit.so
22+
libtree-sitter-gitignore.so
23+
libtree-sitter-gleam.so
24+
libtree-sitter-go.so
25+
libtree-sitter-haskell.so
26+
libtree-sitter-hcl.so
27+
libtree-sitter-heex.so
28+
libtree-sitter-html.so
29+
libtree-sitter-jai.so
30+
libtree-sitter-janet-simple.so
31+
libtree-sitter-java.so
32+
libtree-sitter-javascript.so
33+
libtree-sitter-jsdoc.so
34+
libtree-sitter-json.so
35+
libtree-sitter-jsonnet.so
36+
libtree-sitter-julia.so
37+
libtree-sitter-kotlin.so
38+
libtree-sitter-latex.so
39+
libtree-sitter-llvm-mir.so
40+
libtree-sitter-llvm.so
41+
libtree-sitter-lua.so
42+
libtree-sitter-magik.so
43+
libtree-sitter-make.so
44+
libtree-sitter-matlab.so
45+
libtree-sitter-mermaid.so
46+
libtree-sitter-meson.so
47+
libtree-sitter-ninja.so
48+
libtree-sitter-nix.so
49+
libtree-sitter-noir.so
50+
libtree-sitter-ocaml-interface.so
51+
libtree-sitter-ocaml.so
52+
libtree-sitter-pascal.so
53+
libtree-sitter-perl.so
54+
libtree-sitter-pgn.so
55+
libtree-sitter-prisma.so
56+
libtree-sitter-python.so
57+
libtree-sitter-racket.so
58+
libtree-sitter-rst.so
59+
libtree-sitter-ruby.so
60+
libtree-sitter-rust.so
61+
libtree-sitter-scala.so
62+
libtree-sitter-scheme.so
63+
libtree-sitter-solidity.so
64+
libtree-sitter-sql.so
65+
libtree-sitter-svelte.so
66+
libtree-sitter-swift.so
67+
libtree-sitter-tablegen.so
68+
libtree-sitter-toml.so
69+
libtree-sitter-twig.so
70+
libtree-sitter-vhdl.so
71+
libtree-sitter-xml.so
72+
libtree-sitter-zig.so

build/tree-sitter-langs/local.mog

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# This file and its contents are supplied under the terms of the
3+
# Common Development and Distribution License ("CDDL"), version 1.0.
4+
# You may only use this file in accordance with the terms of version
5+
# 1.0 of the CDDL.
6+
#
7+
# A full copy of the text of the CDDL should have accompanied this
8+
# source. A copy of the CDDL is also available via the Internet at
9+
# http://www.illumos.org/license/CDDL.
10+
11+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
12+
13+
license LICENSE license=MIT
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 34fa0739fb74b6940e3d34c431d978f3152758e8 Mon Sep 17 00:00:00 2001
2+
From: Dominik Hassler <[email protected]>
3+
Date: Fri, 5 Apr 2024 18:20:46 +0000
4+
Subject: [PATCH] initial illumos support
5+
6+
---
7+
tree-sitter-langs-build.el | 21 +++++++++++++++++++++
8+
1 file changed, 21 insertions(+)
9+
10+
diff --git a/tree-sitter-langs-build.el b/tree-sitter-langs-build.el
11+
index 2e62cfed..f4b96044 100644
12+
--- a/tree-sitter-langs-build.el
13+
+++ b/tree-sitter-langs-build.el
14+
@@ -244,6 +244,7 @@ infrequent (grammar-only changes). It is different from the version of
15+
('gnu/linux "linux")
16+
('berkeley-unix "freebsd")
17+
('windows-nt "windows")
18+
+ ('usg-unix-v "illumos")
19+
(_ (error "Unsupported system-type %s" system-type))))
20+
21+
(defconst tree-sitter-langs--suffixes '(".dylib" ".dll" ".so")
22+
@@ -410,6 +411,26 @@ from the current state of the grammar repo, without cleanup."
23+
"-I" "src"
24+
"src/parser.c"
25+
"-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))))
26+
+ ((memq system-type '(usg-unix-v))
27+
+ (cond
28+
+ ((file-exists-p "src/scanner.cc")
29+
+ (tree-sitter-langs--call
30+
+ "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2"
31+
+ "-I" "src"
32+
+ "src/scanner.cc" "-xc" "src/parser.c"
33+
+ "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))
34+
+ ((file-exists-p "src/scanner.c")
35+
+ (tree-sitter-langs--call
36+
+ "gcc" "-shared" "-fPIC" "-g" "-O2"
37+
+ "-I" "src"
38+
+ "src/scanner.c" "src/parser.c"
39+
+ "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))
40+
+ (:default
41+
+ (tree-sitter-langs--call
42+
+ "gcc" "-shared" "-fPIC" "-g" "-O2"
43+
+ "-I" "src"
44+
+ "src/parser.c"
45+
+ "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))))
46+
(:default (tree-sitter-langs--call "tree-sitter" "test")))))
47+
;; Replace underscores with hyphens. Example: c_sharp.
48+
(let ((default-directory bin-dir))
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
illumos.patch

doc/baseline

+1
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ extra.omnios ooce/text/docbook-xsl
266266
extra.omnios ooce/text/hunspell
267267
extra.omnios ooce/text/ripgrep
268268
extra.omnios ooce/text/texinfo
269+
extra.omnios ooce/text/tree-sitter-langs
269270
extra.omnios ooce/text/xsv
270271
extra.omnios ooce/util/acmefetch
271272
extra.omnios ooce/util/atuin

doc/packages.md

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
| ooce/text/hunspell | 1.7.2 | https://github.com/hunspell/hunspell/releases | [omniosorg](https://github.com/omniosorg)
223223
| ooce/text/ripgrep | 14.1.0 | https://github.com/BurntSushi/ripgrep/releases | [omniosorg](https://github.com/omniosorg)
224224
| ooce/text/texinfo | 7.1 | https://ftp.gnu.org/gnu/texinfo/ https://www.gnu.org/software/texinfo/ | [omniosorg](https://github.com/omniosorg)
225+
| ooce/text/tree-sitter-langs | 0.12.171 | https://github.com/emacs-tree-sitter/tree-sitter-langs/releases | [omniosorg](https://github.com/omniosorg)
225226
| ooce/text/xsv | 0.13.0 | https://github.com/BurntSushi/xsv/releases | [omniosorg](https://github.com/omniosorg)
226227
| ooce/util/acmefetch | 0.8.1 | https://github.com/oetiker/AcmeFetch/releases | [omniosorg](https://github.com/omniosorg)
227228
| ooce/util/atuin | 18.1.0 | https://github.com/atuinsh/atuin/releases | [omniosorg](https://github.com/omniosorg)

lib/config.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ GNUBIN=/usr/gnu/bin
211211
# Define variables for standard utilities so that we can choose to run the
212212
# native version even if a build script modifies the path to put GNUBIN first.
213213
for util in \
214-
basename cat comm cut dis tput digest mktemp sort sed tee rm mv cp mkdir \
215-
rmdir readlink ln ls chmod touch grep time find fgrep egrep uniq stat \
216-
strip sleep tail date
214+
basename cat comm cut diff dis tput digest mktemp sort sed tee rm mv cp \
215+
mkdir rmdir readlink ln ls chmod touch grep time find fgrep egrep uniq \
216+
stat strip sleep tail date
217217
do
218218
declare -n _var=${util^^}
219219
declare -g _var=$USRBIN/$util

0 commit comments

Comments
 (0)