GNU bug report logs - #49946
[PATCH 00/31] Tree-sitter, node-gyp addon support and emacs-tree-sitter

Previous Next

Package: guix-patches;

Reported by: Pierre Langlois <pierre.langlois <at> gmx.com>

Date: Sun, 8 Aug 2021 23:27:01 UTC

Severity: normal

Tags: patch

Full log


Message #218 received at 49946 <at> debbugs.gnu.org (full text, mbox):

From: Philip McGrath <philip <at> philipmcgrath.com>
To: Maxime Devos <maximedevos <at> telenet.be>,
 Pierre Langlois <pierre.langlois <at> gmx.com>, 49946 <at> debbugs.gnu.org
Subject: Re: [bug#49946] [PATCH 08/31] gnu: node: Patch /usr/bin/env in
 node-gyp.
Date: Thu, 23 Sep 2021 05:18:46 -0400
I'm interested in the node-gyp part of this, which has come up in some 
other software I'm trying to package. These comments come with the 
caveat that my experience with node.js and npm is fairly shallow.

On 8/10/21 2:28 PM, Maxime Devos wrote:
> Pierre Langlois schreef op ma 09-08-2021 om 00:33 [+0100]:
>> @@ -120,6 +120,10 @@
>>                  (("'/usr/bin/env'")
>>                   (string-append "'" (which "env") "'")))
>>
>> +             ;; Fix /usr/bin/env shebang in node-gyp.
>> +             (substitute* "deps/npm/node_modules/node-gyp/bin/node-gyp.js"
>> +               (("#!/usr/bin/env") (string-append "#!" (which "env"))))
> 
> For cross-compilation, this should most likely be
> (string-append (assoc-ref inputs "coreutils") "/bin/env")
> or something like that instead.  Likewise in other places.

Since the shebang line for node-gyp is specifically "#!/usr/bin/env 
node", I wonder if it should use the node built by this package, rather 
than a dynamic node.

More generally, I see that there are 355 directories installed under 
"lib/node_modules/npm/node_modules" (which corresponds to the "deps" 
path above). Most of them don't seem to be available as Guix packages 
that could be depended upon by other Guix node packages. I'd guess 
node-gyp may not be the only one with shebangs that ought to be patched.

On 8/8/21 6:29 PM, Pierre Langlois wrote:

>    ... `node-gyp' needs

>    node headers to compile against, packaged as a tarball, which it tries

>    to download.  Instead, we can run a `node-gyp --tarball <> configure'

>    step to manually provide the tarball, which we can package separately

>    for any given node version.

There is also a --nodedir option, which I found could work with 
something like:

    (string-append "--nodedir=" (assoc-ref inputs "node"))

That seems like it might be better, though I don't know all the 
considerations for cross-compilation and such.

-Philip




This bug report was last modified 2 years and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.