unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jelle Licht <jlicht@fsfe.org>
To: Julien Lepiller <julien@lepiller.eu>, 36602@debbugs.gnu.org
Subject: [bug#36602] [PATCH] Add node-build-system.
Date: Thu, 11 Jul 2019 20:25:06 +0200	[thread overview]
Message-ID: <87ef2wsa2l.fsf@jlicht.xyz> (raw)
In-Reply-To: <20190711184653.3f6956b8@sybil.lepiller.eu>


Hello Julien,

Julien Lepiller <julien@lepiller.eu> writes:

> Hi Guix!
>
> This patch adds a node-build-system. I wasn't sure if it was ready yet,
> but I think, since I didn't change it in the last months, that it might
> actually be :)
>
> The patch was initially made by Jelle Licht, and I improved a bit on
> it. Note that packages built with this build system will embed symlinks
> to their dependencies, but not devDependencies (build-only
> dependencies) according to the information in the metadata. Each
> package is installed in lib/node_modules/package-name and symlinks are
> added to lib/node_modules/package-name/node_modules. This allows us to
> use only inputs instead of propagated inputs. Executables are installed
> in bin according to metadata, and they should work even if called
> directly from their store path.

I am probably a bit of a hypocrite for the following nitpicks, as I am
quite sure I was the one that introduced pretty much all of them them,
so I offer my apologies in advance :-).

> From 38158940be0ef4780cdbb553cfa039d21fcdda9b Mon Sep 17 00:00:00 2001
> From: Jelle Licht <jlicht@fsfe.org>
> Date: Tue, 23 Aug 2016 05:23:55 +0200
> Subject: [PATCH] build: Add node-build-system.
>
> * guix/build/node-build-system.scm: New file.
> * guix/build-system/node.scm: New file.
> * guix/build/json.scm: New file.
> * doc/guix.texi: Document it.
> * Makefile.am: Added new files.
>
> Co-Authored-By: Julien Lepiller <julien@lepiller.eu>
> ---
>  Makefile.am                      |   2 +
>  doc/guix.texi                    |  11 +
>  guix/build-system/node.scm       | 139 +++++++++++
>  guix/build/json.scm              | 387 +++++++++++++++++++++++++++++++
>  guix/build/node-build-system.scm | 159 +++++++++++++
>  5 files changed, 698 insertions(+)
>  create mode 100644 guix/build-system/node.scm
>  create mode 100644 guix/build/json.scm
>  create mode 100644 guix/build/node-build-system.scm
>
> diff --git a/Makefile.am b/Makefile.am
> index 82eda6042a..38f2d7e690 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -125,6 +125,7 @@ MODULES =					\
>    guix/build-system/guile.scm			\
>    guix/build-system/haskell.scm			\
>    guix/build-system/linux-module.scm		\
> +  guix/build-system/node.scm			\
>    guix/build-system/perl.scm			\
>    guix/build-system/python.scm			\
>    guix/build-system/ocaml.scm			\
> @@ -170,6 +171,7 @@ MODULES =					\
>    guix/build/gnu-build-system.scm		\
>    guix/build/gnu-dist.scm			\
>    guix/build/guile-build-system.scm		\
> +  guix/build/node-build-system.scm		\

We are missing the `json.scm' file in this listing.

> [snip]

> +(define* (node-build store name inputs
> +                     #:key
> +                     (npm-flags ''())
> +                     (global? #f)
I am not quite sure if this is needed. Put another way: would we not
want all package builds to have `global? #t' in Guix?

> +                     (test-target "test")
This one is no longer in use. 

> +                     (tests? #f)
I know that for most modules we will not even be able to run tests, but
it seems silly to disable them by default, as that would hide the issue.

> [snip]

> +(define* (install #:key outputs inputs global? #:allow-other-keys)
> +  "Install the node module to the output store item. MODULENAME defines
> +under which name the module will be installed, GLOBAL? determines whether this
> +is an npm global install."
> +  (let* ((out          (assoc-ref outputs "out"))
> +         (src-dir      (getcwd))
> +         (tgt-dir      (string-append out "/lib"))
> +         (bin-dir      (string-append out "/bin"))
> +         (modulename   (string-append  (assoc-ref (read-package-data) "name")))
> +         (data         (read-package-data))
> +         (bin-conf     (assoc-ref data "bin"))
> +         (dependencies (match (assoc-ref data "dependencies")
> +                         ((@ deps ...) deps)
> +                         (#f #f))))
It might be better to write out most of these
names. I think we could also move `modulename' one line lower, so it can
become `(modulename (assoc-ref data "name"))'.

If you want me to tidy up these things, let me know; I can do it first
thing after the weekend.

Thanks

Jelle

  reply	other threads:[~2019-07-11 18:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 16:46 [bug#36602] [PATCH] Add node-build-system Julien Lepiller
2019-07-11 18:25 ` Jelle Licht [this message]
2019-07-13 12:42   ` Ludovic Courtès
2019-07-13 20:20     ` Julien Lepiller
2019-07-13 21:30       ` Jelle Licht
2019-07-14 10:34         ` bug#36602: " Julien Lepiller
2019-07-14 12:46           ` [bug#36602] " swedebugia
2019-07-13 15:32 ` goodoldpaul
2019-07-14 11:09 ` [bug#36602] guix/build/json.scm Robert Vollmert
2019-07-14 12:59   ` Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ef2wsa2l.fsf@jlicht.xyz \
    --to=jlicht@fsfe.org \
    --cc=36602@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).