Subject: Updating node.js
From: Daniel Gerber <[email-masked]>
To: [email-masked]
Date: Mon, 18 Feb 2019 15:36:42 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Trying to build the current upstream version, 11.10.0...

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a0221601d..9d35765eb 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -45,26 +45,17 @@
 (define-public node
   (package
     (name "node")
-    (version "9.11.1")
+    (version "11.10.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
-                                  "/node-v" version ".tar.gz"))
+                                  "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1vjh9zvw7wkdz6b0l99ya7mqjk0l8lbg9isr1q8rxwp400dhkk32"))
+                "1kyi35qkg7h5nk0cjdgy8pfm5v2qmzqc7k3app2c8226mrkarhlz"))
               (modules '((guix build utils)))
               (snippet
                `(begin
-                  ;; Remove bundled software.
-                  (for-each delete-file-recursively
-                            '("deps/cares"
-                              "deps/http_parser"
-                              "deps/icu-small"
-                              "deps/nghttp2"
-                              "deps/openssl"
-                              "deps/uv"
-                              "deps/zlib"))
                   (substitute* "Makefile"
                     ;; Remove references to bundled software.
                     (("deps/http_parser/http_parser.gyp") "")
@@ -74,7 +65,6 @@
                   #t))))
     (build-system gnu-build-system)
     (arguments
-     ;; TODO: Purge the bundled copies from the source.
      '(#:configure-flags '("--shared-cares"
                            "--shared-http-parser"
                            "--shared-libuv"
@@ -110,14 +100,6 @@
                (("'/usr/bin/env'")
                 (string-append "'" (which "env") "'")))

-             ;; FIXME: These tests depend on being able to install eslint.
-             ;; See https://github.com/nodejs/node/issues/17098.
-             (for-each delete-if-exists
-                       '("test/parallel/test-eslint-alphabetize-errors.js"
-                         "test/parallel/test-eslint-buffer-constructor.js"
-                         "test/parallel/test-eslint-documented-errors.js"
-                         "test/parallel/test-eslint-inspector-check.js"))
-
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
              (for-each delete-if-exists
@@ -184,9 +166,9 @@
      `(("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
        ("icu4c" ,icu4c)
-       ("libuv" ,libuv-1.19)
+       ("libuv" ,libuv)
        ("nghttp2" ,nghttp2 "lib")
-       ("openssl" ,openssl)
+       ("openssl" ,openssl-next)
        ("zlib" ,zlib)))
     (synopsis "Evented I/O for V8 JavaScript")
     (description "Node.js is a platform built on Chrome's JavaScript runtime

Notes on v11.10.0:
- it does support [email-masked]
- it ships with libuv 1.26.0 (1.24.0 in guix)
- some previously bundled deps are absent from tarball
- NODE_EXPERIMENTAL_HTTP is a no-op / always defined

There is an issue with the alternative http parser, `llhttp`. The 
choice of parser is at runtime, and one compile flag, 
--shared-http-parser, configures both. Building fails with:

```
g++ -o 
/tmp/guix-build-node-11.10.0.drv-0/node-v11.10.0/out/Release/obj.target/node_lib/src/node_http_parser_llhttp.o 
../src/node_http_parser_llhttp.cc '-DNODE_ARCH="x64"' 
'-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' 
'-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' 
'-DHAVE_INSPECTOR=1' '-DNODE_REPORT' '-D__POSIX__' 
'-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' 
'-DHAVE_OPENSSL=1' -I../src 
-I/tmp/guix-build-node-11.10.0.drv-0/node-v11.10.0/out/Release/obj/gen 
-I/tmp/guix-build-node-11.10.0.drv-0/node-v11.10.0/out/Release/obj/gen/include 
-I/tmp/guix-build-node-11.10.0.drv-0/node-v11.10.0/out/Release/obj/gen/src 
-I../deps/histogram/src -I../deps/v8/include 
-I../deps/brotli/c/include  -pthread -Wall -Wextra 
-Wno-unused-parameter -m64 -Wall -Wextra -Wno-unused-parameter -O3 
-fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y 
-MMD -MF 
/tmp/guix-build-node-11.10.0.drv-0/node-v11.10.0/out/Release/.deps//tmp/guix-build-node-11.10.0.drv-0/node-v11.10.0/out/Release/obj.target/node_lib/src/node_http_parser_llhttp.o.d.raw 
-c
In file included from ../src/node_http_parser_impl.h:41:0,
                 from ../src/node_http_parser_llhttp.cc:3:
../src/http_parser_adaptor.h:5:21: fatal error: llhttp.h: No such 
file or directory
```

AFAIU, either llhttp has to be made a separate package and listed 
in inputs, or http-parser linked statically. Or should the missing 
-I../deps/llhttp/include argument be passed here somehow -- maybe 
patching node.gypi?

I have not tried to build 10.15.1(LTS), which presumably has the 
same issues as in #32095.

Also, should previous version branches (8.x, 9.x) be kept in guix?

In the meantime, these minor updates work fine:
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a0221601d..8ffd60133 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -45,14 +45,14 @@
 (define-public node
   (package
     (name "node")
-    (version "9.11.1")
+    (version "9.11.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
-                                  "/node-v" version ".tar.gz"))
+                                  "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1vjh9zvw7wkdz6b0l99ya7mqjk0l8lbg9isr1q8rxwp400dhkk32"))
+                "04y2dnbf6jl8j0ykfkdwhir09h274d13k843d7lqfz3bgyn4wj06"))
               (modules '((guix build utils)))
               (snippet
                `(begin
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a0221601d..c52e21cf6 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -202,11 +202,11 @@ devices.")
   (package
     (inherit node)
     (name "node-lts")
-    (version "8.12.0")
+    (version "8.15.0")
     (source (origin
               (inherit (package-source node))
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "16j1rrxkhmvpcw689ndw1raql1gz4jqn7n82z55zn63c05cgz7as"))))))
+                "0cy6lzk9sn545kkc0jviv0k0hn30kindrpkkkmv3zk2774rj71cn"))))))