| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 |
|
| 25 | (define-module (gnu packages node)
|
| 26 | #:use-module ((guix licenses) #:select (expat))
|
| 27 | #:use-module (guix packages)
|
| 28 | #:use-module (guix derivations)
|
| 29 | #:use-module (guix download)
|
| 30 | #:use-module (guix build-system gnu)
|
| 31 | #:use-module (gnu packages)
|
| 32 | #:use-module (gnu packages adns)
|
| 33 | #:use-module (gnu packages base)
|
| 34 | #:use-module (gnu packages compression)
|
| 35 | #:use-module (gnu packages gcc)
|
| 36 | #:use-module (gnu packages icu4c)
|
| 37 | #:use-module (gnu packages libevent)
|
| 38 | #:use-module (gnu packages linux)
|
| 39 | #:use-module (gnu packages perl)
|
| 40 | #:use-module (gnu packages pkg-config)
|
| 41 | #:use-module (gnu packages python)
|
| 42 | #:use-module (gnu packages tls)
|
| 43 | #:use-module (gnu packages web))
|
| 44 |
|
| 45 | (define-public node
|
| 46 | (package
|
| 47 | (name "node")
|
| 48 | (version "9.11.1")
|
| 49 | (source (origin
|
| 50 | (method url-fetch)
|
| 51 | (uri (string-append "https://nodejs.org/dist/v" version
|
| 52 | "/node-v" version ".tar.gz"))
|
| 53 | (sha256
|
| 54 | (base32
|
| 55 | "1vjh9zvw7wkdz6b0l99ya7mqjk0l8lbg9isr1q8rxwp400dhkk32"))
|
| 56 | (modules '((guix build utils)))
|
| 57 | (snippet
|
| 58 | `(begin
|
| 59 | |
| 60 | (for-each delete-file-recursively
|
| 61 | '("deps/cares"
|
| 62 | "deps/http_parser"
|
| 63 | "deps/icu-small"
|
| 64 | "deps/nghttp2"
|
| 65 | "deps/openssl"
|
| 66 | "deps/uv"
|
| 67 | "deps/zlib"))
|
| 68 | (substitute* "Makefile"
|
| 69 | |
| 70 | (("deps/http_parser/http_parser.gyp") "")
|
| 71 | (("deps/uv/include/\\*.h") "")
|
| 72 | (("deps/uv/uv.gyp") "")
|
| 73 | (("deps/zlib/zlib.gyp") ""))
|
| 74 | #t))))
|
| 75 | (build-system gnu-build-system)
|
| 76 | (arguments
|
| 77 | |
| 78 | '(#:configure-flags '("--shared-cares"
|
| 79 | "--shared-http-parser"
|
| 80 | "--shared-libuv"
|
| 81 | "--shared-nghttp2"
|
| 82 | "--shared-openssl"
|
| 83 | "--shared-zlib"
|
| 84 | "--without-snapshot"
|
| 85 | "--with-intl=system-icu")
|
| 86 | #:phases
|
| 87 | (modify-phases %standard-phases
|
| 88 | (add-before 'configure 'patch-files
|
| 89 | (lambda* (#:key inputs #:allow-other-keys)
|
| 90 |
|
| 91 | |
| 92 | |
| 93 | (define (delete-if-exists file)
|
| 94 | (if (file-exists? file)
|
| 95 | (delete-file file)
|
| 96 | '()))
|
| 97 |
|
| 98 | |
| 99 | (substitute* '("lib/child_process.js"
|
| 100 | "lib/internal/v8_prof_polyfill.js"
|
| 101 | "test/parallel/test-child-process-spawnsync-shell.js"
|
| 102 | "test/parallel/test-stdio-closed.js")
|
| 103 | (("'/bin/sh'")
|
| 104 | (string-append "'" (which "sh") "'")))
|
| 105 |
|
| 106 | |
| 107 | (substitute* '("test/parallel/test-child-process-default-options.js"
|
| 108 | "test/parallel/test-child-process-env.js"
|
| 109 | "test/parallel/test-child-process-exec-env.js")
|
| 110 | (("'/usr/bin/env'")
|
| 111 | (string-append "'" (which "env") "'")))
|
| 112 |
|
| 113 | |
| 114 | |
| 115 | (for-each delete-if-exists
|
| 116 | '("test/parallel/test-eslint-alphabetize-errors.js"
|
| 117 | "test/parallel/test-eslint-buffer-constructor.js"
|
| 118 | "test/parallel/test-eslint-documented-errors.js"
|
| 119 | "test/parallel/test-eslint-inspector-check.js"))
|
| 120 |
|
| 121 | |
| 122 | |
| 123 | (for-each delete-if-exists
|
| 124 | '("test/async-hooks/test-ttywrap.readstream.js"
|
| 125 | "test/parallel/test-util-inspect.js"
|
| 126 | "test/parallel/test-v8-serdes.js"
|
| 127 | "test/parallel/test-dgram-membership.js"
|
| 128 | "test/parallel/test-dns-cancel-reverse-lookup.js"
|
| 129 | "test/parallel/test-dns-resolveany.js"
|
| 130 | "test/parallel/test-cluster-master-error.js"
|
| 131 | "test/parallel/test-cluster-master-kill.js"
|
| 132 | "test/parallel/test-net-listen-after-destroying-stdin.js"
|
| 133 | "test/parallel/test-npm-install.js"
|
| 134 | "test/sequential/test-child-process-emfile.js"
|
| 135 | "test/sequential/test-benchmark-child-process.js"
|
| 136 | "test/sequential/test-http-regr-gh-2928.js"))
|
| 137 |
|
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | (for-each delete-if-exists
|
| 143 | '("test/parallel/test-tls-passphrase.js"
|
| 144 | "test/parallel/test-tls-server-verify.js"))
|
| 145 | #t))
|
| 146 | (replace 'configure
|
| 147 | |
| 148 | |
| 149 | (lambda* (#:key outputs (configure-flags '()) inputs
|
| 150 | #:allow-other-keys)
|
| 151 | (let* ((prefix (assoc-ref outputs "out"))
|
| 152 | (flags (cons (string-append "--prefix=" prefix)
|
| 153 | configure-flags)))
|
| 154 | (format #t "build directory: ~s~%" (getcwd))
|
| 155 | (format #t "configure flags: ~s~%" flags)
|
| 156 | |
| 157 | |
| 158 | (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
|
| 159 | (apply invoke
|
| 160 | (string-append (assoc-ref inputs "python")
|
| 161 | "/bin/python")
|
| 162 | "configure" flags))))
|
| 163 | (add-after 'patch-shebangs 'patch-npm-shebang
|
| 164 | (lambda* (#:key outputs #:allow-other-keys)
|
| 165 | (let* ((bindir (string-append (assoc-ref outputs "out")
|
| 166 | "/bin"))
|
| 167 | (npm (string-append bindir "/npm"))
|
| 168 | (target (readlink npm)))
|
| 169 | (with-directory-excursion bindir
|
| 170 | (patch-shebang target (list bindir))
|
| 171 | #t)))))))
|
| 172 | (native-inputs
|
| 173 | `(("python" ,python-2)
|
| 174 | ("perl" ,perl)
|
| 175 | ("pkg-config" ,pkg-config)
|
| 176 | ("procps" ,procps)
|
| 177 | ("util-linux" ,util-linux)
|
| 178 | ("which" ,which)))
|
| 179 | (native-search-paths
|
| 180 | (list (search-path-specification
|
| 181 | (variable "NODE_PATH")
|
| 182 | (files '("lib/node_modules")))))
|
| 183 | (inputs
|
| 184 | `(("c-ares" ,c-ares)
|
| 185 | ("http-parser" ,http-parser)
|
| 186 | ("icu4c" ,icu4c)
|
| 187 | ("libuv" ,libuv-1.19)
|
| 188 | ("nghttp2" ,nghttp2 "lib")
|
| 189 | ("openssl" ,openssl)
|
| 190 | ("zlib" ,zlib)))
|
| 191 | (synopsis "Evented I/O for V8 JavaScript")
|
| 192 | (description "Node.js is a platform built on Chrome's JavaScript runtime
|
| 193 | for easily building fast, scalable network applications. Node.js uses an
|
| 194 | event-driven, non-blocking I/O model that makes it lightweight and efficient,
|
| 195 | perfect for data-intensive real-time applications that run across distributed
|
| 196 | devices.")
|
| 197 | (home-page "https://nodejs.org/")
|
| 198 | (license expat)
|
| 199 | (properties '((timeout . 3600))))) |
| 200 |
|
| 201 | (define-public node-lts
|
| 202 | (package
|
| 203 | (inherit node)
|
| 204 | (name "node-lts")
|
| 205 | (version "8.12.0")
|
| 206 | (source (origin
|
| 207 | (inherit (package-source node))
|
| 208 | (uri (string-append "https://nodejs.org/dist/v" version
|
| 209 | "/node-v" version ".tar.xz"))
|
| 210 | (sha256
|
| 211 | (base32
|
| 212 | "16j1rrxkhmvpcw689ndw1raql1gz4jqn7n82z55zn63c05cgz7as"))))))
|