gnu: tree-sitter: Update to 0.25.3.

* gnu/packages/tree-sitter.scm (tree-sitter): Update to 0.25.3.
[arguments]<#:phases>: Add 'patch-_ts_dup-visibility for linking with Rust
bindings.
(tree-sitter-cli)[source]: Keep files required for building bindings.
[inputs]: Use ‘cargo-inputs’.
[arguments]: Remove #:cargo-inputs, #:cargo-development-inputs.
<#:cargo-test-flags>: Adjust failing tests to skip.
<#:cargo-install-paths>: Add "cli".
<#:phases>: Merge 'patch-node and 'patch-dot into 'patch-references.
Update their references and use ‘search-input-file’.
Remove modification of 'install, #:cargo-install-paths now takes care of the
installation.
* gnu/packages/rust-crates.scm (lookup-cargo-inputs)[tree-sitter-cli]: New
entry.
* guix/build/tree-sitter-build-system.scm
(patch-dependencies): Drop `peerDependencies' from package.json.
(build): Remove deprecated ‘--no-bindings’ option.
(check): Set CC.
(install): Add `src' to include directories in order for external
scanners to find `tree_sitter/parser.h'.

Co-authored-by: Hilton Chain <hako@ultrarare.space>
Change-Id: I3941a1785be8deb60f288fcd5983255f075f9215
Signed-off-by: Hilton Chain <hako@ultrarare.space>
This commit is contained in:
Jean-Pierre De Jesus DIAZ 2025-04-12 01:35:34 +08:00 committed by Hilton Chain
parent 329466a25a
commit f0560f865a
No known key found for this signature in database
GPG key ID: ACC66D09CA528292
3 changed files with 592 additions and 64 deletions

View file

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2024 Foundation Devices, Inc. <hello@foundation.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@ -52,6 +53,8 @@ and replace development dependencies with tree-sitter grammar node modules."
(map (match-lambda
(("dependencies" dependencies ...)
'("dependencies"))
(("peerDependencies" peer-dependencies ...)
'("peerDependencies"))
(("devDependencies" dev-dependencies ...)
`("devDependencies"
,@(filter-map (match-lambda
@ -75,14 +78,15 @@ and replace development dependencies with tree-sitter grammar node modules."
(define* (build #:key grammar-directories #:allow-other-keys)
(for-each (lambda (dir)
(with-directory-excursion dir
;; Avoid generating binding code for other languages, we do
;; not support this use-case yet and it relies on running
;; `node-gyp' to build native addons.
(invoke "tree-sitter" "generate" "--no-bindings")))
(invoke "tree-sitter" "generate")))
grammar-directories))
(define* (check #:key grammar-directories tests? #:allow-other-keys)
(define* (check #:key grammar-directories tests? target #:allow-other-keys)
(when tests?
(setenv "CC"
(if target
(string-append target "-gcc")
"gcc"))
(for-each (lambda (dir)
(with-directory-excursion dir
(invoke "tree-sitter" "test")))
@ -111,6 +115,7 @@ and replace development dependencies with tree-sitter grammar node modules."
"-O2"
"-g"
"-o" ,(string-append lib "/libtree-sitter-" lang ".so")
"-Isrc"
;; An additional `scanner.{c,cc}' file is sometimes
;; provided.
,@(cond