all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: David Craven <david@craven.ch>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 08/12] build-system: Add cargo build system.
Date: Mon, 26 Sep 2016 12:17:00 +0200	[thread overview]
Message-ID: <87lgyfklsz.fsf@gnu.org> (raw)
In-Reply-To: <20160922131903.1606-8-david@craven.ch> (David Craven's message of "Thu, 22 Sep 2016 15:18:59 +0200")

David Craven <david@craven.ch> skribis:

> * guix/build-system/cargo.scm (default-cargo, default-rustc,
>   %cargo-build-system-modules, cargo-build, lower, cargo-build-system):
>   New variables.
> * guix/build/cargo-build-system.scm (configure, build, check, install,
>   %standard-phases, cargo-build): New variables.

[...]

> +;; Commentary:
> +;;
> +;; Builder-side code of the standard Python package build procedure.

s/Python/Rust/  :-)

> +(define* (configure #:rest empty)
> +  "Replace Cargo.toml [dependencies] section with guix inputs."
> +  ;;TODO

So what would this do?  Do we end up using bundled dependencies if we
don’t do that?

> +(define* (build #:rest empty)
> +  "Build a given Cargo package."
> +  (zero? (system* "cargo" "build" "--release")))

It may be useful to make "--release" configurable, like the #:build-type
of ‘cmake-build-system’.

Also, ‘empty’ is a confusing variable name here, because it’s definitely
a non-empty list; maybe simply ‘rest’ or ‘_’?

> +(define* (check #:rest empty)

Ditto.

> +(define* (install #:key inputs outputs #:allow-other-keys)
> +  "Install a given Cargo package."
> +  (let* ((out (assoc-ref outputs "out"))
> +         (src (assoc-ref inputs "source"))
> +         (bin (string-append out "/bin"))
> +         (rsrc (string-append out "/rustsrc")))
> +    (mkdir-p rsrc)
> +    (copy-recursively "src" (string-append rsrc "/src"))

Why do we need to install the source code?

If it’s really needed for the functioning of the package, I’d suggest
moving it to OUT/share/rust-source/PACKAGE-VERSION or something like
this, no?

> +    (install-file "Cargo.toml" rsrc)
> +    ;; Will fail if crate doesn't contain an executable
> +    (system* "cargo" "install" "--root" bin)

I suppose many crates provides a library and no executable, so it’d be
nice to find what needs to be done here.  Thoughts?

The rest LGTM.

Thank you!

Ludo’.

  reply	other threads:[~2016-09-26 15:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 13:18 [PATCH 01/12] import: Move json-fetch to (guix import utils) David Craven
2016-09-22 13:18 ` [PATCH 02/12] import: Reorder imports in " David Craven
2016-09-26  9:31   ` Ludovic Courtès
2016-09-22 13:18 ` [PATCH 03/12] import: Move string->license to importers David Craven
2016-09-26  9:32   ` Ludovic Courtès
2016-09-22 13:18 ` [PATCH 04/12] import: utils: Add spdx-string->license David Craven
2016-09-22 14:56   ` Eric Bavier
2016-09-22 15:15     ` David Craven
2016-09-26  9:33   ` Ludovic Courtès
2016-09-22 13:18 ` [PATCH 05/12] import: utils: Refactor license->symbol David Craven
2016-09-26  9:39   ` Ludovic Courtès
2016-09-22 13:18 ` [PATCH 06/12] import: Add importer for rust crates David Craven
2016-09-26 10:02   ` Ludovic Courtès
2016-09-22 13:18 ` [PATCH 07/12] import: crate: Add crate updater David Craven
2016-09-26 10:09   ` Ludovic Courtès
2016-09-22 13:18 ` [PATCH 08/12] build-system: Add cargo build system David Craven
2016-09-26 10:17   ` Ludovic Courtès [this message]
2016-09-26 18:01     ` David Craven
2016-09-30 12:13       ` Ludovic Courtès
2016-09-22 13:19 ` [PATCH 09/12] gnu: Add rust-bootstrap-x86_64-1.12.0 David Craven
2016-09-26 10:18   ` Ludovic Courtès
2016-09-22 13:19 ` [PATCH 10/12] gnu: Add rustc-bootstrap David Craven
2016-09-26 10:24   ` Ludovic Courtès
2016-09-22 13:19 ` [PATCH 11/12] gnu: Add cargo-bootstrap David Craven
2016-09-26 10:28   ` Ludovic Courtès
2016-09-22 13:19 ` [PATCH 12/12] gnu: Add rust helper functions David Craven
2016-09-26 10:29   ` Ludovic Courtès
2016-09-22 14:58 ` [PATCH 01/12] import: Move json-fetch to (guix import utils) Eric Bavier
2016-09-22 15:23   ` David Craven
2016-09-22 16:52     ` Eric Bavier
2016-09-22 16:56       ` David Craven
2016-09-24  5:20         ` Ludovic Courtès

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

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

  git send-email \
    --in-reply-to=87lgyfklsz.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=david@craven.ch \
    --cc=guix-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.