diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-05 13:33:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-08 15:41:36 +0100 |
commit | e2cdbf9df8d3f90b5a7ba35288c5db4f252d134d (patch) | |
tree | fb9fdf597d3e3b15148626a8e071711ed21f1801 | |
parent | b4b24dc53fdb86624da71b854dfe018923a203fe (diff) | |
download | openembedded-core-contrib-e2cdbf9df8d3f90b5a7ba35288c5db4f252d134d.tar.gz |
rust.inc: Fix for cross compilation configuration
For cross compilation, build, host and target may be different. Ensure
the main rust config has the appropriate sections added to match the
configurations.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/rust/rust.inc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc index 12c86e02c4..7c16b8165b 100644 --- a/meta/recipes-devtools/rust/rust.inc +++ b/meta/recipes-devtools/rust/rust.inc @@ -73,7 +73,7 @@ python do_configure() { config = configparser.RawConfigParser() # [target.ARCH-poky-linux] - host_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) + host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True)) config.add_section(host_section) llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") @@ -86,12 +86,22 @@ python do_configure() { # If we don't do this rust-native will compile it's own llvm for BUILD. # [target.${BUILD_ARCH}-unknown-linux-gnu] build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True)) - config.add_section(build_section) + if build_section != host_section: + config.add_section(build_section) - config.set(build_section, "llvm-config", e(llvm_config_build)) + config.set(build_section, "llvm-config", e(llvm_config_build)) - config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) - config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) + config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) + config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) + + target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) + if target_section != host_section and target_section != build_section: + config.add_section(target_section) + + config.set(target_section, "llvm-config", e(llvm_config_target)) + + config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) + config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) # [llvm] config.add_section("llvm") |