| 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 "10.19.0")
|
| 49 | (source (origin
|
| 50 | (method url-fetch)
|
| 51 | (uri (string-append "https://nodejs.org/dist/v" version
|
| 52 | "/node-v" version ".tar.xz"))
|
| 53 | (sha256
|
| 54 | (base32
|
| 55 | "0sginvcsf7lrlzsnpahj4bj1f673wfvby8kaxgvzlrbb7sy229v2"))
|
| 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 | `(#:configure-flags '("--shared-cares"
|
| 78 | "--shared-http-parser"
|
| 79 | "--shared-libuv"
|
| 80 | "--shared-nghttp2"
|
| 81 | "--shared-openssl"
|
| 82 | "--shared-zlib"
|
| 83 | "--without-snapshot"
|
| 84 | "--with-intl=system-icu")
|
| 85 | |
| 86 | |
| 87 | #:test-target "test-ci-js"
|
| 88 | #:phases
|
| 89 | (modify-phases %standard-phases
|
| 90 | (add-before 'configure 'patch-files
|
| 91 | (lambda* (#:key inputs #:allow-other-keys)
|
| 92 | |
| 93 | (substitute* '("lib/child_process.js"
|
| 94 | "lib/internal/v8_prof_polyfill.js"
|
| 95 | "test/parallel/test-child-process-spawnsync-shell.js"
|
| 96 | "test/parallel/test-stdio-closed.js"
|
| 97 | "test/sequential/test-child-process-emfile.js")
|
| 98 | (("'/bin/sh'")
|
| 99 | (string-append "'" (which "sh") "'")))
|
| 100 |
|
| 101 | |
| 102 | (substitute* '("test/parallel/test-child-process-default-options.js"
|
| 103 | "test/parallel/test-child-process-env.js"
|
| 104 | "test/parallel/test-child-process-exec-env.js")
|
| 105 | (("'/usr/bin/env'")
|
| 106 | (string-append "'" (which "env") "'")))
|
| 107 |
|
| 108 | |
| 109 | |
| 110 | (for-each delete-file
|
| 111 | '("test/parallel/test-cluster-master-error.js"
|
| 112 | "test/parallel/test-cluster-master-kill.js"
|
| 113 | |
| 114 | "test/sequential/test-performance.js"))
|
| 115 |
|
| 116 | |
| 117 | (delete-file "test/parallel/test-dns.js")
|
| 118 |
|
| 119 | |
| 120 | |
| 121 | (delete-file "test/parallel/test-net-listen-after-destroying-stdin.js")
|
| 122 |
|
| 123 | |
| 124 | |
| 125 | ,@(if (string-prefix? "arm" (%current-system))
|
| 126 | '((for-each delete-file
|
| 127 | '("test/parallel/test-zlib.js"
|
| 128 | "test/parallel/test-zlib-brotli.js"
|
| 129 | "test/parallel/test-zlib-brotli-flush.js"
|
| 130 | "test/parallel/test-zlib-brotli-from-brotli.js"
|
| 131 | "test/parallel/test-zlib-brotli-from-string.js"
|
| 132 | "test/parallel/test-zlib-convenience-methods.js"
|
| 133 | "test/parallel/test-zlib-random-byte-pipes.js"
|
| 134 | "test/parallel/test-zlib-write-after-flush.js")))
|
| 135 | '())
|
| 136 |
|
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | (for-each delete-file
|
| 142 | '("test/parallel/test-tls-passphrase.js"
|
| 143 | "test/parallel/test-tls-server-verify.js"))
|
| 144 | #t))
|
| 145 | (replace 'configure
|
| 146 | |
| 147 | |
| 148 | (lambda* (#:key outputs (configure-flags '()) inputs
|
| 149 | #:allow-other-keys)
|
| 150 | (let* ((prefix (assoc-ref outputs "out"))
|
| 151 | (flags (cons (string-append "--prefix=" prefix)
|
| 152 | configure-flags)))
|
| 153 | (format #t "build directory: ~s~%" (getcwd))
|
| 154 | (format #t "configure flags: ~s~%" flags)
|
| 155 | |
| 156 | |
| 157 | (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
|
| 158 | (apply invoke
|
| 159 | (string-append (assoc-ref inputs "python")
|
| 160 | "/bin/python")
|
| 161 | "configure" flags))))
|
| 162 | (add-after 'patch-shebangs 'patch-npm-shebang
|
| 163 | (lambda* (#:key outputs #:allow-other-keys)
|
| 164 | (let* ((bindir (string-append (assoc-ref outputs "out")
|
| 165 | "/bin"))
|
| 166 | (npm (string-append bindir "/npm"))
|
| 167 | (target (readlink npm)))
|
| 168 | (with-directory-excursion bindir
|
| 169 | (patch-shebang target (list bindir))
|
| 170 | #t)))))))
|
| 171 | (native-inputs
|
| 172 | `(("python" ,python-2)
|
| 173 | ("perl" ,perl)
|
| 174 | ("pkg-config" ,pkg-config)
|
| 175 | ("procps" ,procps)
|
| 176 | ("util-linux" ,util-linux)
|
| 177 | ("which" ,which)))
|
| 178 | (native-search-paths
|
| 179 | (list (search-path-specification
|
| 180 | (variable "NODE_PATH")
|
| 181 | (files '("lib/node_modules")))))
|
| 182 | (inputs
|
| 183 | `(("c-ares" ,c-ares)
|
| 184 | ("http-parser" ,http-parser)
|
| 185 | ("icu4c" ,icu4c)
|
| 186 | ("libuv" ,libuv/latest)
|
| 187 | ("nghttp2" ,nghttp2-1.40 "lib")
|
| 188 | ("openssl" ,openssl)
|
| 189 | ("zlib" ,zlib)))
|
| 190 | (synopsis "Evented I/O for V8 JavaScript")
|
| 191 | (description "Node.js is a platform built on Chrome's JavaScript runtime
|
| 192 | for easily building fast, scalable network applications. Node.js uses an
|
| 193 | event-driven, non-blocking I/O model that makes it lightweight and efficient,
|
| 194 | perfect for data-intensive real-time applications that run across distributed
|
| 195 | devices.")
|
| 196 | (home-page "https://nodejs.org/")
|
| 197 | (license expat)
|
| 198 | (properties '((max-silent-time . 7200) |
| 199 | (timeout . 21600))))) |