| 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 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 |
|
| 33 | (define-module (gnu packages node)
|
| 34 | #:use-module (gnu packages base)
|
| 35 | #:use-module (gnu packages bash)
|
| 36 | #:use-module (gnu packages compression)
|
| 37 | #:use-module (gnu packages dns)
|
| 38 | #:use-module (gnu packages gcc)
|
| 39 | #:use-module (gnu packages icu4c)
|
| 40 | #:use-module (gnu packages libevent)
|
| 41 | #:use-module (gnu packages linux)
|
| 42 | #:use-module (gnu packages networking)
|
| 43 | #:use-module (gnu packages perl)
|
| 44 | #:use-module (gnu packages pkg-config)
|
| 45 | #:use-module (gnu packages python)
|
| 46 | #:use-module (gnu packages tls)
|
| 47 | #:use-module (gnu packages web)
|
| 48 | #:use-module (gnu packages)
|
| 49 | #:use-module ((guix build utils) #:select (alist-replace))
|
| 50 | #:use-module (guix build-system gnu)
|
| 51 | #:use-module (guix build-system node)
|
| 52 | #:use-module (guix derivations)
|
| 53 | #:use-module (guix download)
|
| 54 | #:use-module (guix git-download)
|
| 55 | #:use-module ((guix licenses) #:prefix license:)
|
| 56 | #:use-module (guix packages)
|
| 57 | #:use-module (guix utils)
|
| 58 | #:use-module (ice-9 match)
|
| 59 | #:use-module (srfi srfi-1)
|
| 60 | #:use-module (srfi srfi-26))
|
| 61 |
|
| 62 | |
| 63 | |
| 64 | (define-public node-bootstrap
|
| 65 | (package
|
| 66 | (name "node")
|
| 67 | (version "10.24.1")
|
| 68 | (source (origin
|
| 69 | (method url-fetch)
|
| 70 | (uri (string-append "https://nodejs.org/dist/v" version
|
| 71 | "/node-v" version ".tar.xz"))
|
| 72 | (sha256
|
| 73 | (base32
|
| 74 | "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp"))
|
| 75 | (modules '((guix build utils)))
|
| 76 | (snippet
|
| 77 | '(begin
|
| 78 | |
| 79 | |
| 80 | (substitute* "test/parallel/test-process-versions.js"
|
| 81 | (("\\\\d\\+\\\\.\\\\d\\+\\\\.") "(\\d+\\.)+"))
|
| 82 | |
| 83 | (for-each delete-file-recursively
|
| 84 | '("deps/cares"
|
| 85 | "deps/http_parser"
|
| 86 | "deps/icu-small"
|
| 87 | "deps/nghttp2"
|
| 88 | "deps/openssl"
|
| 89 | "deps/uv"
|
| 90 | "deps/zlib"))
|
| 91 | (substitute* "Makefile"
|
| 92 | |
| 93 | (("deps/http_parser/http_parser.gyp") "")
|
| 94 | (("deps/uv/include/\\*.h") "")
|
| 95 | (("deps/uv/uv.gyp") "")
|
| 96 | (("deps/zlib/zlib.gyp") ""))))))
|
| 97 | (build-system gnu-build-system)
|
| 98 | (arguments
|
| 99 | `(#:configure-flags '("--shared-cares"
|
| 100 | "--shared-http-parser"
|
| 101 | "--shared-libuv"
|
| 102 | "--shared-nghttp2"
|
| 103 | "--shared-openssl"
|
| 104 | "--shared-zlib"
|
| 105 | "--without-snapshot"
|
| 106 | "--without-intl")
|
| 107 | |
| 108 | |
| 109 | #:test-target "test-ci-js"
|
| 110 | #:modules
|
| 111 | ((guix build gnu-build-system)
|
| 112 | (guix build utils)
|
| 113 | (srfi srfi-1)
|
| 114 | (ice-9 match))
|
| 115 | #:phases
|
| 116 | (modify-phases %standard-phases
|
| 117 | (add-before 'configure 'patch-hardcoded-program-references
|
| 118 | (lambda* (#:key inputs #:allow-other-keys)
|
| 119 |
|
| 120 | |
| 121 | (substitute*
|
| 122 | (let ((common
|
| 123 | '("lib/child_process.js"
|
| 124 | "lib/internal/v8_prof_polyfill.js"
|
| 125 | "test/parallel/test-child-process-spawnsync-shell.js"
|
| 126 | "test/parallel/test-stdio-closed.js"
|
| 127 | "test/sequential/test-child-process-emfile.js"))
|
| 128 | |
| 129 | (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
|
| 130 | (if (file-exists? sigxfsz)
|
| 131 | (cons sigxfsz common)
|
| 132 | common))
|
| 133 | (("'/bin/sh'")
|
| 134 | (string-append "'" (search-input-file inputs "/bin/sh") "'")))
|
| 135 |
|
| 136 | |
| 137 | (substitute* '("test/parallel/test-child-process-default-options.js"
|
| 138 | "test/parallel/test-child-process-env.js"
|
| 139 | "test/parallel/test-child-process-exec-env.js")
|
| 140 | (("'/usr/bin/env'")
|
| 141 | (string-append "'" (assoc-ref inputs "coreutils")
|
| 142 | "/bin/env'")))))
|
| 143 | (add-after 'patch-hardcoded-program-references
|
| 144 | 'delete-problematic-tests
|
| 145 | (lambda* (#:key inputs #:allow-other-keys)
|
| 146 |
|
| 147 | |
| 148 | |
| 149 | (for-each delete-file
|
| 150 | '("test/parallel/test-cluster-master-error.js"
|
| 151 | "test/parallel/test-cluster-master-kill.js"
|
| 152 | |
| 153 | "test/sequential/test-performance.js"))
|
| 154 |
|
| 155 | |
| 156 | (for-each delete-file
|
| 157 | '("test/parallel/test-http2-methods.js"
|
| 158 | "test/parallel/test-http2-multiplex.js"))
|
| 159 |
|
| 160 | |
| 161 | (delete-file "test/parallel/test-dns.js")
|
| 162 |
|
| 163 | |
| 164 | |
| 165 | (delete-file "test/parallel/test-fs-utimes.js")
|
| 166 |
|
| 167 | |
| 168 | |
| 169 | (delete-file "test/parallel/test-net-listen-after-destroying-stdin.js")
|
| 170 |
|
| 171 | |
| 172 | |
| 173 | ,@(if (string-prefix? "arm" (%current-system))
|
| 174 | '((for-each delete-file
|
| 175 | '("test/parallel/test-zlib.js"
|
| 176 | "test/parallel/test-zlib-brotli.js"
|
| 177 | "test/parallel/test-zlib-brotli-flush.js"
|
| 178 | "test/parallel/test-zlib-brotli-from-brotli.js"
|
| 179 | "test/parallel/test-zlib-brotli-from-string.js"
|
| 180 | "test/parallel/test-zlib-convenience-methods.js"
|
| 181 | "test/parallel/test-zlib-random-byte-pipes.js"
|
| 182 | "test/parallel/test-zlib-write-after-flush.js")))
|
| 183 | '())
|
| 184 |
|
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | (for-each delete-file
|
| 190 | '("test/parallel/test-tls-passphrase.js"
|
| 191 | "test/parallel/test-tls-server-verify.js"))))
|
| 192 | (add-before 'configure 'set-bootstrap-host-rpath
|
| 193 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 194 | (let* ((inputs (or native-inputs inputs))
|
| 195 | (c-ares (assoc-ref inputs "c-ares"))
|
| 196 | (http-parser (assoc-ref inputs "http-parser"))
|
| 197 | (nghttp2 (assoc-ref inputs "nghttp2"))
|
| 198 | (openssl (assoc-ref inputs "openssl"))
|
| 199 | (libuv (assoc-ref inputs "libuv"))
|
| 200 | (zlib (assoc-ref inputs "zlib")))
|
| 201 | (substitute* "deps/v8/gypfiles/v8.gyp"
|
| 202 | (("'target_name': 'torque'," target)
|
| 203 | (string-append target
|
| 204 | "'ldflags': ['-Wl,-rpath="
|
| 205 | c-ares "/lib:"
|
| 206 | http-parser "/lib:"
|
| 207 | nghttp2 "/lib:"
|
| 208 | openssl "/lib:"
|
| 209 | libuv "/lib:"
|
| 210 | zlib "/lib"
|
| 211 | "'],"))))))
|
| 212 | (replace 'configure
|
| 213 | |
| 214 | |
| 215 | (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
|
| 216 | #:allow-other-keys)
|
| 217 | (let* ((prefix (assoc-ref outputs "out"))
|
| 218 | (xflags ,(if (%current-target-system)
|
| 219 | `'("--cross-compiling"
|
| 220 | ,(string-append
|
| 221 | "--dest-cpu="
|
| 222 | (match (%current-target-system)
|
| 223 | ((? (cut string-prefix? "arm" <>))
|
| 224 | "arm")
|
| 225 | ((? (cut string-prefix? "aarch64" <>))
|
| 226 | "arm64")
|
| 227 | ((? (cut string-prefix? "i686" <>))
|
| 228 | "ia32")
|
| 229 | ((? (cut string-prefix? "x86_64" <>))
|
| 230 | "x64")
|
| 231 | ((? (cut string-prefix? "powerpc64" <>))
|
| 232 | "ppc64")
|
| 233 | ((? (cut string-prefix? "riscv64" <>))
|
| 234 | "riscv64")
|
| 235 | (_ "unsupported"))))
|
| 236 | ''()))
|
| 237 | (flags (cons (string-append "--prefix=" prefix)
|
| 238 | (append xflags configure-flags))))
|
| 239 | (format #t "build directory: ~s~%" (getcwd))
|
| 240 | (format #t "configure flags: ~s~%" flags)
|
| 241 | |
| 242 | |
| 243 | (setenv "CC_host" "gcc")
|
| 244 | (setenv "CXX_host" "g++")
|
| 245 | (setenv "CC" ,(cc-for-target))
|
| 246 | (setenv "CXX" ,(cxx-for-target))
|
| 247 | (setenv "PKG_CONFIG" ,(pkg-config-for-target))
|
| 248 | (apply invoke
|
| 249 | (let ((inpts (or native-inputs inputs)))
|
| 250 | (with-exception-handler
|
| 251 | (lambda (e)
|
| 252 | (if (search-error? e)
|
| 253 | (search-input-file inpts "/bin/python3")
|
| 254 | (raise-exception e)))
|
| 255 | (lambda ()
|
| 256 | (search-input-file inpts "/bin/python"))
|
| 257 | #:unwind? #t))
|
| 258 | "configure"
|
| 259 | flags))))
|
| 260 | (add-after 'patch-shebangs 'patch-nested-shebangs
|
| 261 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 262 | |
| 263 | |
| 264 | (let ((path (append-map (match-lambda
|
| 265 | ((_ . dir)
|
| 266 | (list (string-append dir "/bin")
|
| 267 | (string-append dir "/sbin")
|
| 268 | (string-append dir "/libexec"))))
|
| 269 | (append outputs inputs))))
|
| 270 | (for-each
|
| 271 | (lambda (file)
|
| 272 | (patch-shebang file path))
|
| 273 | (find-files (search-input-directory outputs "lib/node_modules")
|
| 274 | (lambda (file stat)
|
| 275 | (executable-file? file))
|
| 276 | #:stat lstat)))))
|
| 277 | (add-after 'install 'fix-node-gyp-reference
|
| 278 | |
| 279 | |
| 280 | |
| 281 | (lambda* (#:key outputs #:allow-other-keys)
|
| 282 | (let* ((out (assoc-ref outputs "out")))
|
| 283 | (with-output-to-file
|
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | (string-append out "/lib/node_modules/npm/npmrc")
|
| 289 | (lambda ()
|
| 290 | |
| 291 | |
| 292 | |
| 293 | (format #t "nodedir=~a\n" out)))))))))
|
| 294 | (native-inputs
|
| 295 | |
| 296 | (list c-ares-for-node-bootstrap
|
| 297 | http-parser
|
| 298 | libuv-for-node
|
| 299 | `(,nghttp2-for-node-bootstrap "lib")
|
| 300 | openssl-1.1
|
| 301 | zlib
|
| 302 | |
| 303 | gcc-11 |
| 304 | perl
|
| 305 | pkg-config
|
| 306 | procps
|
| 307 | python-2
|
| 308 | util-linux))
|
| 309 | (native-search-paths
|
| 310 | (list (search-path-specification
|
| 311 | (variable "NODE_PATH")
|
| 312 | (files '("lib/node_modules")))))
|
| 313 | (inputs
|
| 314 | (list bash-minimal
|
| 315 | coreutils
|
| 316 | c-ares-for-node-bootstrap
|
| 317 | http-parser
|
| 318 | libuv-for-node
|
| 319 | `(,nghttp2-for-node-bootstrap "lib")
|
| 320 | openssl
|
| 321 | python-wrapper |
| 322 | zlib))
|
| 323 | (synopsis "Evented I/O for V8 JavaScript")
|
| 324 | (description
|
| 325 | "Node.js is a platform built on Chrome's JavaScript runtime
|
| 326 | for easily building fast, scalable network applications. Node.js uses an
|
| 327 | event-driven, non-blocking I/O model that makes it lightweight and efficient,
|
| 328 | perfect for data-intensive real-time applications that run across distributed
|
| 329 | devices.")
|
| 330 | (supported-systems (fold delete %supported-systems
|
| 331 | '("powerpc-linux" "riscv64-linux")))
|
| 332 | (home-page "https://nodejs.org/")
|
| 333 | (license license:expat)
|
| 334 | (properties '((max-silent-time . 7200) |
| 335 | (timeout . 21600) |
| 336 | (cpe-name . "node.js")
|
| 337 | (hidden? . #t)))))
|
| 338 |
|
| 339 | |
| 340 | (define-public node-semver-bootstrap
|
| 341 | (package
|
| 342 | (name "node-semver")
|
| 343 | (version "7.2.1")
|
| 344 | (source (origin
|
| 345 | (method git-fetch)
|
| 346 | (uri (git-reference
|
| 347 | (url "https://github.com/npm/node-semver")
|
| 348 | (commit (string-append "v" version))))
|
| 349 | (file-name (git-file-name name version))
|
| 350 | (sha256
|
| 351 | (base32
|
| 352 | "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
|
| 353 | (build-system node-build-system)
|
| 354 | (arguments
|
| 355 | `(#:node ,node-bootstrap
|
| 356 | #:tests? #f
|
| 357 | #:phases
|
| 358 | (modify-phases %standard-phases
|
| 359 | (add-after 'patch-dependencies 'delete-dependencies
|
| 360 | (lambda args
|
| 361 | (modify-json (delete-dependencies '("tap"))))))))
|
| 362 | (home-page "https://github.com/npm/node-semver")
|
| 363 | (properties '((hidden? . #t)))
|
| 364 | (synopsis "Parses semantic versions strings")
|
| 365 | (description
|
| 366 | "@code{node-semver} is a JavaScript implementation of the
|
| 367 | @uref{https://semver.org/, SemVer.org} specification.")
|
| 368 | (license license:isc)))
|
| 369 |
|
| 370 | (define-public node-ms-bootstrap
|
| 371 | (package
|
| 372 | (name "node-ms")
|
| 373 | (version "2.1.2")
|
| 374 | (source
|
| 375 | (origin
|
| 376 | (method git-fetch)
|
| 377 | (uri (git-reference
|
| 378 | (url "https://github.com/vercel/ms.git")
|
| 379 | (commit version)))
|
| 380 | (file-name (git-file-name name version))
|
| 381 | (sha256
|
| 382 | (base32
|
| 383 | "1pjxzbi4j8pinlsc7yxvfrh0b47kb2dc4lfc2rjq4wx5bdwl33fj"))))
|
| 384 | (build-system node-build-system)
|
| 385 | (arguments
|
| 386 | `(#:node ,node-bootstrap
|
| 387 | #:tests? #f
|
| 388 | #:phases
|
| 389 | (modify-phases %standard-phases
|
| 390 | (add-after 'patch-dependencies 'delete-dependencies
|
| 391 | (lambda args
|
| 392 | (modify-json (delete-dependencies
|
| 393 | '("eslint"
|
| 394 | "expect.js"
|
| 395 | "husky"
|
| 396 | "lint-staged"
|
| 397 | "mocha"))))))))
|
| 398 | (home-page "https://github.com/zeit/ms#readme")
|
| 399 | (properties '((hidden? . #t)))
|
| 400 | (synopsis "Tiny millisecond conversion utility")
|
| 401 | (description "Use this package to easily convert various time
|
| 402 | formats to milliseconds.")
|
| 403 | (license license:expat)))
|
| 404 |
|
| 405 | (define-public node-binary-search-bootstrap
|
| 406 | (package
|
| 407 | (name "node-binary-search")
|
| 408 | (version "1.3.6")
|
| 409 | (source
|
| 410 | (origin
|
| 411 | (method git-fetch)
|
| 412 | (uri (git-reference
|
| 413 | (url "https://github.com/darkskyapp/binary-search.git")
|
| 414 | (commit (string-append "v" version))))
|
| 415 | (file-name (git-file-name name version))
|
| 416 | (sha256
|
| 417 | (base32
|
| 418 | "1xr2msdc143cd3xwgq7n3rhzy7j8wrnaidxl0r6l6b6g3mpbpjig"))))
|
| 419 | (build-system node-build-system)
|
| 420 | (arguments
|
| 421 | `(#:node ,node-bootstrap
|
| 422 | #:tests? #f
|
| 423 | #:phases
|
| 424 | (modify-phases %standard-phases
|
| 425 | (add-after 'patch-dependencies 'delete-dependencies
|
| 426 | (lambda args
|
| 427 | (modify-json (delete-dependencies `("chai" "mocha"))))))))
|
| 428 | (home-page "https://github.com/darkskyapp/binary-search#readme")
|
| 429 | (properties '((hidden? . #t)))
|
| 430 | (synopsis "Tiny binary search function with comparators")
|
| 431 | (description "This package is a binary search function for Node.js.")
|
| 432 | (license license:cc0)))
|
| 433 |
|
| 434 | (define-public node-debug-bootstrap
|
| 435 | (package
|
| 436 | (name "node-debug")
|
| 437 | (version "4.3.0")
|
| 438 | (source
|
| 439 | (origin
|
| 440 | (method git-fetch)
|
| 441 | (uri (git-reference
|
| 442 | (url "https://github.com/visionmedia/debug.git")
|
| 443 | (commit version)))
|
| 444 | (file-name (git-file-name name version))
|
| 445 | (sha256
|
| 446 | (base32
|
| 447 | "08g52r1d4yqcsfdfb7n5if33d4cghaq75gx5n9hj6m6fd8jfp2pi"))))
|
| 448 | (build-system node-build-system)
|
| 449 | (arguments
|
| 450 | `(#:node ,node-bootstrap
|
| 451 | #:tests? #f
|
| 452 | #:phases
|
| 453 | (modify-phases %standard-phases
|
| 454 | (add-after 'patch-dependencies 'delete-dependencies
|
| 455 | (lambda args
|
| 456 | (modify-json (delete-dependencies
|
| 457 | `("brfs"
|
| 458 | "browserify"
|
| 459 | "coveralls"
|
| 460 | "istanbul"
|
| 461 | "karma"
|
| 462 | "karma-browserify"
|
| 463 | "karma-chrome-launcher"
|
| 464 | "karma-mocha"
|
| 465 | "mocha"
|
| 466 | "mocha-lcov-reporter"
|
| 467 | "xo"))))))))
|
| 468 | (inputs (list node-ms-bootstrap))
|
| 469 | (home-page "https://github.com/visionmedia/debug#readme")
|
| 470 | (properties '((hidden? . #t)))
|
| 471 | (synopsis "Small debugging utility")
|
| 472 | (description "This package contains a tiny JavaScript debugging
|
| 473 | utility modelled after Node.js core's debugging technique. It works in
|
| 474 | Node.js and web browsers.")
|
| 475 | (license license:expat)))
|
| 476 |
|
| 477 | (define-public node-llparse-builder-bootstrap
|
| 478 | (package
|
| 479 | (name "node-llparse-builder")
|
| 480 | (version "1.5.2")
|
| 481 | (source
|
| 482 | (origin
|
| 483 | (method git-fetch)
|
| 484 | (uri (git-reference
|
| 485 | (url "https://github.com/nodejs/llparse-builder.git")
|
| 486 | (commit (string-append "v" version))))
|
| 487 | (file-name (git-file-name name version))
|
| 488 | (sha256
|
| 489 | (base32
|
| 490 | "0r82iiwqsb73k2fxw7842rjjiixllxpyc6yl9cq4ma6ybkf6xmzm"))
|
| 491 | (modules '((guix build utils)))
|
| 492 | (snippet
|
| 493 | '(begin
|
| 494 | |
| 495 | |
| 496 | (substitute* '("src/node/invoke.ts"
|
| 497 | "src/node/base.ts"
|
| 498 | "src/node/consume.ts"
|
| 499 | "src/node/match.ts"
|
| 500 | "src/node/error.ts"
|
| 501 | "src/node/pause.ts"
|
| 502 | "src/edge.ts"
|
| 503 | "src/utils.ts"
|
| 504 | "src/loop-checker/index.ts"
|
| 505 | "src/loop-checker/lattice.ts"
|
| 506 | "src/code/field.ts"
|
| 507 | "src/span-allocator.ts")
|
| 508 | (("\\* as assert") "assert")
|
| 509 | (("\\* as debugAPI") "debugAPI"))
|
| 510 | #t))))
|
| 511 | (build-system node-build-system)
|
| 512 | (arguments
|
| 513 | `(#:node ,node-bootstrap
|
| 514 | #:tests? #f
|
| 515 | #:phases
|
| 516 | (modify-phases %standard-phases
|
| 517 | (add-after 'patch-dependencies 'delete-dependencies
|
| 518 | (lambda _
|
| 519 | (modify-json (delete-dependencies
|
| 520 | `("@types/debug"
|
| 521 | "@types/mocha"
|
| 522 | "@types/node"
|
| 523 | "mocha"
|
| 524 | "ts-node"
|
| 525 | "tslint"
|
| 526 | "typescript")))))
|
| 527 | (replace 'build
|
| 528 | (lambda* (#:key inputs #:allow-other-keys)
|
| 529 | (let ((esbuild (search-input-file inputs "/bin/esbuild")))
|
| 530 | (invoke esbuild
|
| 531 | "--platform=node"
|
| 532 | "--outfile=lib/builder.js"
|
| 533 | "--bundle"
|
| 534 | "src/builder.ts")))))))
|
| 535 | (inputs
|
| 536 | (list node-binary-search-bootstrap node-debug-bootstrap))
|
| 537 | (native-inputs
|
| 538 | (list esbuild))
|
| 539 | (home-page "https://github.com/nodejs/llparse-builder#readme")
|
| 540 | (properties '((hidden? . #t)))
|
| 541 | (synopsis "Graph builder for consumption by llparse")
|
| 542 | (description "This package builds graphs for consumption by llparse.")
|
| 543 | (license license:expat)))
|
| 544 |
|
| 545 | (define-public node-llparse-frontend-bootstrap
|
| 546 | (package
|
| 547 | (name "node-llparse-frontend")
|
| 548 | (version "3.0.0")
|
| 549 | (source
|
| 550 | (origin
|
| 551 | (method git-fetch)
|
| 552 | (uri (git-reference
|
| 553 | (url "https://github.com/nodejs/llparse-frontend.git")
|
| 554 | (commit (string-append "v" version))))
|
| 555 | (file-name (git-file-name name version))
|
| 556 | (sha256
|
| 557 | (base32 "1rm9g4ifyip30svm5cgnf0gx7d45jgh4mpf2hkd092xhngmfvicc"))
|
| 558 | (modules '((guix build utils)))
|
| 559 | (snippet
|
| 560 | '(begin
|
| 561 | |
| 562 | |
| 563 | (substitute* '("src/frontend.ts"
|
| 564 | "src/code/field-value.ts"
|
| 565 | "src/container/index.ts"
|
| 566 | "src/container/wrap.ts"
|
| 567 | "src/node/sequence.ts"
|
| 568 | "src/node/single.ts"
|
| 569 | "src/node/table-lookup.ts"
|
| 570 | "src/trie/index.ts")
|
| 571 | (("\\* as assert") "assert")
|
| 572 | (("\\* as debugAPI") "debugAPI"))
|
| 573 | #t))))
|
| 574 | (build-system node-build-system)
|
| 575 | (arguments
|
| 576 | `(#:node ,node-bootstrap
|
| 577 | #:tests? #f
|
| 578 | #:phases
|
| 579 | (modify-phases %standard-phases
|
| 580 | (add-after 'patch-dependencies 'delete-dependencies
|
| 581 | (lambda args
|
| 582 | (modify-json (delete-dependencies
|
| 583 | `("@types/debug"
|
| 584 | "@types/mocha"
|
| 585 | "@types/node"
|
| 586 | "mocha"
|
| 587 | "ts-node"
|
| 588 | "tslint"
|
| 589 | "typescript")))))
|
| 590 | (replace 'build
|
| 591 | (lambda* (#:key inputs #:allow-other-keys)
|
| 592 | (let ((esbuild (search-input-file inputs "/bin/esbuild")))
|
| 593 | (invoke esbuild
|
| 594 | "--platform=node"
|
| 595 | "--outfile=lib/frontend.js"
|
| 596 | "--bundle"
|
| 597 | "src/frontend.ts")))))))
|
| 598 | (inputs
|
| 599 | (list node-debug-bootstrap node-llparse-builder-bootstrap))
|
| 600 | (native-inputs
|
| 601 | (list esbuild))
|
| 602 | (home-page "https://github.com/nodejs/llparse-frontend#readme")
|
| 603 | (properties '((hidden? . #t)))
|
| 604 | (synopsis "Frontend for the llparse compiler")
|
| 605 | (description "This package is a frontend for the llparse compiler.")
|
| 606 | (license license:expat)))
|
| 607 |
|
| 608 | (define-public node-llparse-bootstrap
|
| 609 | (package
|
| 610 | (name "node-llparse")
|
| 611 | (version "7.3.0")
|
| 612 | (source
|
| 613 | (origin
|
| 614 | (method git-fetch)
|
| 615 | (uri (git-reference
|
| 616 | (url "https://github.com/nodejs/llparse.git")
|
| 617 | (commit (string-append "v" version))))
|
| 618 | (file-name (git-file-name name version))
|
| 619 | (sha256
|
| 620 | (base32
|
| 621 | "09hqjcynkz5iv7aydzdwgs42r7y2zylplv0ff7w0vkdsgb08j22a"))
|
| 622 | (modules '((guix build utils)))
|
| 623 | (snippet
|
| 624 | '(begin
|
| 625 | |
| 626 | |
| 627 | (substitute* '("src/compiler/index.ts"
|
| 628 | "src/implementation/c/node/base.ts"
|
| 629 | "src/implementation/c/node/table-lookup.ts"
|
| 630 | "src/implementation/c/compilation.ts"
|
| 631 | "src/implementation/c/helpers/match-sequence.ts"
|
| 632 | "src/implementation/c/code/mul-add.ts")
|
| 633 | (("\\* as assert") "assert")
|
| 634 | (("\\* as debugAPI") "debugAPI"))
|
| 635 | #t))))
|
| 636 | (build-system node-build-system)
|
| 637 | (arguments
|
| 638 | `(#:node ,node-bootstrap
|
| 639 | #:tests? #f
|
| 640 | #:phases
|
| 641 | (modify-phases %standard-phases
|
| 642 | (add-after 'patch-dependencies 'delete-dependencies
|
| 643 | (lambda args
|
| 644 | (modify-json (delete-dependencies
|
| 645 | `("@stylistic/eslint-plugin"
|
| 646 | "@typescript-eslint/eslint-plugin"
|
| 647 | "@typescript-eslint/parser"
|
| 648 | "@types/debug"
|
| 649 | "@types/mocha"
|
| 650 | "@types/node"
|
| 651 | "esm"
|
| 652 | "eslint"
|
| 653 | "llparse-test-fixture"
|
| 654 | "mocha"
|
| 655 | "ts-node"
|
| 656 | "tslint"
|
| 657 | "typescript")))))
|
| 658 | (replace 'build
|
| 659 | (lambda* (#:key inputs #:allow-other-keys)
|
| 660 | (let ((esbuild (search-input-file inputs "/bin/esbuild")))
|
| 661 | (invoke esbuild
|
| 662 | "--platform=node"
|
| 663 | "--outfile=lib/api.js"
|
| 664 | "--bundle"
|
| 665 | "src/api.ts")))))))
|
| 666 | (inputs
|
| 667 | (list node-debug-bootstrap node-llparse-frontend-bootstrap))
|
| 668 | (native-inputs
|
| 669 | (list esbuild))
|
| 670 | (home-page "https://github.com/nodejs/llparse#readme")
|
| 671 | (properties '((hidden? . #t)))
|
| 672 | (synopsis "Compile incremental parsers to C code")
|
| 673 | (description "This package offers an API for compiling an incremental
|
| 674 | parser definition into a C output.")
|
| 675 | (license license:expat)))
|
| 676 |
|
| 677 | (define-public llhttp-bootstrap
|
| 678 | (package
|
| 679 | (name "llhttp")
|
| 680 | (version "9.4.2")
|
| 681 | (source (origin
|
| 682 | (method git-fetch)
|
| 683 | (uri (git-reference
|
| 684 | (url "https://github.com/nodejs/llhttp.git")
|
| 685 | (commit (string-append "v" version))))
|
| 686 | (file-name (git-file-name name version))
|
| 687 | (sha256
|
| 688 | (base32
|
| 689 | "0yb46qksyw0h14r1qp84xkk8zijfi661991288isivba61hijp2z"))
|
| 690 | (modules '((guix build utils)))
|
| 691 | (snippet
|
| 692 | '(begin
|
| 693 | |
| 694 | |
| 695 | (substitute* "src/llhttp/http.ts"
|
| 696 | (("\\* as assert") "assert"))
|
| 697 | (substitute* "Makefile"
|
| 698 | (("node --import tsx bin/generate.ts")
|
| 699 | "node bin/generate.js"))
|
| 700 | #t))))
|
| 701 | (build-system gnu-build-system)
|
| 702 | (arguments
|
| 703 | `(#:tests? #f |
| 704 | #:make-flags (list (string-append "CLANG=" ,(cc-for-target))
|
| 705 | (string-append "DESTDIR=" (assoc-ref %outputs "out"))
|
| 706 | "PREFIX=")
|
| 707 | #:phases
|
| 708 | (modify-phases %standard-phases
|
| 709 | (replace 'configure
|
| 710 | (lambda* (#:key inputs native-inputs #:allow-other-keys)
|
| 711 | (let ((esbuild (search-input-file (or native-inputs inputs)
|
| 712 | "/bin/esbuild")))
|
| 713 | (invoke esbuild
|
| 714 | "--platform=node"
|
| 715 | "--target=node10"
|
| 716 | "--outfile=bin/generate.js"
|
| 717 | "--bundle" "bin/generate.ts"))))
|
| 718 | (add-before 'install 'create-install-directories
|
| 719 | (lambda* (#:key outputs #:allow-other-keys)
|
| 720 | (let ((out (assoc-ref outputs "out")))
|
| 721 | (for-each (lambda (dir)
|
| 722 | (mkdir-p (string-append out dir)))
|
| 723 | (list "/lib" "/include" "/src"))
|
| 724 | #t)))
|
| 725 | (add-after 'install 'install-src
|
| 726 | (lambda* (#:key outputs #:allow-other-keys)
|
| 727 | (let* ((out (assoc-ref outputs "out"))
|
| 728 | (src-dir (string-append out "/src")))
|
| 729 | (install-file "build/c/llhttp.c" src-dir)
|
| 730 | (install-file "src/native/api.c" src-dir)
|
| 731 | (install-file "src/native/http.c" src-dir)
|
| 732 | #t))))))
|
| 733 | (native-inputs
|
| 734 | `(("esbuild" ,esbuild)
|
| 735 | ("node" ,node-bootstrap)
|
| 736 | ("node-semver" ,node-semver-bootstrap)
|
| 737 | ("node-llparse-bootstrap" ,node-llparse-bootstrap)))
|
| 738 | (home-page "https://github.com/nodejs/llhttp")
|
| 739 | (properties '((hidden? . #t)))
|
| 740 | (synopsis "Parser for HTTP messages")
|
| 741 | (description "This is a rewrite of
|
| 742 | @url{https://github.com/nodejs/http-parser, http-parser} using
|
| 743 | @url{https://github.com/nodejs/llparse, llparse} to generate the C
|
| 744 | source files.")
|
| 745 | (license license:expat)))
|
| 746 |
|
| 747 | (define-public node-lts
|
| 748 | (package
|
| 749 | (inherit node-bootstrap)
|
| 750 | (version "24.18.0")
|
| 751 | (source (origin
|
| 752 | (method url-fetch)
|
| 753 | (uri (string-append "https://nodejs.org/dist/v" version
|
| 754 | "/node-v" version ".tar.gz"))
|
| 755 | (sha256
|
| 756 | (base32
|
| 757 | "1dvy8y51qad7gx5fhlzbfrmav5c9rlasckgxd7n3k1qxnikq0d68"))
|
| 758 | (modules '((guix build utils)))
|
| 759 | (snippet
|
| 760 | '(begin
|
| 761 | |
| 762 | (for-each delete-file-recursively
|
| 763 | (find-files "deps/openssl"
|
| 764 | (lambda (file stat)
|
| 765 | (not (string-contains file "nodejs-openssl.cnf")))))
|
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | (substitute*
|
| 773 | "deps/v8/src/compiler/turboshaft/int64-lowering-reducer.h"
|
| 774 | (("__ Tuple<Word32, Word32>")
|
| 775 | "__ template Tuple<Word32, Word32>"))
|
| 776 | |
| 777 | (for-each delete-file-recursively
|
| 778 | '("deps/brotli"
|
| 779 | "deps/cares"
|
| 780 | "deps/icu-small"
|
| 781 | "deps/nghttp2"
|
| 782 | "deps/ngtcp2"
|
| 783 | "deps/llhttp"
|
| 784 | "deps/uv"
|
| 785 | "deps/zlib"
|
| 786 | "deps/zstd"))))))
|
| 787 | (arguments
|
| 788 | (substitute-keyword-arguments arguments
|
| 789 | ((#:configure-flags configure-flags)
|
| 790 | ''("--shared-cares"
|
| 791 | "--shared-libuv"
|
| 792 | "--shared-http-parser"
|
| 793 | "--shared-http-parser-libname=llhttp"
|
| 794 | "--shared-nghttp2"
|
| 795 | "--shared-openssl"
|
| 796 | "--shared-zlib"
|
| 797 | "--shared-brotli"
|
| 798 | "--with-intl=system-icu"
|
| 799 | "--shared-ngtcp2"
|
| 800 | "--shared-nghttp3"
|
| 801 | "--shared-zstd"
|
| 802 | |
| 803 | "--v8-enable-snapshot-compression"))
|
| 804 | ((#:phases phases)
|
| 805 | `(modify-phases ,phases
|
| 806 | (replace 'set-bootstrap-host-rpath
|
| 807 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 808 | (let* ((inputs (or native-inputs inputs))
|
| 809 | (c-ares (assoc-ref inputs "c-ares"))
|
| 810 | (brotli (assoc-ref inputs "brotli"))
|
| 811 | (icu4c (assoc-ref inputs "icu4c"))
|
| 812 | (nghttp2 (assoc-ref inputs "nghttp2"))
|
| 813 | (openssl (assoc-ref inputs "openssl"))
|
| 814 | (libuv (assoc-ref inputs "libuv"))
|
| 815 | (zlib (assoc-ref inputs "zlib"))
|
| 816 | (host-binaries '("torque"
|
| 817 | "bytecode_builtins_list_generator"
|
| 818 | "gen-regexp-special-case"
|
| 819 | "node_mksnapshot"
|
| 820 | "mksnapshot")))
|
| 821 | (substitute* '("node.gyp" "tools/v8_gypfiles/v8.gyp")
|
| 822 | (((string-append "'target_name': '("
|
| 823 | (string-join host-binaries "|")
|
| 824 | ")',")
|
| 825 | target)
|
| 826 | (string-append target
|
| 827 | "'ldflags': ['-Wl,-rpath="
|
| 828 | c-ares "/lib:"
|
| 829 | brotli "/lib:"
|
| 830 | icu4c "/lib:"
|
| 831 | nghttp2 "/lib:"
|
| 832 | openssl "/lib:"
|
| 833 | libuv "/lib:"
|
| 834 | zlib "/lib"
|
| 835 | "'],"))))))
|
| 836 | (add-after 'patch-hardcoded-program-references
|
| 837 | 'patch-additional-hardcoded-program-references
|
| 838 | (lambda* (#:key inputs #:allow-other-keys)
|
| 839 | (substitute* "test/parallel/test-stdin-from-file-spawn.js"
|
| 840 | (("'/bin/sh'") (string-append
|
| 841 | "'" (search-input-file inputs "/bin/sh")
|
| 842 | "'")))))
|
| 843 | (replace 'delete-problematic-tests
|
| 844 | (lambda* (#:key inputs #:allow-other-keys)
|
| 845 | |
| 846 | |
| 847 | (for-each delete-file
|
| 848 | '("test/parallel/test-cluster-primary-error.js"
|
| 849 | "test/parallel/test-cluster-primary-kill.js"
|
| 850 | "test/parallel/test-node-run.js"))
|
| 851 |
|
| 852 | |
| 853 | (for-each delete-file
|
| 854 | '("test/parallel/test-dns.js"
|
| 855 | "test/parallel/test-dns-lookupService-promises.js"
|
| 856 | "test/parallel/test-net-socket-connect-without-cb.js"
|
| 857 | "test/parallel/test-tcp-wrap-listen.js"
|
| 858 | "test/report/test-report-exclude-network.js"))
|
| 859 |
|
| 860 | |
| 861 | (for-each delete-file
|
| 862 | '("test/parallel/test-https-agent-unref-socket.js"))
|
| 863 |
|
| 864 | |
| 865 | |
| 866 | (for-each delete-file
|
| 867 | '("test/parallel/test-fs-utimes.js"))
|
| 868 |
|
| 869 | |
| 870 | |
| 871 | (delete-file "test/parallel/test-net-listen-after-destroying-stdin.js")
|
| 872 |
|
| 873 | |
| 874 | |
| 875 | ,@(if (target-arm32?)
|
| 876 | '((for-each delete-file
|
| 877 | '("test/parallel/test-zlib.js"
|
| 878 | "test/parallel/test-zlib-brotli.js"
|
| 879 | "test/parallel/test-zlib-brotli-flush.js"
|
| 880 | "test/parallel/test-zlib-brotli-from-brotli.js"
|
| 881 | "test/parallel/test-zlib-brotli-from-string.js"
|
| 882 | "test/parallel/test-zlib-convenience-methods.js"
|
| 883 | "test/parallel/test-zlib-random-byte-pipes.js"
|
| 884 | "test/parallel/test-zlib-write-after-flush.js")))
|
| 885 | '())
|
| 886 |
|
| 887 | |
| 888 | |
| 889 | ,@(if (target-32bit?)
|
| 890 | '((delete-file "test/parallel/test-fs-utimes-y2K38.js")
|
| 891 |
|
| 892 | (delete-file "test/parallel/test-debugger-heap-profiler.js"))
|
| 893 | '())
|
| 894 |
|
| 895 | |
| 896 | |
| 897 | |
| 898 | |
| 899 | (for-each delete-file
|
| 900 | '("test/parallel/test-tls-passphrase.js"
|
| 901 | "test/parallel/test-tls-server-verify.js"))
|
| 902 |
|
| 903 | |
| 904 | |
| 905 | (for-each delete-file
|
| 906 | '("test/parallel/test-process-euid-egid.js"
|
| 907 | "test/parallel/test-process-initgroups.js"
|
| 908 | "test/parallel/test-process-setgroups.js"
|
| 909 | "test/parallel/test-process-uid-gid.js"))))
|
| 910 | (add-after 'delete-problematic-tests 'patch-problematic-tests
|
| 911 | (lambda _
|
| 912 | |
| 913 | (substitute*
|
| 914 | '("test/parallel/test-http2-premature-close.js"
|
| 915 | "test/parallel/test-http2-invalid-last-stream-id.js")
|
| 916 | (("client\\.connect\\(address\\)")
|
| 917 | "client.connect(address.port)"))))
|
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | (add-after 'install 'ignore-number-of-hardlinks
|
| 941 | (lambda* (#:key outputs #:allow-other-keys)
|
| 942 | (let ((dir (string-append (assoc-ref outputs "out")
|
| 943 | "/lib/node_modules/npm/node_modules"
|
| 944 | "/tar/dist")))
|
| 945 | (substitute*
|
| 946 | (list (string-append dir "/esm/write-entry.js")
|
| 947 | (string-append dir "/commonjs/write-entry.js"))
|
| 948 | (("this.stat.nlink > 1") "false")))))
|
| 949 | (replace 'fix-node-gyp-reference
|
| 950 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 951 | (let ((out (assoc-ref outputs "out")))
|
| 952 | (for-each
|
| 953 | (lambda (spec)
|
| 954 | (wrap-program (string-append out spec)
|
| 955 | `("npm_package_config_node_gyp_nodedir" = (,out))))
|
| 956 | '("/bin/npm"
|
| 957 | "/bin/npx")))))))))
|
| 958 | (native-inputs
|
| 959 | (list |
| 960 | c-ares-for-node-lts
|
| 961 | brotli
|
| 962 | icu4c-76
|
| 963 | libuv-for-node-lts
|
| 964 | `(,nghttp2-for-node-lts "lib")
|
| 965 | openssl
|
| 966 | zlib
|
| 967 | |
| 968 | |
| 969 | perl
|
| 970 | pkg-config
|
| 971 | procps
|
| 972 | python
|
| 973 | util-linux
|
| 974 | gcc-14))
|
| 975 | (inputs
|
| 976 | (list bash-minimal
|
| 977 | coreutils
|
| 978 | c-ares-for-node-lts
|
| 979 | icu4c-76
|
| 980 | libuv-for-node-lts
|
| 981 | llhttp-bootstrap
|
| 982 | brotli
|
| 983 | ngtcp2
|
| 984 | nghttp3
|
| 985 | `(,nghttp2-for-node-lts "lib")
|
| 986 | openssl
|
| 987 | zlib
|
| 988 | `(,zstd-1.5.7 "lib")))
|
| 989 | (supported-systems
|
| 990 | (cons "riscv64-linux" (package-supported-systems node-bootstrap)))
|
| 991 | (properties (alist-delete 'hidden? (package-properties node-bootstrap)))))
|
| 992 |
|
| 993 | (define-public node node-lts)
|
| 994 |
|
| 995 | (define-public libnode
|
| 996 | (package/inherit node-lts
|
| 997 | (name "libnode")
|
| 998 | (arguments
|
| 999 | (substitute-keyword-arguments arguments
|
| 1000 | ((#:configure-flags flags ''())
|
| 1001 | `(cons* "--shared" "--without-npm" ,flags))
|
| 1002 | ((#:phases phases '%standard-phases)
|
| 1003 | `(modify-phases ,phases
|
| 1004 | (delete 'fix-node-gyp-reference)
|
| 1005 | (delete 'patch-nested-shebangs)
|
| 1006 | (delete 'ignore-number-of-hardlinks)))))))
|