[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules.
From: |
Philip McGrath |
Subject: |
[bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules. |
Date: |
Fri, 19 Nov 2021 23:33:43 -0500 |
* gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
and 'patch-node-shebang with a new 'patch-nested-shebangs that also
handles node-gyp and other shebangs under "/lib/node_modules".
[inputs]: Add Python for node-gyp as "python-for-target".
(node-lts)[inputs]: Likewise.
(libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
than 'patch-npm-shebang and 'patch-node-shebang.
---
gnu/packages/node.scm | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 71b66774a6..a57a74fb81 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -237,21 +237,20 @@ (define-public node
python
(string-append python "3")))
"configure" flags))))
- (add-after 'patch-shebangs 'patch-npm-shebang
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((bindir (string-append (assoc-ref outputs "out")
- "/bin"))
- (npm (string-append bindir "/npm"))
- (target (readlink npm)))
- (with-directory-excursion bindir
- (patch-shebang target (list bindir))))))
- (add-after 'install 'patch-node-shebang
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((bindir (string-append (assoc-ref outputs "out")
- "/bin"))
- (npx (readlink (string-append bindir "/npx"))))
- (with-directory-excursion bindir
- (patch-shebang npx (list bindir)))))))))
+ (add-after 'patch-shebangs 'patch-nested-shebangs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((prefix (assoc-ref outputs "out"))
+ (path (map (lambda (dir)
+ (string-append dir "/bin"))
+ (list prefix
+ (assoc-ref inputs "python-for-target")))))
+ (for-each
+ (lambda (file)
+ (patch-shebang file path))
+ (find-files (string-append prefix "/lib/node_modules")
+ (lambda (file stat)
+ (executable-file? file))
+ #:stat lstat))))))))
(native-inputs
`(;; Runtime dependencies for binaries used as a bootstrap.
("c-ares" ,c-ares)
@@ -274,6 +273,7 @@ (define-public node
(inputs
`(("bash" ,bash-minimal)
("coreutils" ,coreutils)
+ ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
("c-ares" ,c-ares)
("http-parser" ,http-parser)
("icu4c" ,icu4c)
@@ -799,6 +799,7 @@ (define-public node-lts
(inputs
`(("bash" ,bash-minimal)
("coreutils" ,coreutils)
+ ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
("c-ares" ,c-ares-for-node)
("icu4c" ,icu4c-67)
("libuv" ,libuv-for-node)
@@ -817,5 +818,4 @@ (define-public libnode
`(cons* "--shared" "--without-npm" ,flags))
((#:phases phases '%standard-phases)
`(modify-phases ,phases
- (delete 'patch-npm-shebang)
- (delete 'patch-node-shebang)))))))
+ (delete 'patch-nested-shebangs)))))))
--
2.32.0
- [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/11/14
- [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases., Philip McGrath, 2021/11/14
- [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping., Philip McGrath, 2021/11/14
- [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/11/14
- [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp., Liliana Marie Prikler, 2021/11/14
- [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies., Liliana Marie Prikler, 2021/11/20
- [bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules.,
Philip McGrath <=
- [bug#51838] [PATCH v2 07/26] gnu: node-ms-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument., Liliana Marie Prikler, 2021/11/20
- [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument., Philip McGrath, 2021/11/20
- [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument., Liliana Marie Prikler, 2021/11/20
- [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp., Timothy Sample, 2021/11/28
- [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 11/26] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 16/26] gnu: node-irc-colors: Use #:absent-dependencies., Philip McGrath, 2021/11/19
- [bug#51838] [PATCH v2 08/26] gnu: node-binary-search-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/11/19