mbox series

[bug#51838,00/11] guix: node-build-system: Support compiling add-ons with node-gyp.

Message ID 20211114124151.36743-1-philip@philipmcgrath.com
Headers show
Series guix: node-build-system: Support compiling add-ons with node-gyp. | expand

Message

Philip McGrath Nov. 14, 2021, 12:41 p.m. UTC
This patch series adds support to `node-build-system` for building native
add-ons using `node-gyp`. To confirm that the changes to the build system
work, the patch series also adds two packages (plus a few dependencies)
representing two major ways of writing Node.js native add-ons:

 1. `node-openzwave-shared` uses `node-nan`: “Native Abstractions for Node.js”.

 2. `node-sqlite3` uses the Node-API via `node-addon-api`.

The patches are adapted from part of a series by Pierre Langlois
at <https://issues.guix.gnu.org/49946>: you can find discussion of an earlier
version of this spun-off series from <https://issues.guix.gnu.org/49946#71>
to <https://issues.guix.gnu.org/49946#83>.
They are also available in a Git repository
at <https://gitlab.com/philip1/guix-patches/-/tree/wip-node-npm-gyp-hist-9>.

In the earlier discussion, Pierre and I both thought it was quite confusing
that the Scheme variable `node` refers to the bootstrap Node.js, while
`node-lts` refers to the newer Node.js that a package specification of
`"node"` would resolve to. My analysis is
at <https://issues.guix.gnu.org/49946#75> (tl;dr it seems like an unintentional
mistake), and Pierre suggested a solution
in <https://issues.guix.gnu.org/49946#81>. I haven't taken that on in this patch
series, but I do think its worth considering.

Philip McGrath (11):
  gnu: node: Avoid duplicating build phases.
  gnu: node: Update to 10.24.1 for bootstrapping.
  guix: node-build-system: Support compiling add-ons with node-gyp.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.

 gnu/packages/node-xyz.scm        | 335 +++++++++++++++++++++++++++++++
 gnu/packages/node.scm            | 143 +++++--------
 gnu/packages/zwave.scm           |  55 +++++
 guix/build-system/node.scm       |  11 +-
 guix/build/node-build-system.scm |  23 +++
 5 files changed, 473 insertions(+), 94 deletions(-)

Comments

Liliana Marie Prikler Jan. 6, 2022, 5:45 p.m. UTC | #1
Hi Philip,

Please pardon the large flood of messages in a short enough of time
without waiting for a reply.  I tried my best to come up with a v8 that
addresses my personal concerns quickly.  

My main changes were to patches 3-5, but note how deleting dependencies
became significantly easier in 6pp.  To list the main differences:
1. I've implemented the alist/JSON utilities in terms of SRFI-1 and SRFI-71.
2. I shortened the additional JSON API to jsobject-ref and jsobject-update*.
   I still believe alist->json-object and json-object->alist would be more
   useful (in particular, the main operation of jsobject-union is actually
   alist-flatten), but I digress.
3. I made it so that delete-dependencies also acts on peerDependencies.
   That way, we don't have to dance around ordering.
4. Regexps :)

If there's anything you'd like to say about this v8, feel free to do so.
As always, there's the waiting time of at least 14 days, which I plan to
adhere to.

Cheers,
Liliana

PS: If someone else wants to push these in my absence, please adjust the
signoffs.  Also, if those mail headers are broken, don't forget to reset
Philip as author.

Philip McGrath (41):
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add JSON utilities.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  guix: node-build-system: Add 'delete-dependencies' helper function.
  gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  gnu: node-semver: Use 'delete-dependencies'.
  gnu: node-wrappy: Use 'delete-dependencies'.
  gnu: node-once: Use 'delete-dependencies'.
  gnu: node-irc-colors: Use 'delete-dependencies'.
  gnu: node-irc: Use 'delete-dependencies'.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readline.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 942 ++++++++++++++++++++++++++++++-
 gnu/packages/node.scm            |  56 +-
 gnu/packages/zwave.scm           |  64 +++
 guix/build-system/node.scm       |   9 +-
 guix/build/node-build-system.scm | 236 +++++++-
 5 files changed, 1247 insertions(+), 60 deletions(-)