summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorJelle Licht <jlicht@fsfe.org>2021-03-30 01:27:41 -0400
committerJelle Licht <jlicht@fsfe.org>2021-04-02 18:04:23 +0200
commit91b78f371e13fb0116055d5987f65641467044ad (patch)
tree5da1f47d2a1b9c83188dbec1357cda03cdf38107 /gnu/packages
parent82e7f7c029c36e9e1109ca7f1c191cceca27b278 (diff)
downloadguix-91b78f371e13fb0116055d5987f65641467044ad.tar.gz
gnu: Add node-llparse-bootstrap.
* gnu/packages/node.scm (node-llparse-bootstrap): New variable.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/node.scm56
1 files changed, 56 insertions, 0 deletions
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 16c3decdd4..5336012e43 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -454,6 +454,62 @@ Node.js and web browsers.")
     (description "This package is a frontend for the llparse compiler.")
     (license license:expat)))
 
+(define-public node-llparse-bootstrap
+  (package
+    (name "node-llparse")
+    (version "7.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/indutny/llparse.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "10da273iy2if88hp79cwms6c8qpsl1fkgzll6gmqyx5yxv5mkyp6"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Fix imports for esbuild.
+           ;; https://github.com/evanw/esbuild/issues/477
+           (substitute* '("src/compiler/index.ts"
+                          "src/implementation/c/node/base.ts"
+                          "src/implementation/c/node/table-lookup.ts"
+                          "src/implementation/c/compilation.ts"
+                          "src/implementation/c/helpers/match-sequence.ts"
+                          "src/implementation/c/code/mul-add.ts")
+             (("\\* as assert") "assert")
+             (("\\* as debugAPI") "debugAPI"))
+           #t))))
+    (build-system node-build-system)
+    (arguments
+     `(#:node ,node-bootstrap
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((esbuild (string-append (assoc-ref inputs "esbuild")
+                                           "/bin/esbuild")))
+               (invoke esbuild
+                       "--platform=node"
+                       "--outfile=lib/api.js"
+                       "--bundle"
+                       "src/api.ts")))))))
+    (inputs
+     `(("node-debug" ,node-debug-bootstrap)
+       ("node-llparse-frontend" ,node-llparse-frontend-bootstrap)))
+    (native-inputs
+     `(("esbuild" ,esbuild)))
+    (home-page "https://github.com/nodejs/llparse#readme")
+    (properties '((hidden? . #t)))
+    (synopsis "Compile incremental parsers to C code")
+    (description "This package offers an API for compiling an incremental
+parser definition into a C output.")
+    (license license:expat)))
+
 (define-public libnode
   (package/inherit node
     (name "libnode")