;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mike Gerwitz <mtg@gnu.org>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
;;;
;;; This file is part of GNU Guix.
;;;
(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)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages adns)
(define-public node
(package
(name "node")
- (version "9.11.1")
+ (version "10.20.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"))
+ "0cvjwnl0wkcsyw3kannbdv01s235wrnp11n2s6swzjx95gpichfi"))
(modules '((guix build utils)))
(snippet
`(begin
#t))))
(build-system gnu-build-system)
(arguments
- ;; TODO: Purge the bundled copies from the source.
- '(#:configure-flags '("--shared-cares"
+ `(#:configure-flags '("--shared-cares"
"--shared-http-parser"
"--shared-libuv"
"--shared-nghttp2"
"--shared-zlib"
"--without-snapshot"
"--with-intl=system-icu")
+ ;; Run only the CI tests. The default test target requires additional
+ ;; add-ons from NPM that are not distributed with the source.
+ #:test-target "test-ci-js"
#:phases
(modify-phases %standard-phases
(add-before 'configure 'patch-files
(lambda* (#:key inputs #:allow-other-keys)
-
- ;; This phase is inherited by Node LTS, which does not have all
- ;; the files listed here. Use this helper for convenience.
- (define (delete-if-exists file)
- (if (file-exists? file)
- (delete-file file)
- '()))
-
;; Fix hardcoded /bin/sh references.
(substitute* '("lib/child_process.js"
"lib/internal/v8_prof_polyfill.js"
"test/parallel/test-child-process-spawnsync-shell.js"
- "test/parallel/test-stdio-closed.js")
+ "test/parallel/test-stdio-closed.js"
+ "test/sequential/test-child-process-emfile.js")
(("'/bin/sh'")
(string-append "'" (which "sh") "'")))
(("'/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
- '("test/async-hooks/test-ttywrap.readstream.js"
- "test/parallel/test-util-inspect.js"
- "test/parallel/test-v8-serdes.js"
- "test/parallel/test-dgram-membership.js"
- "test/parallel/test-dns-cancel-reverse-lookup.js"
- "test/parallel/test-dns-resolveany.js"
- "test/parallel/test-cluster-master-error.js"
+ (for-each delete-file
+ '("test/parallel/test-cluster-master-error.js"
"test/parallel/test-cluster-master-kill.js"
- "test/parallel/test-net-listen-after-destroying-stdin.js"
- "test/parallel/test-npm-install.js"
- "test/sequential/test-child-process-emfile.js"
- "test/sequential/test-benchmark-child-process.js"
- "test/sequential/test-http-regr-gh-2928.js"))
+ ;; See also <https://github.com/nodejs/node/issues/25903>.
+ "test/sequential/test-performance.js"))
+
+ ;; This requires a DNS resolver.
+ (delete-file "test/parallel/test-dns.js")
+
+ ;; FIXME: This test fails randomly:
+ ;; https://github.com/nodejs/node/issues/31213
+ (delete-file "test/parallel/test-net-listen-after-destroying-stdin.js")
+
+ ;; FIXME: These tests fail on armhf-linux:
+ ;; https://github.com/nodejs/node/issues/31970
+ ,@(if (string-prefix? "arm" (%current-system))
+ '((for-each delete-file
+ '("test/parallel/test-zlib.js"
+ "test/parallel/test-zlib-brotli.js"
+ "test/parallel/test-zlib-brotli-flush.js"
+ "test/parallel/test-zlib-brotli-from-brotli.js"
+ "test/parallel/test-zlib-brotli-from-string.js"
+ "test/parallel/test-zlib-convenience-methods.js"
+ "test/parallel/test-zlib-random-byte-pipes.js"
+ "test/parallel/test-zlib-write-after-flush.js")))
+ '())
;; These tests have an expiry date: they depend on the validity of
;; TLS certificates that are bundled with the source. We want this
;; package to be reproducible forever, so remove those.
;; TODO: Regenerate certs instead.
- (for-each delete-if-exists
+ (for-each delete-file
'("test/parallel/test-tls-passphrase.js"
"test/parallel/test-tls-server-verify.js"))
#t))
`(("c-ares" ,c-ares)
("http-parser" ,http-parser)
("icu4c" ,icu4c)
- ("libuv" ,libuv-1.19)
+ ("libuv" ,libuv)
("nghttp2" ,nghttp2 "lib")
("openssl" ,openssl)
("zlib" ,zlib)))
devices.")
(home-page "https://nodejs.org/")
(license expat)
- (properties '((timeout . 3600))))) ; 1 h
+ (properties '((max-silent-time . 7200) ;2h, needed on ARM
+ (timeout . 21600))))) ;6h
-(define-public node-lts
+;; 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)
- (name "node-lts")
- (version "8.12.0")
+ (version "10.22.0")
(source (origin
(inherit (package-source node))
(uri (string-append "https://nodejs.org/dist/v" version
"/node-v" version ".tar.xz"))
(sha256
(base32
- "16j1rrxkhmvpcw689ndw1raql1gz4jqn7n82z55zn63c05cgz7as"))))))
+ "1nz18fa550li10r0kzsm28c2rvvq61nq8bqdygip0rmvbi2paxg0"))))
+ (inputs
+ (alist-replace "nghttp2" (list nghttp2-1.41 "lib")
+ (package-inputs node)))))
+
+(define-public libnode
+ (package
+ (inherit node)
+ (name "libnode")
+ (arguments
+ (substitute-keyword-arguments (package-arguments node)
+ ((#:configure-flags flags ''())
+ `(cons* "--shared" "--without-npm" ,flags))
+ ((#:phases phases '%standard-phases)
+ `(modify-phases ,phases
+ (delete 'patch-npm-shebang)))))))