;;; 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, 2019 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages node)
- #:use-module ((guix licenses) #:select (expat))
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module ((guix build utils) #:select (alist-replace))
#:use-module (guix packages)
#:use-module (guix derivations)
#:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system node)
#:use-module (gnu packages)
#:use-module (gnu packages adns)
#:use-module (gnu packages base)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages libevent)
#:use-module (gnu packages linux)
+ #:use-module (gnu packages node-xyz)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
(define-public node
(package
(name "node")
- (version "10.15.3")
+ (version "10.24.0")
(source (origin
(method url-fetch)
(uri (string-append "https://nodejs.org/dist/v" version
"/node-v" version ".tar.xz"))
(sha256
(base32
- "1mcijznh481s44i59p571a38bfvcxm9f8x2l0l1005aly0kdj8jf"))
+ "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
(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"
(modify-phases %standard-phases
(add-before 'configure 'patch-files
(lambda* (#:key inputs #:allow-other-keys)
-
;; 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") "'")))
;; FIXME: These tests fail in the build container, but they don't
;; seem to be indicative of real problems in practice.
(for-each delete-file
- '("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"
+ '("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-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
(target (readlink npm)))
(with-directory-excursion bindir
(patch-shebang target (list bindir))
+ #t))))
+ (add-after 'install 'patch-node-shebang
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((bindir (string-append (assoc-ref outputs "out")
+ "/bin"))
+ (npx (readlink (string-append bindir "/npx"))))
+ (with-directory-excursion bindir
+ (patch-shebang npx (list bindir))
#t)))))))
(native-inputs
`(("python" ,python-2)
perfect for data-intensive real-time applications that run across distributed
devices.")
(home-page "https://nodejs.org/")
- (license expat)
- (properties '((timeout . 3600))))) ; 1 h
+ (license license:expat)
+ (properties '((max-silent-time . 7200) ;2h, needed on ARM
+ (timeout . 21600))))) ;6h
+
+;; This should be the latest version of node that still builds without
+;; depending on llhttp.
+(define-public node-bootstrap
+ (hidden-package node))
+
+;; Duplicate of node-semver
+(define-public node-semver-bootstrap
+ (package
+ (name "node-semver")
+ (version "7.2.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/npm/node-semver")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
+ (build-system node-build-system)
+ (arguments
+ `(#:node ,node-bootstrap
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure))))
+ (home-page "https://github.com/npm/node-semver")
+ (properties '((hidden? . #t)))
+ (synopsis "Parses semantic versions strings")
+ (description
+ "@code{node-semver} is a JavaScript implementation of the
+@uref{https://semver.org/, SemVer.org} specification.")
+ (license license:isc)))
+
+(define-public node-ms-bootstrap
+ (package
+ (name "node-ms")
+ (version "2.1.2")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/vercel/ms.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1pjxzbi4j8pinlsc7yxvfrh0b47kb2dc4lfc2rjq4wx5bdwl33fj"))))
+ (build-system node-build-system)
+ (arguments
+ `(#:node ,node-bootstrap
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure))))
+ (home-page "https://github.com/zeit/ms#readme")
+ (properties '((hidden? . #t)))
+ (synopsis "Tiny millisecond conversion utility")
+ (description "Use this package to easily convert various time
+formats to milliseconds.")
+ (license license:expat)))
+
+(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)
+ (delete 'patch-node-shebang)))))))