guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49946] [PATCH v2 14/33] gnu: Add tree-sitter-bash.


From: Pierre Langlois
Subject: [bug#49946] [PATCH v2 14/33] gnu: Add tree-sitter-bash.
Date: Sun, 29 Aug 2021 11:45:49 +0100

* gnu/packages/tree-sitter.scm (tree-sitter-bash): New variable.
---
 gnu/packages/tree-sitter.scm | 41 ++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm
index 07bdb54627..f98a7d392f 100644
--- a/gnu/packages/tree-sitter.scm
+++ b/gnu/packages/tree-sitter.scm
@@ -215,3 +215,44 @@ This package includes the @command{tree-sitter} 
command-line tool.")
     (description
       "This package provides a C++ grammar for the Tree-sitter library.")
     (license license:expat)))
+
+(define-public tree-sitter-bash
+  (package (inherit tree-sitter-c)
+    (name "tree-sitter-bash")
+    (version "0.19.0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/tree-sitter/tree-sitter-bash";)
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "18c030bb65r50i6z37iy7jb9z9i8i36y7b08dbc9bchdifqsijs5"))))
+    (native-inputs
+     `(("tree-sitter-cli" ,tree-sitter-cli)
+       ("node-nan" ,node-nan)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments tree-sitter-c)
+      ((#:phases phases)
+       `(modify-phases ,phases
+          ;; The `prebuild' dependency is a way to intercept the build step
+          ;; and download a prebuilt binary instead.  If we remove it then the
+          ;; buid system falls back to building from source.
+          (add-after 'unpack 'remove-prebuild-dependency
+            (lambda _
+              (with-atomic-file-replacement "package.json"
+                (lambda (in out)
+                  (use-modules ((guix build json)))
+                  (let ((package-meta (read-json in)))
+                    (assoc-remove! (assoc-ref package-meta "dependencies")
+                                   "prebuild-install")
+                    (assoc-remove! (assoc-ref package-meta "devDependencies")
+                                   "prebuild")
+                    (write-json package-meta out))))))))))
+    (home-page "https://github.com/tree-sitter/tree-sitter-bash";)
+    (synopsis "Tree-sitter Bash grammar")
+    (description
+      "This package provides a Bash grammar for the Tree-sitter library.")
+    (license license:expat)))
--
2.33.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]