[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#69170] [PATCH rust-team 01/46] build-system: cargo: Add #:cargo-nat
From: |
Tomas Volf |
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 |
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
- [bug#69170] [PATCH rust-team 00/46] Add netavark, Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 01/46] build-system: cargo: Add #:cargo-native-inputs argument.,
Tomas Volf <=
- [bug#69170] [PATCH rust-team 02/46] gnu: Add rust-pulldown-cmark-to-cmark-10., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 04/46] gnu: Add rust-multer-2., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 03/46] gnu: Add rust-sync-wrapper-0.1., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 05/46] gnu: Add rust-iri-string-0.7., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 06/46] gnu: Add rust-tower-http-0.4., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 07/46] gnu: Add rust-axum-macros-0.3., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 09/46] gnu: Add rust-axum-0.6., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 08/46] gnu: Add rust-axum-core-0.3., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 10/46] gnu: rust-async-stream-impl-0.3: Update to 0.3.5., Tomas Volf, 2024/02/15
- [bug#69170] [PATCH rust-team 11/46] gnu: rust-async-stream-0.3: Update to 0.3.5., Tomas Volf, 2024/02/15