all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tomas Volf <~@wolfsden.cz>
To: 69170@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>, Efraim Flashner <efraim@flashner.co.il>
Subject: [bug#69170] [PATCH rust-team 01/46] build-system: cargo: Add #:cargo-native-inputs argument.
Date: Thu, 15 Feb 2024 21:26:14 +0100	[thread overview]
Message-ID: <3142134916e56f2b51bf3f496c3b2d9d3a4ac541.1708028701.git.~@wolfsden.cz> (raw)
In-Reply-To: <cover.1708028701.git.~@wolfsden.cz>

If crate A used by application B needs some package (for example protobuf in
my case) during a build, there was no way to propagate the information.  The
application B would need to explicitly add (native-inputs).  And each user of
crate A would need to do that.

I think that is not optimal, therefore this commit adds new
 #:cargo-native-inputs argument to the cargo-build-system.  It allows
propagating native dependencies to users of the crates.

* guix/build-system/cargo.scm (package-cargo-native-inputs): New procedure.
(lower): New keyword argument cargo-native-inputs.
(lower)[private-keywords]: Add #:cargo-native-inputs.
(lower)[bag]<build-inputs>: Use cargo-native-inputs.
* doc/guix.texi: Document it.

Change-Id: I39c35db4d17842cd7633cf2c1b7d90b74de07679
---
 doc/guix.texi               |  4 +++-
 guix/build-system/cargo.scm | 17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bb0af26d93..3d43ed6dd5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9428,7 +9428,9 @@ Build Systems
 evaluate to a path to a gzipped tarball which includes a @code{Cargo.toml}
 file at its root, or it will be ignored.  Similarly, cargo dev-dependencies
 should be added to the package definition via the
-@code{#:cargo-development-inputs} parameter.
+@code{#:cargo-development-inputs} parameter.  Additionally, if some
+native dependencies are required during a build of a dependent package,
+you can use @code{#:cargo-native-inputs} to specify such packages.
 
 In its @code{configure} phase, this build system will make any source inputs
 specified in the @code{#:cargo-inputs} and @code{#:cargo-development-inputs}
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index c029cc1dda..170a1f70b6 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -207,6 +207,12 @@ (define (package-cargo-development-inputs p)
       cargo-development-inputs)
     (package-arguments p)))
 
+(define (package-cargo-native-inputs p)
+  (apply
+    (lambda* (#:key (cargo-native-inputs '()) #:allow-other-keys)
+      cargo-native-inputs)
+    (package-arguments p)))
+
 (define (crate-closure inputs)
   "Return the closure of INPUTS when considering the 'cargo-inputs' and
 'cargod-dev-deps' edges.  Omit duplicate inputs, except for those
@@ -308,13 +314,14 @@ (define* (lower name
                 (rust-sysroot (default-rust-sysroot target))
                 (cargo-inputs '())
                 (cargo-development-inputs '())
+                (cargo-native-inputs '())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
 
   (define private-keywords
     `(#:rust #:inputs #:native-inputs #:outputs
-      #:cargo-inputs #:cargo-development-inputs
+      #:cargo-inputs #:cargo-development-inputs #:cargo-native-inputs
       #:rust-sysroot
       ,@(if target '() '(#:target))))
 
@@ -338,6 +345,14 @@ (define* (lower name
                     ,@(if target '() inputs)
                     ;,@inputs
 
+                    ,@(apply append
+                             cargo-native-inputs
+                             (map (match-lambda
+                                    ((tag pkg)
+                                     (package-cargo-native-inputs pkg)))
+                                  (crate-closure (append cargo-inputs
+                                                         cargo-development-inputs))))
+
                     ,@(if target
                         ;; Use the standard cross inputs of
                         ;; 'gnu-build-system'.
-- 
2.41.0





  reply	other threads:[~2024-02-15 20:28 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 20:25 [bug#69170] [PATCH rust-team 00/46] Add netavark Tomas Volf
2024-02-15 20:26 ` Tomas Volf [this message]
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 02/46] gnu: Add rust-pulldown-cmark-to-cmark-10 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 03/46] gnu: Add rust-sync-wrapper-0.1 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 04/46] gnu: Add rust-multer-2 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 05/46] gnu: Add rust-iri-string-0.7 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 06/46] gnu: Add rust-tower-http-0.4 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 07/46] gnu: Add rust-axum-macros-0.3 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 08/46] gnu: Add rust-axum-core-0.3 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 09/46] gnu: Add rust-axum-0.6 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 10/46] gnu: rust-async-stream-impl-0.3: Update to 0.3.5 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 11/46] gnu: rust-async-stream-0.3: " Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 12/46] gnu: Add rust-sysctl-0.5 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 13/46] gnu: Add rust-prost-derive-0.12 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 14/46] gnu: Add rust-prost-0.12 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 15/46] gnu: Add rust-prost-types-0.12 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 16/46] gnu: Add rust-prost-build-0.12 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 17/46] gnu: Add rust-tonic-build-0.10 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 18/46] gnu: Add rust-tonic-0.10 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 19/46] gnu: Add rust-nftables-0.3 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 20/46] gnu: Add rust-netlink-sys-0.8 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 21/46] gnu: Add rust-netlink-packet-utils-0.5 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 22/46] gnu: Add rust-netlink-packet-core-0.7 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 23/46] gnu: Add rust-netlink-packet-generic-0.3 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 24/46] gnu: Add rust-netlink-packet-route-0.18 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 25/46] gnu: Add rust-netlink-packet-route-0.19 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 26/46] gnu: Add rust-netlink-proto-0.11 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 27/46] gnu: Add rust-genetlink-0.2 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 28/46] gnu: Add rust-mptcp-pm-0.1 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 29/46] gnu: Add rust-rtnetlink-0.14 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 30/46] gnu: Add rust-ethtool-0.2 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 31/46] gnu: Add rust-nispor-1 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 32/46] gnu: Add rust-etherparse-0.13 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 33/46] gnu: Add rust-dhcproto-macros-0.1 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 34/46] gnu: Add rust-dhcproto-0.9 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 35/46] gnu: Add rust-mozim-0.2 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 36/46] gnu: Add rust-iptables-0.5 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 37/46] gnu: Add rust-env-filter-0.1 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 38/46] gnu: rust-anstyle-1: Update to 1.0.6 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 39/46] gnu: Add rust-env-logger-0.11 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 40/46] gnu: rust-rkyv-derive-0.7: Update to 0.7.44 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 41/46] gnu: rust-rkyv-0.7: " Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 42/46] gnu: Add rust-pure-rust-locales-0.8 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 43/46] gnu: Add rust-windows-metadata-0.52 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 44/46] gnu: Add rust-windows-bindgen-0.52 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 45/46] gnu: rust-chrono-0.4: Update to 0.4.34 Tomas Volf
2024-02-15 20:26 ` [bug#69170] [PATCH rust-team 46/46] gnu: Add netavark Tomas Volf
2024-02-18 12:39 ` [bug#69169] [bug#69170] [PATCH rust-team 00/46] " Efraim Flashner
2024-02-18 14:04   ` Tomas Volf
2024-02-20  7:50     ` [bug#69169] " Efraim Flashner

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='3142134916e56f2b51bf3f496c3b2d9d3a4ac541.1708028701.git.~@wolfsden.cz' \
    --to=~@wolfsden.cz \
    --cc=69170@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    /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.