summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/rust.inc
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-05 13:33:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-08 15:44:20 +0100
commit82dc055d96f285d6615928b6315718ca29274c23 (patch)
tree0709898126eae1e2d9006c4e6ba7bb3659b365de /meta/recipes-devtools/rust/rust.inc
parent749c85917f38793ca492f667f606621095e4314c (diff)
downloadpoky-82dc055d96f285d6615928b6315718ca29274c23.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. (From OE-Core rev: e2cdbf9df8d3f90b5a7ba35288c5db4f252d134d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust/rust.inc')
-rw-r--r--meta/recipes-devtools/rust/rust.inc20
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() {
73 config = configparser.RawConfigParser() 73 config = configparser.RawConfigParser()
74 74
75 # [target.ARCH-poky-linux] 75 # [target.ARCH-poky-linux]
76 host_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) 76 host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True))
77 config.add_section(host_section) 77 config.add_section(host_section)
78 78
79 llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") 79 llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}")
@@ -86,12 +86,22 @@ python do_configure() {
86 # If we don't do this rust-native will compile it's own llvm for BUILD. 86 # If we don't do this rust-native will compile it's own llvm for BUILD.
87 # [target.${BUILD_ARCH}-unknown-linux-gnu] 87 # [target.${BUILD_ARCH}-unknown-linux-gnu]
88 build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True)) 88 build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True))
89 config.add_section(build_section) 89 if build_section != host_section:
90 config.add_section(build_section)
90 91
91 config.set(build_section, "llvm-config", e(llvm_config_build)) 92 config.set(build_section, "llvm-config", e(llvm_config_build))
92 93
93 config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) 94 config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
94 config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) 95 config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
96
97 target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True))
98 if target_section != host_section and target_section != build_section:
99 config.add_section(target_section)
100
101 config.set(target_section, "llvm-config", e(llvm_config_target))
102
103 config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}")))
104 config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}")))
95 105
96 # [llvm] 106 # [llvm]
97 config.add_section("llvm") 107 config.add_section("llvm")