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