GNU bug report logs - #47282
[PATCH 00/13] node going forward

Previous Next

Package: guix-patches;

Reported by: Jelle Licht <jlicht <at> fsfe.org>

Date: Sat, 20 Mar 2021 14:58:02 UTC

Severity: normal

Tags: patch

Done: Jelle Licht <jlicht <at> fsfe.org>

Bug is archived. No further changes may be made.

Full log


Message #41 received at 47282 <at> debbugs.gnu.org (full text, mbox):

From: Jelle Licht <jlicht <at> fsfe.org>
To: 47282 <at> debbugs.gnu.org
Subject: [PATCH 12/13] gnu: node: Add llhttp-bootstrap.
Date: Sat, 20 Mar 2021 15:59:24 +0100
* gnu/packages/node.scm (llhttp-bootstrap): New package.
---
 gnu/packages/node.scm | 67 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 380e959a58..d44bec7ca4 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -539,6 +539,73 @@ compiler.")
 definition into a C output.")
     (license license:expat)))
 
+(define-public llhttp-bootstrap
+  (package
+    (name "llhttp")
+    (version "2.1.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nodejs/llhttp.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "08ylnirqrk63h0ww1m79p0bh6rwayrhd4v28p353qlp3qcffwwb0"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Fix incorrect import semantics
+                  ;; https://github.com/evanw/esbuild/issues/477
+                  (substitute* "src/llhttp/http.ts"
+                    (("\\* as assert")
+                     "assert"))
+                  (substitute* "Makefile"
+                    (("npx ts-node bin/generate.ts")
+                     "node bin/generate.js"))
+                  #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; no tests
+       #:make-flags (list "CLANG=gcc"
+                          (string-append "DESTDIR=" (assoc-ref %outputs "out"))
+                          "PREFIX=")
+       #:phases (modify-phases %standard-phases
+                  (replace 'configure
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let ((esbuild (string-append
+                                      (assoc-ref inputs "esbuild")
+                                      "/bin/esbuild")))
+                        (invoke esbuild
+                                "--platform=node"
+                                "--outfile=bin/generate.js"
+                                "--bundle" "bin/generate.ts"))))
+                  (add-before 'install 'create-install-directories
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (for-each (lambda (dir)
+                                    (mkdir-p (string-append out dir)))
+                                  (list "/lib" "/include" "/src"))
+                        #t)))
+                  (add-after 'install 'install-src
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out"))
+                             (src-dir (string-append out "/src")))
+                        (install-file "build/c/llhttp.c" src-dir)
+                        #t))))))
+    (native-inputs
+     `(("esbuild" ,esbuild)
+       ("node" ,node-bootstrap)
+       ("node-semver" ,node-semver-bootstrap)
+       ("node-llparse-bootstrap" ,node-llparse-bootstrap)))
+    (home-page "https://github.com/nodejs/llhttp")
+    (properties '((hidden? . #t)))
+    (synopsis "Port of @code{http_parser} to @code{llparse}")
+    (description "@code{llhttp} is a port of @code{http_parser} to TypeScript.
+@code{llparse} is used to generate the output C source file, which can be
+compiled and linked with the embedder's program (like @code{Node.js}).")
+    (license license:expat)))
+
 (define-public libnode
   (package/inherit node
     (name "libnode")
-- 
2.31.0





This bug report was last modified 4 years and 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.