summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHilton Chain <hako@ultrarare.space>2025-06-09 15:58:17 +0800
committerHilton Chain <hako@ultrarare.space>2025-08-21 19:09:04 +0800
commitefaa3e681ef14ac5e0900319557a21fb421b2053 (patch)
tree5eaae31a69bc85b5673156bcf738b7300259500a
parentd71195f5312f50fbcb103fdf466cfe01d229de0c (diff)
build-system: cargo: Deprecate #:cargo-inputs and #:cargo-development-inputs.
* guix/build-system/cargo.scm (lower): Emit warning when using #:cargo-inputs or #:cargo-development-inputs. * doc/guix.texi (Build Systems)[cargo-build-system]: Deprecate #:cargo-inputs and #:cargo-development-inputs. Change-Id: I43ed66e04c55368159aed309367c4ac278d8cc58
-rw-r--r--doc/guix.texi40
-rw-r--r--guix/build-system/cargo.scm6
2 files changed, 25 insertions, 21 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index d87b236aa2f..bde3724dcd7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9554,30 +9554,26 @@ This variable is exported by @code{(guix build-system cargo)}. It
supports builds of packages using Cargo, the build tool of the
@uref{https://www.rust-lang.org, Rust programming language}.
-It adds @code{rustc} and @code{cargo} to the set of inputs.
-A different Rust package can be specified with the @code{#:rust} parameter.
+@quotation Deprecation warning
+Parameters @code{#:cargo-inputs} and @code{#:cargo-development-inputs},
+previously used for specifying source inputs, are deprecated. Their support
+will be removed after Dec. 31, 2026.
+@end quotation
-Regular cargo dependencies should be added to the package definition similarly
-to other packages; those needed only at build time to native-inputs, others to
-inputs. If you need to add source-only crates then you should add them to via
-the @code{#:cargo-inputs} parameter as a list of name and spec pairs, where the
-spec can be a package or a source definition. Note that the spec must
-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.
+It adds @code{rust} and @code{rust:cargo} to the set of inputs.
+A different Rust package can be specified with the @code{#:rust} parameter.
-In its @code{configure} phase, this build system will make any source inputs
-specified in the @code{#:cargo-inputs} and @code{#:cargo-development-inputs}
-parameters available to cargo. It will also remove an included
-@code{Cargo.lock} file to be recreated by @code{cargo} during the
-@code{build} phase. The @code{package} phase will run @code{cargo package}
-to create a source crate for future use. The @code{install} phase installs
-the binaries defined by the crate. Unless @code{install-source? #f} is
-defined it will also install a source crate repository of itself and unpacked
-sources, to ease in future hacking on rust packages.
+In its @code{unpack-rust-crates}, @code{configure} and
+@code{patch-cargo-checksums} phases, this build system will make any source
+inputs available to Cargo. It will also remove an included @code{Cargo.lock}
+file to be recreated by @command{cargo} during the @code{build} phase. The
+@code{package} phase will run @command{cargo package} to create a source crate
+for future use. The @code{install} phase installs the binaries defined by the
+crate. Unless @code{install-source? #f} is defined it will also install a
+source crate repository of itself and unpacked sources, to ease in future
+hacking on Rust packages.
-This build system supports cargo workspaces. Parameter
+This build system supports Cargo workspaces. Parameter
@code{#:cargo-package-crates} (default: @code{''()}) allows specifying names of
library crates to package in the @code{package} phase. Specified crates are
packaged from left to right, in case there's dependency among them. For
@@ -9586,6 +9582,8 @@ example, specifying @code{''("pcre2-sys" "pcre2")} will package
@code{#:cargo-install-paths} (default: @code{''()}) allows specifying paths of
binary crates to install in the @code{install} phase, @code{''("crates/atuin")},
for example.
+
+@xref{Rust Crates}, for packaging guidelines.
@end defvar
@defvar chicken-build-system
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index d2d9a075b99..1c40aa709c1 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -273,6 +273,7 @@ unavailable."
#:graft? #f
#:guile-for-build guile))
+;; TODO: Remove after Dec. 31, 2026.
(define (package-cargo-inputs p)
(apply
(lambda* (#:key (cargo-inputs '()) #:allow-other-keys)
@@ -397,6 +398,11 @@ any dependent crates. This can be a benefits:
#:rust-sysroot #:cargo-target
,@(if target '() '(#:target))))
+ (unless (every null? (list cargo-inputs cargo-development-inputs))
+ (warning (G_ "'~a' and '~a' are deprecated~%")
+ "#:cargo-inputs"
+ "#:cargo-development-inputs"))
+
(bag
(name name)
(system system)