Skip to content

Commit

Permalink
cargo_bin.bbclass: Minimize calls to rust_target
Browse files Browse the repository at this point in the history
Don't evaluate this inside a function definition.
Fixes issues with "metadata is not deterministic".

Fixes rust-embedded#195
  • Loading branch information
ernstp-se committed Feb 5, 2025
1 parent c433ca7 commit 2ca23ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion classes/cargo_bin.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export CARGO_TARGET_DIR = "${B}"

RUST_TARGET = "${@rust_target(d, 'TARGET')}"
RUST_BUILD = "${@rust_target(d, 'BUILD')}"
CARGO_TARGET_LINKER_NAME = "${@d.getVar('RUST_TARGET', True).replace('-','_').upper()}"

# Additional flags passed directly to the "cargo build" invocation
EXTRA_CARGO_FLAGS ??= ""
Expand Down Expand Up @@ -112,7 +113,7 @@ cargo_bin_do_compile() {
export CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true"
export CARGO_UNSTABLE_HOST_CONFIG="true"
export CARGO_TARGET_APPLIES_TO_HOST="false"
export CARGO_TARGET_${@rust_target(d, 'TARGET').replace('-','_').upper()}_LINKER="${WRAPPER_DIR}/linker-wrapper.sh"
export CARGO_TARGET_${CARGO_TARGET_LINKER_NAME}_LINKER="${WRAPPER_DIR}/linker-wrapper.sh"
export CARGO_HOST_LINKER="${WRAPPER_DIR}/linker-native-wrapper.sh"
export CARGO_BUILD_FLAGS="-C rpath"
export CARGO_PROFILE_RELEASE_DEBUG="true"
Expand Down

0 comments on commit 2ca23ec

Please sign in to comment.