[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules.
From: |
Philip McGrath |
Subject: |
[bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules. |
Date: |
Thu, 16 Dec 2021 21:02: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 | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index d433118213..3bd98c715e 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -105,6 +105,11 @@ (define-public node
;; Run only the CI tests. The default test target requires additional
;; add-ons from NPM that are not distributed with the source.
#:test-target "test-ci-js"
+ #:modules
+ ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1)
+ (ice-9 match))
#:phases
(modify-phases %standard-phases
(add-before 'configure 'patch-hardcoded-program-references
@@ -240,21 +245,23 @@ (define-public node
(search-input-file inpts "/bin/python"))))
"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)
+ ;; Based on the implementation of patch-shebangs
+ ;; from (guix build gnu-build-system).
+ (let ((path (append-map (match-lambda
+ ((_ . dir)
+ (list (string-append dir "/bin")
+ (string-append dir "/sbin")
+ (string-append dir "/libexec"))))
+ (append outputs inputs))))
+ (for-each
+ (lambda (file)
+ (patch-shebang file path))
+ (find-files (search-input-directory outputs "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)
@@ -283,6 +290,7 @@ (define-public node
libuv
`(,nghttp2 "lib")
openssl
+ python-wrapper ;; for node-gyp (supports python3)
zlib))
(synopsis "Evented I/O for V8 JavaScript")
(description "Node.js is a platform built on Chrome's JavaScript runtime
@@ -802,6 +810,7 @@ (define-public node-lts
brotli
`(,nghttp2 "lib")
openssl
+ python-wrapper ;; for node-gyp (supports python3)
zlib))))
(define-public libnode
@@ -813,5 +822,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 v4 41/45] gnu: Add node-serialport-parser-inter-byte-timeout., (continued)
- [bug#51838] [PATCH v4 41/45] gnu: Add node-serialport-parser-inter-byte-timeout., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 40/45] gnu: Add node-serialport-parser-ready., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 43/45] gnu: Add node-serialport-parser-byte-length., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 45/45] gnu: Add node-serialport., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 42/45] gnu: Add node-serialport-parser-cctalk., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 44/45] gnu: Add node-serialport-stream., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 02/45] gnu: node: Update to 10.24.1 for bootstrapping., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 05/45] guix: node-build-system: Add delete-lockfiles phase., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules.,
Philip McGrath <=
- [bug#51838] [PATCH v5 11/45] gnu: node-debug-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 04/45] gnu: node: Add an npmrc file to set nodedir., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 10/45] gnu: node-binary-search-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Philip McGrath, 2021/12/16
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Liliana Marie Prikler, 2021/12/16
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Philip McGrath, 2021/12/18
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Liliana Marie Prikler, 2021/12/18
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Timothy Sample, 2021/12/18
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Philip McGrath, 2021/12/20
- [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase., Liliana Marie Prikler, 2021/12/20