;;; Copyright © 2017 Mike Gerwitz <mtg@gnu.org>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; 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.19.0")
+ (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
- "0sginvcsf7lrlzsnpahj4bj1f673wfvby8kaxgvzlrbb7sy229v2"))
+ "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
(modules '((guix build utils)))
(snippet
`(begin
(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)
+ (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)))))))