Subject: Re: bug#43228: r-v8 doesn't build since node 10.22 update

From: Pierre Langlois <[email-masked]>
Date: Sun, 06 Sep 2020 12:17:00 +0100

Mark H Weaver writes:

> Hi Pierre,
>
> Pierre Langlois <[email-masked]> writes:
>
>> Mark H Weaver writes:
>>
>>> One possible solution might be to update the replacement (graft) for
>>> _curl_ so that it's *built* against nghttp2-1.41.  Something like this
>>> (untested):
>>
>> I'm afraid this still doesn't solve the problem. AFAIU, grafting the new
>> curl happens after building r-v8, so at link time it still sees the old
>> nghttp2 version.
>
> Ah yes, that makes sense.
>
>> Instead, I'm thinking your suggestion of leaving 'node' at 10.19 for now
>> (or 10.20, I can try that) and then introduce a 'node-10.22' package
>> that can be used for Icecat is better.
>
> That indeed might be the best approach for now.
>
>> I can do that. How does that sound?
>
> Sure, sounds good.  Thanks!

Cool, here's a patch to do just that :-). I tried to update node to
10.21 but that still required the newer nghttp2 lib, but it worked for
10.20.

Thanks,
Pierre

From eb00ab49df23f7319009a9fec7fc2805016e2e25 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <[email-masked]>
Date: Sat, 5 Sep 2020 21:05:08 +0100
Subject: [PATCH] gnu: node: Downgrade to 10.20.0.

But keep version 10.22.0 around with a new node-10.22 variable.

* gnu/packages/node.scm (node): Downgrade to 10.22.0.
[inputs]: Downgrade nghttp2 to 1.40.
(node-10.22): New variable.
---
 gnu/packages/node.scm | 44 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index ed0b5c4f16..345668fa56 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -25,6 +25,7 @@

 (define-module (gnu packages node)
   #:use-module ((guix licenses) #:select (expat))
+  #:use-module ((guix build utils) #:select (alist-replace))
   #:use-module (guix packages)
   #:use-module (guix derivations)
   #:use-module (guix download)
@@ -47,14 +48,14 @@
 (define-public node
   (package
     (name "node")
-    (version "10.22.0")
+    (version "10.20.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1nz18fa550li10r0kzsm28c2rvvq61nq8bqdygip0rmvbi2paxg0"))
+                "0cvjwnl0wkcsyw3kannbdv01s235wrnp11n2s6swzjx95gpichfi"))
               (modules '((guix build utils)))
               (snippet
                `(begin
@@ -186,7 +187,7 @@
        ("http-parser" ,http-parser)
        ("icu4c" ,icu4c)
        ("libuv" ,libuv)
-       ("nghttp2" ,nghttp2-1.41 "lib")
+       ("nghttp2" ,nghttp2 "lib")
        ("openssl" ,openssl)
        ("zlib" ,zlib)))
     (synopsis "Evented I/O for V8 JavaScript")
@@ -200,6 +201,43 @@ devices.")
     (properties '((max-silent-time . 7200)     ;2h, needed on ARM
                   (timeout . 21600)))))        ;6h

+;; TODO: Make this the default node on core-updates.  This cannot be done on
+;; master since this version of node requires a newer nghttp2 library at link
+;; time.
+(define-public node-10.22
+  (package
+    (inherit node)
+    (version "10.22.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://nodejs.org/dist/v" version
+                                  "/node-v" version ".tar.xz"))
+              (sha256
+               (base32
+                "1nz18fa550li10r0kzsm28c2rvvq61nq8bqdygip0rmvbi2paxg0"))
+              (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") "")
+                    (("deps/uv/include/\\*.h") "")
+                    (("deps/uv/uv.gyp") "")
+                    (("deps/zlib/zlib.gyp") ""))
+                  #t))))
+    (inputs
+     (alist-replace "nghttp2" (list nghttp2-1.41 "lib")
+                    (package-inputs node)))))
+
 (define-public libnode
   (package
     (inherit node)
--
2.28.0