projects/guix·blob version-0.14.0 · refs

168 lines · 7.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Cyrill Schenkel <[email protected]>
3;;; Copyright © 2015 Andreas Enge <[email protected]>
4;;; Copyright © 2015, 2016 David Thompson <[email protected]>
5;;; Copyright © 2016 Ludovic Courtès <[email protected]>
6;;; Copyright © 2017 Mike Gerwitz <[email protected]>
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)
24 #:use-module ((guix licenses) #:select (expat))
25 #:use-module (guix packages)
26 #:use-module (guix derivations)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages adns)
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)
38 #:use-module (gnu packages tls)
39 #:use-module (gnu packages web))
40
41(define-public node
42 (package
43 (name "node")
44 (version "8.9.1")
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
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"))))
56 (build-system gnu-build-system)
57 (arguments
58 ;; TODO: Purge the bundled copies from the source.
59 '(#:configure-flags '("--shared-openssl"
60 "--shared-zlib"
61 "--shared-libuv"
62 "--shared-cares"
63 "--shared-http-parser"
64 "--without-snapshot")
65 #:phases
66 (modify-phases %standard-phases
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"
72 "test/parallel/test-child-process-spawnsync-shell.js"
73 "test/parallel/test-stdio-closed.js")
74 (("'/bin/sh'")
75 (string-append "'" (which "sh") "'")))
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
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"))
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"))
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
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"
100 "test/parallel/test-dns-cancel-reverse-lookup.js"
101 "test/parallel/test-dns-resolveany.js"
102 "test/parallel/test-cluster-master-error.js"
103 "test/parallel/test-cluster-master-kill.js"
104 "test/parallel/test-npm-install.js"
105 "test/parallel/test-regress-GH-746.js"
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"))
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")
126 "configure" flags)))))
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))
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"))
140 (target (readlink npm)))
141 (with-directory-excursion bindir
142 (patch-shebang target (list bindir))
143 #t)))))))
144 (native-inputs
145 `(("python" ,python-2)
146 ("perl" ,perl)
147 ("procps" ,procps)
148 ("util-linux" ,util-linux)
149 ("which" ,which)))
150 (native-search-paths
151 (list (search-path-specification
152 (variable "NODE_PATH")
153 (files '("lib/node_modules")))))
154 (inputs
155 `(("c-ares" ,c-ares)
156 ("http-parser" ,http-parser)
157 ("libuv" ,libuv)
158 ("openssl" ,openssl)
159 ("zlib" ,zlib)))
160 (synopsis "Evented I/O for V8 JavaScript")
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.")
166 (home-page "http://nodejs.org/")
167 (license expat)
168 (properties '((timeout . 3600))))) ; 1 h