diff mbox series

[bug#42639] bump Node to 14.6

Message ID tN6dc0jlib3fz91hRViWOMPWBBaRSulxZN7pevQOHnoTLjBmpFdA2em-AUB5sqqbxhbtUNE2Q635-1JOyrbrZ39MZHWOgGCCMUvnwPeaqqs=@protonmail.com
State New
Headers show
Series [bug#42639] bump Node to 14.6 | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Deslauriers, Douglas via Guix-patches" via July 31, 2020, 5:11 p.m. UTC
Empty Message

Comments

Jelle Licht July 31, 2020, 9:26 p.m. UTC | #1
Hey Formbi,


Formbi via Guix-patches via <guix-patches@gnu.org> writes:

> Subject: [PATCH 2/2] bump node to 14.6

Sadly, recent node versions come bundled with generated code based on
the llhttp[1] project. These generated source files can be found in the
deps/llhttp/src directory of the 14.6 release, and the annoying thing is
that upstream uses typescript to generate these C files. See [2] for my
feeble attempt at having upstream take note of this issue to allow for
properly bootstrapping lltthp and subsequently recent versions of node.

There are some alternative typescript implementations that I
unsuccessfully have tried in the past in at least translating the
typescript used in llhttp to normal javascript, which we could then
interpret using our packaged version of node to build the C files that
would allow us to build newer versions of node. The ones I looked at in
some detail are:

- Sucrase [3] but it doesn't support all used typescript constructs
- swc [4] but it actually depends on the normal typescript compiler

I'm sorry I don't have better news to share either.  Perhaps some
guile-guru can drop down from their higher spheres of existence and
create a hacky interpreter that translates typescript to
extremely-ugly-yet-correct javascript to help us escape this quagmire.

- Jelle


[1] https://github.com/nodejs/llhttp
[2] https://github.com/nodejs/llhttp/issues/14
[3] https://github.com/alangpierce/sucrase/issues/464
[4] https://github.com/swc-project/swc
Deslauriers, Douglas via Guix-patches" via July 31, 2020, 9:33 p.m. UTC | #2
oh my bananas, that's bad news :(
Jelle Licht July 31, 2020, 9:37 p.m. UTC | #3
Jelle Licht <jlicht@fsfe.org> writes:

> would allow us to build newer versions of node. The ones I looked at in
> some detail are:
>
> - Sucrase [3] but it doesn't support all used typescript constructs
> - swc [4] but it actually depends on the normal typescript compiler
 [snip]
> [4] https://github.com/swc-project/swc
It seems this is not actually the case, but swc still seems to depend on
having a rust nightly compiler available.

- Jelle
Deslauriers, Douglas via Guix-patches" via July 31, 2020, 9:41 p.m. UTC | #4
> seems to depend on having a rust nightly compiler available.

we have Rust 1.45.1 in Guix, wouldn't it be sufficient?
Maja Kądziołka Aug. 6, 2020, 10:01 p.m. UTC | #5
On Fri, Jul 31, 2020 at 11:37:24PM +0200, Jelle Licht wrote:
> Jelle Licht <jlicht@fsfe.org> writes:
> 
> > would allow us to build newer versions of node. The ones I looked at in
> > some detail are:
> >
> > - Sucrase [3] but it doesn't support all used typescript constructs
> > - swc [4] but it actually depends on the normal typescript compiler
>  [snip]
> > [4] https://github.com/swc-project/swc
> It seems this is not actually the case, but swc still seems to depend on
> having a rust nightly compiler available.
> 
> - Jelle

It seems that a nightly compiler is only used for an optimization flag:
commenting out the -Z thinlto=no line in .cargo/config in swc's repo
made it pass `cargo check' just fine.

Regards,
Jakub Kądziołka
Jelle Licht Aug. 6, 2020, 10:53 p.m. UTC | #6
Jakub Kądziołka <kuba@kadziolka.net> writes:

> On Fri, Jul 31, 2020 at 11:37:24PM +0200, Jelle Licht wrote:
>> It seems this is not actually the case, but swc still seems to depend on
>> having a rust nightly compiler available.
>> 
>> - Jelle
>
> It seems that a nightly compiler is only used for an optimization flag:
> commenting out the -Z thinlto=no line in .cargo/config in swc's repo
> made it pass `cargo check' just fine.

Indeed it does; does that fix this problem for us? At this stage, I end
up with a library that was built successfully, but no clue how to
continue from here. Either way, progress! ;)

- Jelle
Maja Kądziołka Aug. 7, 2020, 1:58 p.m. UTC | #7
On Fri, Aug 07, 2020 at 12:53:53AM +0200, Jelle Licht wrote:
> Indeed it does; does that fix this problem for us? At this stage, I end
> up with a library that was built successfully, but no clue how to
> continue from here. Either way, progress! ;)

