@@ -9,6 +9,7 @@
;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -105,14 +106,22 @@ (define-public node
#:test-target "test-ci-js"
#:phases
(modify-phases %standard-phases
- (add-before 'configure 'patch-files
+ (add-before 'configure 'patch-hardcoded-program-references
(lambda* (#:key inputs #:allow-other-keys)
+
;; Fix hardcoded /bin/sh references.
- (substitute* '("lib/child_process.js"
- "lib/internal/v8_prof_polyfill.js"
- "test/parallel/test-child-process-spawnsync-shell.js"
- "test/parallel/test-stdio-closed.js"
- "test/sequential/test-child-process-emfile.js")
+ (substitute*
+ (let ((common
+ '("lib/child_process.js"
+ "lib/internal/v8_prof_polyfill.js"
+ "test/parallel/test-child-process-spawnsync-shell.js"
+ "test/parallel/test-stdio-closed.js"
+ "test/sequential/test-child-process-emfile.js"))
+ ;; not in bootstap node:
+ (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
+ (if (file-exists? sigxfsz)
+ (cons sigxfsz common)
+ common))
(("'/bin/sh'")
(string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
@@ -122,7 +131,10 @@ (define-public node
"test/parallel/test-child-process-exec-env.js")
(("'/usr/bin/env'")
(string-append "'" (assoc-ref inputs "coreutils")
- "/bin/env'")))
+ "/bin/env'")))))
+ (add-after 'patch-hardcoded-program-references
+ 'delete-problematic-tests
+ (lambda* (#:key inputs #:allow-other-keys)
;; FIXME: These tests fail in the build container, but they don't
;; seem to be indicative of real problems in practice.
@@ -217,9 +229,13 @@ (define-public node
(setenv "CXX" ,(cxx-for-target))
(setenv "PKG_CONFIG" ,(pkg-config-for-target))
(apply invoke
- (string-append (assoc-ref (or native-inputs inputs)
- "python")
- "/bin/python")
+ (let ((python
+ (string-append (assoc-ref (or native-inputs inputs)
+ "python")
+ "/bin/python")))
+ (if (file-exists? python)
+ python
+ (string-append python "3")))
"configure" flags))))
(add-after 'patch-shebangs 'patch-npm-shebang
(lambda* (#:key outputs #:allow-other-keys)
@@ -256,7 +272,7 @@ (define-public node
(variable "NODE_PATH")
(files '("lib/node_modules")))))
(inputs
- `(("bash" ,bash)
+ `(("bash" ,bash-minimal)
("coreutils" ,coreutils)
("c-ares" ,c-ares)
("http-parser" ,http-parser)
@@ -712,66 +728,8 @@ (define-public node-lts
libuv "/lib:"
zlib "/lib"
"'],"))))))
- (replace 'configure
- ;; Node's configure script is actually a python script, so we can't
- ;; run it with bash.
- (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
- #:allow-other-keys)
- (let* ((prefix (assoc-ref outputs "out"))
- (xflags ,(if (%current-target-system)
- `'("--cross-compiling"
- ,(string-append
- "--dest-cpu="
- (match (%current-target-system)
- ((? (cut string-prefix? "arm" <>))
- "arm")
- ((? (cut string-prefix? "aarch64" <>))
- "arm64")
- ((? (cut string-prefix? "i686" <>))
- "ia32")
- ((? (cut string-prefix? "x86_64" <>))
- "x64")
- ((? (cut string-prefix? "powerpc64" <>))
- "ppc64")
- (_ "unsupported"))))
- ''()))
- (flags (cons
- (string-append "--prefix=" prefix)
- (append xflags configure-flags))))
- (format #t "build directory: ~s~%" (getcwd))
- (format #t "configure flags: ~s~%" flags)
- ;; Node's configure script expects the CC environment variable to
- ;; be set.
- (setenv "CC_host" "gcc")
- (setenv "CXX_host" "g++")
- (setenv "CC" ,(cc-for-target))
- (setenv "CXX" ,(cxx-for-target))
- (setenv "PKG_CONFIG" ,(pkg-config-for-target))
- (apply invoke
- (string-append (assoc-ref (or native-inputs inputs)
- "python")
- "/bin/python3")
- "configure" flags))))
- (replace 'patch-files
+ (replace 'delete-problematic-tests
(lambda* (#:key inputs #:allow-other-keys)
- ;; Fix hardcoded /bin/sh references.
- (substitute* '("lib/child_process.js"
- "lib/internal/v8_prof_polyfill.js"
- "test/parallel/test-child-process-spawnsync-shell.js"
- "test/parallel/test-fs-write-sigxfsz.js"
- "test/parallel/test-stdio-closed.js"
- "test/sequential/test-child-process-emfile.js")
- (("'/bin/sh'")
- (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
-
- ;; Fix hardcoded /usr/bin/env references.
- (substitute* '("test/parallel/test-child-process-default-options.js"
- "test/parallel/test-child-process-env.js"
- "test/parallel/test-child-process-exec-env.js")
- (("'/usr/bin/env'")
- (string-append "'" (assoc-ref inputs "coreutils")
- "/bin/env'")))
-
;; FIXME: These tests fail in the build container, but they don't
;; seem to be indicative of real problems in practice.
(for-each delete-file
@@ -810,8 +768,9 @@ (define-public node-lts
;; TODO: Regenerate certs instead.
(for-each delete-file
'("test/parallel/test-tls-passphrase.js"
- "test/parallel/test-tls-server-verify.js"))
-
+ "test/parallel/test-tls-server-verify.js"))))
+ (add-after 'delete-problematic-tests 'replace-llhttp-sources
+ (lambda* (#:key inputs #:allow-other-keys)
;; Replace pre-generated llhttp sources
(let ((llhttp (assoc-ref inputs "llhttp")))
(copy-file (string-append llhttp "/src/llhttp.c")
@@ -838,7 +797,7 @@ (define-public node-lts
("python" ,python)
("util-linux" ,util-linux)))
(inputs
- `(("bash" ,bash)
+ `(("bash" ,bash-minimal)
("coreutils" ,coreutils)
("c-ares" ,c-ares-for-node)
("icu4c" ,icu4c-67)