gnu: fish: Update to 2.7.1.
[jackhill/guix/guix.git] / gnu / packages / node.scm
CommitLineData
ed02caff
CS
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
20fbd209 3;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
c5b5e275 4;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
2de091f0 5;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
797d2387 6;;; Copyright © 2017 Mike Gerwitz <mtg@gnu.org>
ed02caff
CS
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages node)
1eca745b 24 #:use-module ((guix licenses) #:select (expat))
ed02caff
CS
25 #:use-module (guix packages)
26 #:use-module (guix derivations)
27 #:use-module (guix download)
1eca745b 28 #:use-module (guix build-system gnu)
dd04f56a 29 #:use-module (gnu packages)
ea584538 30 #:use-module (gnu packages adns)
1eca745b
DT
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages gcc)
34 #:use-module (gnu packages libevent)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages python)
ea584538
JL
38 #:use-module (gnu packages tls)
39 #:use-module (gnu packages web))
ed02caff
CS
40
41(define-public node
42 (package
43 (name "node")
797d2387 44 (version "8.9.1")
ed02caff
CS
45 (source (origin
46 (method url-fetch)
47 (uri (string-append "http://nodejs.org/dist/v" version
48 "/node-v" version ".tar.gz"))
49 (sha256
50 (base32
797d2387
MG
51 "1qbiz7hgwlirhwpd71c8yzcbwsyi5bjlfp6lxb6v55j6rizinj9j"))
52 ;; See https://github.com/nodejs/node/issues/16688
53 ;; Remove this next update (>8.9.1).
54 (patches
55 (search-patches "node-test-http2-server-rst-stream.patch"))))
ed02caff
CS
56 (build-system gnu-build-system)
57 (arguments
ea584538 58 ;; TODO: Purge the bundled copies from the source.
c5b5e275
DT
59 '(#:configure-flags '("--shared-openssl"
60 "--shared-zlib"
61 "--shared-libuv"
ea584538
JL
62 "--shared-cares"
63 "--shared-http-parser"
c5b5e275 64 "--without-snapshot")
1eca745b
DT
65 #:phases
66 (modify-phases %standard-phases
c5b5e275
DT
67 (add-before 'configure 'patch-files
68 (lambda* (#:key inputs #:allow-other-keys)
69 ;; Fix hardcoded /bin/sh references.
70 (substitute* '("lib/child_process.js"
71 "lib/internal/v8_prof_polyfill.js"
3759deab 72 "test/parallel/test-child-process-spawnsync-shell.js"
c5b5e275
DT
73 "test/parallel/test-stdio-closed.js")
74 (("'/bin/sh'")
f2ea722a 75 (string-append "'" (which "sh") "'")))
c5b5e275
DT
76
77 ;; Fix hardcoded /usr/bin/env references.
78 (substitute* '("test/parallel/test-child-process-default-options.js"
79 "test/parallel/test-child-process-env.js"
80 "test/parallel/test-child-process-exec-env.js")
81 (("'/usr/bin/env'")
82 (string-append "'" (which "env") "'")))
83
797d2387
MG
84
85 ;; test-make-doc needs doc-only target, which is inhibited below
86 (for-each delete-file
87 '("test/doctool/test-make-doc.js"))
aafcfffd
JL
88 ;; FIXME: This test seems to depends on files that are not
89 ;; available in the bundled v8. See
90 ;; https://github.com/nodejs/node/issues/13344
91 (for-each delete-file
92 '("test/addons-napi/test_general/testInstanceOf.js"))
c5b5e275
DT
93 ;; FIXME: These tests fail in the build container, but they don't
94 ;; seem to be indicative of real problems in practice.
95 (for-each delete-file
aafcfffd
JL
96 '("test/async-hooks/test-ttywrap.readstream.js"
97 "test/parallel/test-util-inspect.js"
98 "test/parallel/test-v8-serdes.js"
99 "test/parallel/test-dgram-membership.js"
bc709e03 100 "test/parallel/test-dns-cancel-reverse-lookup.js"
44833970 101 "test/parallel/test-dns-resolveany.js"
dd04f56a 102 "test/parallel/test-cluster-master-error.js"
c5b5e275
DT
103 "test/parallel/test-cluster-master-kill.js"
104 "test/parallel/test-npm-install.js"
797d2387 105 "test/parallel/test-regress-GH-746.js"
1fdb8830
JL
106 "test/sequential/test-child-process-emfile.js"
107 "test/sequential/test-benchmark-child-process.js"
108 "test/sequential/test-http-regr-gh-2928.js"))
c5b5e275
DT
109 #t))
110 (replace 'configure
111 ;; Node's configure script is actually a python script, so we can't
112 ;; run it with bash.
113 (lambda* (#:key outputs (configure-flags '()) inputs
114 #:allow-other-keys)
115 (let* ((prefix (assoc-ref outputs "out"))
116 (flags (cons (string-append "--prefix=" prefix)
117 configure-flags)))
118 (format #t "build directory: ~s~%" (getcwd))
119 (format #t "configure flags: ~s~%" flags)
120 ;; Node's configure script expects the CC environment variable to
121 ;; be set.
122 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
123 (zero? (apply system*
124 (string-append (assoc-ref inputs "python")
125 "/bin/python")
2de091f0 126 "configure" flags)))))
797d2387
MG
127 (add-before 'check 'skip-check-doc-only
128 (lambda _
129 (substitute* "Makefile"
130 ;; requires js-yaml, which is not part of the distribution,
131 ;; and falls back to using npm to download it
132 (("\\$\\(MAKE\\) doc-only" all)
133 (string-append "#" all)))
134 #t))
dd04f56a
AM
135 (add-after 'patch-shebangs 'patch-npm-shebang
136 (lambda* (#:key outputs #:allow-other-keys)
137 (let* ((bindir (string-append (assoc-ref outputs "out")
138 "/bin"))
139 (npm (string-append bindir "/npm"))
2de091f0 140 (target (readlink npm)))
dd04f56a
AM
141 (with-directory-excursion bindir
142 (patch-shebang target (list bindir))
143 #t)))))))
1eca745b
DT
144 (native-inputs
145 `(("python" ,python-2)
146 ("perl" ,perl)
c5b5e275 147 ("procps" ,procps)
1eca745b
DT
148 ("util-linux" ,util-linux)
149 ("which" ,which)))
45c18f85
JL
150 (native-search-paths
151 (list (search-path-specification
152 (variable "NODE_PATH")
153 (files '("lib/node_modules")))))
1eca745b 154 (inputs
ea584538
JL
155 `(("c-ares" ,c-ares)
156 ("http-parser" ,http-parser)
157 ("libuv" ,libuv)
1eca745b
DT
158 ("openssl" ,openssl)
159 ("zlib" ,zlib)))
2d094239 160 (synopsis "Evented I/O for V8 JavaScript")
ed02caff
CS
161 (description "Node.js is a platform built on Chrome's JavaScript runtime
162for easily building fast, scalable network applications. Node.js uses an
163event-driven, non-blocking I/O model that makes it lightweight and efficient,
164perfect for data-intensive real-time applications that run across distributed
165devices.")
1eca745b 166 (home-page "http://nodejs.org/")
3759deab 167 (license expat)
e5f0563d 168 (properties '((timeout . 3600))))) ; 1 h