Hmm, it seems that the main way to use swc is by a wrapper written in
TypeScript (node-swc/src), which is built with neon, also a tool written
in TypeScript. However, it seems that it shouldn't be too hard to invoke
swc with just Rust, with something along the lines of examples/usage.rs

Regards,
Jakub Kądziołka
Jelle Licht May 28, 2023, 9:58 p.m. UTC | #8
We now have node@18 on master, and worked around the bootstrapping issue
using a different solution (esbuild). Closing.
diff mbox series

Patch

From 0dc32f60b10c39f585d3535f3ff35e0e9812a6a0 Mon Sep 17 00:00:00 2001
From: Formbi <formbi@protonmail.com>
Date: Fri, 31 Jul 2020 19:09:26 +0200
Subject: [PATCH 2/2] bump node to 14.6

---
 gnu/packages/node.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 1adb2cd07f..a7658e626a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -199,6 +199,60 @@  devices.")
     (properties '((max-silent-time . 7200)     ;2h, needed on ARM
                   (timeout . 21600)))))        ;6h
 
+(define-public node-14.6
+  (package
+    (inherit node)
+    (version "14.6.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://nodejs.org/dist/v" version
+                                  "/node-v" version ".tar.xz"))
+              (sha256
+               (base32
+                "153a07ffrmvwbsc78wrc0xnwymmzrhva0kn6mgnfi3086v3h1wss"))
+              (modules '((guix build utils)))
+              (snippet
+               `(begin
+                  ;; Remove bundled software.
+                  (for-each delete-file-recursively
+                            '("deps/cares"
+                              "deps/icu-small"
+                              "deps/openssl"))
+                  (substitute* "Makefile"
+                    ;; Remove references to bundled software.
+                    (("deps/http_parser/http_parser.gyp") "")
+                    (("deps/uv/include/\\*.h") ""))
+                  #t))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments node)
+       ((#:configure-flags configure-flags)
+        ''("--shared-cares"
+           ;; "--shared-http-parser"
+           ;; node can't find the pkg-config file for http-parser
+           "--shared-libuv"
+           ;; "--shared-nghttp2"
+           ;; for some reason only the bundled nghttp2 works
+           "--shared-openssl"
+           "--shared-zlib"
+           ;; "--without-snapshot"
+           ;; this option is no longer available
+           "--with-intl=system-icu"))
+       ;; Almost all the tests require NPM and the one that doesn't does
+       ;; something stupid and fails on 14.6
+       ((#:tests? _ #f) #f)
+       ;; The patch-files was preparing the tests, now it's not needed
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (delete 'patch-files)))))
+    (inputs
+     `(("c-ares" ,c-ares)
+       ("http-parser" ,http-parser)
+       ("icu4c" ,icu4c-67)
+       ("libuv" ,libuv-1.38)
+       ("openssl" ,openssl)
+       ("zlib" ,zlib)
+       ("brotli" ,google-brotli)))))
+
 (define-public libnode
   (package
     (inherit node)
-- 
2.26.0