[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch staging updated: cargo-build-system: Accept a #:features argument
From: |
guix-commits |
Subject: |
branch staging updated: cargo-build-system: Accept a #:features argument |
Date: |
Mon, 23 Mar 2020 17:27:07 -0400 |
This is an automated email from the git hooks/post-receive script.
niedzejkob pushed a commit to branch staging
in repository guix.
The following commit(s) were added to refs/heads/staging by this push:
new 927c251 cargo-build-system: Accept a #:features argument
927c251 is described below
commit 927c2518465579d48315e8e6b5102097c146fece
Author: Jakub Kądziołka <address@hidden>
AuthorDate: Fri Mar 6 22:34:53 2020 +0100
cargo-build-system: Accept a #:features argument
* guix/build/cargo-build-system.scm (build, install): Pass the features
to cargo.
(check): Remove indirection layer for consistency with build and
install.
* guix/build-system/cargo.scm (cargo-build): New argument; pass it into
the builder.
* gnu/packages/rust-apps.scm (ripgrep): Use the new argument instead of
a custom phase.
---
gnu/packages/rust-apps.scm | 14 ++------------
guix/build-system/cargo.scm | 3 +++
guix/build/cargo-build-system.scm | 13 +++++++++----
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index af51c0f..2c718a1 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -244,18 +244,8 @@ provides defaults for 80% of the use cases.")
(install-file manpage (string-append
(assoc-ref outputs "out")
"/share/man/man1"))))
- #t))
- (replace 'install
- ;; Adapted from (guix build cargo-build-system). The flags need to
- ;; be passed to `cargo install' too, as otherwise it will build
- ;; another binary, without the features.
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- (mkdir-p out)
- (setenv "CARGO_TARGET_DIR" "./target")
- (invoke "cargo" "install" "--path" "." "--root" out
- "--features" "pcre2")))))
- #:cargo-build-flags '("--release" "--features" "pcre2")))
+ #t)))
+ #:features '("pcre2")))
(native-inputs
`(("asciidoc" ,asciidoc)
("pcre2" ,pcre2)
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 1e8b3a5..6c8edf6 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
;;; Copyright © 2016 David Craven <address@hidden>
;;; Copyright © 2019 Ivan Petkov <address@hidden>
+;;; Copyright © 2020 Jakub Kądziołka <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -76,6 +77,7 @@ to NAME and VERSION."
(vendor-dir "guix-vendor")
(cargo-build-flags ''("--release"))
(cargo-test-flags ''("--release"))
+ (features ''())
(skip-build? #f)
(phases '(@ (guix build cargo-build-system)
%standard-phases))
@@ -104,6 +106,7 @@ to NAME and VERSION."
#:vendor-dir ,vendor-dir
#:cargo-build-flags ,cargo-build-flags
#:cargo-test-flags ,cargo-test-flags
+ #:features ,features
#:skip-build? ,skip-build?
#:tests? ,(and tests? (not skip-build?))
#:phases ,phases
diff --git a/guix/build/cargo-build-system.scm
b/guix/build/cargo-build-system.scm
index 0721989..95e8dd7 100644
--- a/guix/build/cargo-build-system.scm
+++ b/guix/build/cargo-build-system.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
;;; Copyright © 2019 Ivan Petkov <address@hidden>
;;; Copyright © 2019, 2020 Efraim Flashner <address@hidden>
+;;; Copyright © 2020 Jakub Kądziołka <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -140,11 +141,14 @@ directory = '" port)
(define* (build #:key
skip-build?
+ features
(cargo-build-flags '("--release"))
#:allow-other-keys)
"Build a given Cargo package."
(or skip-build?
- (apply invoke `("cargo" "build" ,@cargo-build-flags))))
+ (apply invoke "cargo" "build"
+ "--features" (string-join features)
+ cargo-build-flags)))
(define* (check #:key
tests?
@@ -152,10 +156,10 @@ directory = '" port)
#:allow-other-keys)
"Run tests for a given Cargo package."
(if tests?
- (apply invoke `("cargo" "test" ,@cargo-test-flags))
+ (apply invoke "cargo" "test" cargo-test-flags)
#t))
-(define* (install #:key inputs outputs skip-build? #:allow-other-keys)
+(define* (install #:key inputs outputs skip-build? features #:allow-other-keys)
"Install a given Cargo package."
(let* ((out (assoc-ref outputs "out")))
(mkdir-p out)
@@ -168,7 +172,8 @@ directory = '" port)
;; otherwise cargo will raise an error.
(or skip-build?
(not (has-executable-target?))
- (invoke "cargo" "install" "--path" "." "--root" out))))
+ (invoke "cargo" "install" "--path" "." "--root" out
+ "--features" (string-join features)))))
(define %standard-phases
(modify-phases gnu:%standard-phases
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch staging updated: cargo-build-system: Accept a #:features argument,
guix-commits <=