mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
build-system: cargo: Support installing Cargo workspace.
*guix/build-system/cargo.scm (cargo-build, cargo-cross-build) [#:cargo-install-paths]: New argument. * guix/build/cargo-build-system.scm (install): Use it. * doc/guix.texi (Build Systems)[cargo-build-system]: Document it. Change-Id: I74ed1972a5716da05afeac8edb2b0e4b6834bf40
This commit is contained in:
parent
878bdd7fb6
commit
5494343bfc
3 changed files with 21 additions and 5 deletions
|
@ -9582,7 +9582,10 @@ This build system supports cargo workspaces. Parameter
|
||||||
library crates to package in the @code{package} phase. Specified crates are
|
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
|
packaged from left to right, in case there's dependency among them. For
|
||||||
example, specifying @code{''("pcre2-sys" "pcre2")} will package
|
example, specifying @code{''("pcre2-sys" "pcre2")} will package
|
||||||
@code{"pcre2-sys"} first and then @code{"pcre2"}.
|
@code{"pcre2-sys"} first and then @code{"pcre2"}. Parameter
|
||||||
|
@code{#:cargo-install-paths} (default: @code{''()}) allows specifying paths of
|
||||||
|
binary crates to install in the @code{install} phase, @code{''("crates/atuin")},
|
||||||
|
for example.
|
||||||
@end defvar
|
@end defvar
|
||||||
|
|
||||||
@defvar chicken-build-system
|
@defvar chicken-build-system
|
||||||
|
|
|
@ -100,6 +100,7 @@ to NAME and VERSION."
|
||||||
(cargo-test-flags ''())
|
(cargo-test-flags ''())
|
||||||
(cargo-package-crates ''())
|
(cargo-package-crates ''())
|
||||||
(cargo-package-flags ''("--no-metadata" "--no-verify"))
|
(cargo-package-flags ''("--no-metadata" "--no-verify"))
|
||||||
|
(cargo-install-paths ''())
|
||||||
(features ''())
|
(features ''())
|
||||||
(skip-build? #f)
|
(skip-build? #f)
|
||||||
(parallel-build? #t)
|
(parallel-build? #t)
|
||||||
|
@ -129,6 +130,7 @@ to NAME and VERSION."
|
||||||
#:cargo-test-flags #$(sexp->gexp cargo-test-flags)
|
#:cargo-test-flags #$(sexp->gexp cargo-test-flags)
|
||||||
#:cargo-package-crates #$(sexp->gexp cargo-package-crates)
|
#:cargo-package-crates #$(sexp->gexp cargo-package-crates)
|
||||||
#:cargo-package-flags #$(sexp->gexp cargo-package-flags)
|
#:cargo-package-flags #$(sexp->gexp cargo-package-flags)
|
||||||
|
#:cargo-install-paths #$(sexp->gexp cargo-install-paths)
|
||||||
#:cargo-target #$(cargo-triplet system)
|
#:cargo-target #$(cargo-triplet system)
|
||||||
#:features #$(sexp->gexp features)
|
#:features #$(sexp->gexp features)
|
||||||
#:skip-build? #$skip-build?
|
#:skip-build? #$skip-build?
|
||||||
|
@ -162,6 +164,7 @@ to NAME and VERSION."
|
||||||
(cargo-test-flags ''())
|
(cargo-test-flags ''())
|
||||||
(cargo-package-crates ''())
|
(cargo-package-crates ''())
|
||||||
(cargo-package-flags ''("--no-metadata" "--no-verify"))
|
(cargo-package-flags ''("--no-metadata" "--no-verify"))
|
||||||
|
(cargo-install-paths ''())
|
||||||
(cargo-target (cargo-triplet (or target system)))
|
(cargo-target (cargo-triplet (or target system)))
|
||||||
(features ''())
|
(features ''())
|
||||||
(skip-build? #f)
|
(skip-build? #f)
|
||||||
|
@ -194,6 +197,7 @@ to NAME and VERSION."
|
||||||
#:cargo-test-flags #$(sexp->gexp cargo-test-flags)
|
#:cargo-test-flags #$(sexp->gexp cargo-test-flags)
|
||||||
#:cargo-package-crates #$(sexp->gexp cargo-package-crates)
|
#:cargo-package-crates #$(sexp->gexp cargo-package-crates)
|
||||||
#:cargo-package-flags #$(sexp->gexp cargo-package-flags)
|
#:cargo-package-flags #$(sexp->gexp cargo-package-flags)
|
||||||
|
#:cargo-install-paths #$(sexp->gexp cargo-install-paths)
|
||||||
#:cargo-target #$(cargo-triplet (or target system))
|
#:cargo-target #$(cargo-triplet (or target system))
|
||||||
#:features #$(sexp->gexp features)
|
#:features #$(sexp->gexp features)
|
||||||
#:skip-build? #$skip-build?
|
#:skip-build? #$skip-build?
|
||||||
|
|
|
@ -379,6 +379,7 @@ directory = '" vendor-dir "'") port)
|
||||||
skip-build?
|
skip-build?
|
||||||
install-source?
|
install-source?
|
||||||
features
|
features
|
||||||
|
(cargo-install-paths '())
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
"Install a given Cargo package."
|
"Install a given Cargo package."
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
|
@ -393,10 +394,18 @@ directory = '" vendor-dir "'") port)
|
||||||
;; Only install crates which include binary targets,
|
;; Only install crates which include binary targets,
|
||||||
;; otherwise cargo will raise an error.
|
;; otherwise cargo will raise an error.
|
||||||
(or skip-build?
|
(or skip-build?
|
||||||
(not (has-executable-target?))
|
;; NOTE: Cargo workspace installation support:
|
||||||
(invoke "cargo" "install" "--offline" "--no-track"
|
;; #:skip-build? #f + #:cargo-install-paths.
|
||||||
"--path" "." "--root" out
|
(and (null? cargo-install-paths)
|
||||||
"--features" (string-join features)))
|
(not (has-executable-target?)))
|
||||||
|
(for-each
|
||||||
|
(lambda (path)
|
||||||
|
(invoke "cargo" "install" "--offline" "--no-track"
|
||||||
|
"--path" path "--root" out
|
||||||
|
"--features" (string-join features)))
|
||||||
|
(if (null? cargo-install-paths)
|
||||||
|
'(".")
|
||||||
|
cargo-install-paths)))
|
||||||
|
|
||||||
(when install-source?
|
(when install-source?
|
||||||
;; Install crate tarballs and unpacked sources for later use.
|
;; Install crate tarballs and unpacked sources for later use.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue