From c06a93cba58d8dcf100b7d31821fc3878d024426 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 31 May 2021 15:12:02 +0200 Subject: [PATCH] feat(core/rust): propagate bitcoin_only flag to Rust build --- core/SConscript.firmware | 6 +++++- core/SConscript.unix | 6 +++++- core/embed/rust/Cargo.toml | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/SConscript.firmware b/core/SConscript.firmware index f05765dcf..872eef1a2 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -665,7 +665,11 @@ def cargo_build(): profile = '--release' else: profile = '' - return f'cd embed/rust; cargo build {profile} --target={RUST_TARGET} --target-dir=../../build/firmware/rust' + features = [] + if BITCOIN_ONLY == "1": + features.append("bitcoin_only") + + return f'cd embed/rust; cargo build {profile} --target={RUST_TARGET} --target-dir=../../build/firmware/rust --features "{" ".join(features)}"' rust = env.Command( target=RUST_LIBPATH, diff --git a/core/SConscript.unix b/core/SConscript.unix index 1f3c351f4..fa6453035 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -617,7 +617,11 @@ def cargo_build(): profile = '--release' else: profile = '' - return f'cd embed/rust; cargo build {profile} --target-dir=../../build/unix/rust' + features = [] + if BITCOIN_ONLY == "1": + features.append("bitcoin_only") + + return f'cd embed/rust; cargo build {profile} --target-dir=../../build/unix/rust --features "{" ".join(features)}"' rust = env.Command( target=RUST_LIBPATH, diff --git a/core/embed/rust/Cargo.toml b/core/embed/rust/Cargo.toml index c34cf3955..1060aff2d 100644 --- a/core/embed/rust/Cargo.toml +++ b/core/embed/rust/Cargo.toml @@ -6,6 +6,9 @@ edition = "2018" resolver = "2" build = "build.rs" +[features] +bitcoin_only = [] + [lib] crate-type = ["staticlib"]