Skip to content

tree-sitter: update to 0.26.7#59449

Open
jl4c wants to merge 5 commits intovoid-linux:masterfrom
jl4c:tree-sitter
Open

tree-sitter: update to 0.26.7#59449
jl4c wants to merge 5 commits intovoid-linux:masterfrom
jl4c:tree-sitter

Conversation

@jl4c
Copy link

@jl4c jl4c commented Mar 18, 2026

Testing the changes

  • I tested the changes in this PR: YES

Notes

tree-sitter 0.26 introduced rquickjs (QuickJS JS runtime) as a CLI
dependency, breaking cross-compilation for armv6l-musl, armv7l, aarch64
and aarch64-musl. The disable-qjs-rt.patch disables the qjs-rt feature
to fix this.

neovim and emacs require patches to adapt to the new tree-sitter 0.26
API (ts_language_version was replaced by ts_language_abi_version,
ts_parser_set_timeout_micros was replaced by TSParseOptions callback).

Local build testing

  • I built this PR locally for my native architecture, x86_64-glibc
  • I built this PR locally for these architectures (if supported. mark crossbuilds):
    • aarch64 (crossbuild)
    • aarch64-musl (crossbuild)
    • armv6l-musl (crossbuild)
    • armv7l (crossbuild)

@jl4c jl4c force-pushed the tree-sitter branch 4 times, most recently from 5268c1e to 5a1386f Compare March 18, 2026 22:15

do_build() {
cargo auditable build ${XBPS_VERBOSE+-v} --release --offline \
cargo auditable build ${XBPS_VERBOSE+-v} --release \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should still be locked or offline, the whole point is that the versions are choosen as specified in the lock file.

@Duncaen
Copy link
Member

Duncaen commented Mar 20, 2026

You might be able to make cross compilation work with something like this #57605 (comment) if the issue is cc-rs.

@Duncaen
Copy link
Member

Duncaen commented Mar 20, 2026

This shouldn't work because there is no way to set BINDGEN_EXTRA_CLANG_ARGS for either target or host, but it compiles, without BINDGEN_EXTRA_CLANG_ARGS it bindgen will use host headers, but I guess there is at the moment nothing that would conflict between hosts and targets.

diff --git a/srcpkgs/tree-sitter/patches/disable-qjs-rt.patch b/srcpkgs/tree-sitter/patches/disable-qjs-rt.patch
deleted file mode 100644
index cdecd0f667b..00000000000
--- a/srcpkgs/tree-sitter/patches/disable-qjs-rt.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml
-index c10b465..0a3319b 100644
---- a/crates/cli/Cargo.toml
-+++ b/crates/cli/Cargo.toml
-@@ -30,7 +30,7 @@ name = "benchmark"
- harness = false
- 
- [features]
--default = ["qjs-rt"]
-+default = []
- wasm = ["tree-sitter/wasm", "tree-sitter-loader/wasm"]
- qjs-rt = ["tree-sitter-generate/qjs-rt"]
- 
-diff --git a/crates/generate/Cargo.toml b/crates/generate/Cargo.toml
-index 5e93bf4..1ad9cd6 100644
---- a/crates/generate/Cargo.toml
-+++ b/crates/generate/Cargo.toml
-@@ -20,7 +20,7 @@ path = "src/generate.rs"
- workspace = true
- 
- [features]
--default = ["qjs-rt"]
-+default = ["load"]
- load = ["dep:semver"]
- qjs-rt = ["load", "rquickjs", "pathdiff"]
diff --git a/srcpkgs/tree-sitter/template b/srcpkgs/tree-sitter/template
index 692d2947466..08ed7ee4101 100644
--- a/srcpkgs/tree-sitter/template
+++ b/srcpkgs/tree-sitter/template
@@ -14,9 +14,25 @@ distfiles="https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v${versi
 checksum=4343107ad1097a35e106092b79e5dd87027142c6fba5e4486b1d1d44d5499f84
 make_check=no # tests require generating fixtures from remote repositories
 
-do_build() {
-	cargo auditable build ${XBPS_VERBOSE+-v} --release \
-		--target ${RUST_TARGET} ${configure_args} ${make_build_args}
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	XBPS_CROSS_RUSTFLAGS+=" -latomic"
+fi
+
+_setup_env() {
+	# workaround the cc-rs mixing CFLAGS for host and target.
+	# https://github.com/rust-lang/cc-rs/issues/1469
+	export CFLAGS_${RUST_BUILD//-/_}="${CFLAGS_host}" \
+		   CXXFLAGS_${RUST_BUILD//-/_}="${CXXFLAGS_host}" \
+		   LDFLAGS_${RUST_BUILD//-/_}="${LDFLAGS_host}" \
+		   CFLAGS_${RUST_TARGET//-/_}="${CFLAGS}" \
+		   CXXFLAGS_${RUST_TARGET//-/_}="${CXXFLAGS}" \
+		   LDFLAGS_${RUST_TARGET//-/_}="${LDFLAGS}" \
+		   CFLAGS="" CXXFLAGS="" LDFLAGS=""
+	unset BINDGEN_EXTRA_CLANG_ARGS
+}
+
+pre_build() {
+	_setup_env
 }
 
 post_build() {
@@ -24,6 +40,10 @@ post_build() {
 	make
 }
 
+pre_install() {
+	_setup_env
+}
+
 post_install() {
 	# Install libtree-sitter, since do_install installs the tree-sitter CLI.
 	make STRIP=true PREFIX=/usr DESTDIR=${DESTDIR} install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants