diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-05 13:39:43 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-08 15:44:20 +0100 |
commit | 251f55374d26b5c24d8833aa87c95432be8b81b2 (patch) | |
tree | d83905b2963e8604ea754d85d1176d2fef417ab3 /meta/recipes-devtools/rust | |
parent | cdd65a42a8b7c23d3640d341c84e747dfb96d269 (diff) | |
download | poky-251f55374d26b5c24d8833aa87c95432be8b81b2.tar.gz |
cargo: Drop cross-canadian variant and fix/use nativesdk
The cargo-cross-candian variant made no sense as one version of cargo in
the SDK can work for all targets. Replace it with nativesdk-cargo instead.
Move the SDK env to rust-cross-canadian.
(From OE-Core rev: 6d6d135924eff5993736ee58ba8cc5d00ca635f3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust')
-rw-r--r-- | meta/recipes-devtools/rust/rust-cross-canadian.inc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc index 8bbbd61bdc..677bd8842c 100644 --- a/meta/recipes-devtools/rust/rust-cross-canadian.inc +++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc | |||
@@ -16,6 +16,18 @@ do_compile () { | |||
16 | rust_runx build --stage 2 | 16 | rust_runx build --stage 2 |
17 | } | 17 | } |
18 | 18 | ||
19 | create_sdk_wrapper () { | ||
20 | file="$1" | ||
21 | shift | ||
22 | |||
23 | cat <<- EOF > "${file}" | ||
24 | #!/bin/sh | ||
25 | \$$1 \$@ | ||
26 | EOF | ||
27 | |||
28 | chmod +x "$file" | ||
29 | } | ||
30 | |||
19 | do_install () { | 31 | do_install () { |
20 | # Rust requires /usr/lib to contain the libs. | 32 | # Rust requires /usr/lib to contain the libs. |
21 | # Similar story is with /usr/bin ruquiring `lib` to be at the same level. | 33 | # Similar story is with /usr/bin ruquiring `lib` to be at the same level. |
@@ -51,6 +63,11 @@ do_install () { | |||
51 | # Remove executable bit from any files so then SDK doesn't try to relocate. | 63 | # Remove executable bit from any files so then SDK doesn't try to relocate. |
52 | chmod -R -x+X ${SRC_DIR} | 64 | chmod -R -x+X ${SRC_DIR} |
53 | 65 | ||
66 | |||
67 | # Uses SDK's CC as linker so linked binaries works out of box. | ||
68 | install -d ${SYS_BINDIR} | ||
69 | create_sdk_wrapper "${SYS_BINDIR}/target-rust-ccld" "CC" | ||
70 | |||
54 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d | 71 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d |
55 | mkdir "${ENV_SETUP_DIR}" | 72 | mkdir "${ENV_SETUP_DIR}" |
56 | ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" | 73 | ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" |
@@ -61,6 +78,26 @@ do_install () { | |||
61 | EOF | 78 | EOF |
62 | 79 | ||
63 | chown -R root.root ${D} | 80 | chown -R root.root ${D} |
81 | |||
82 | ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh" | ||
83 | cat <<- EOF > "${ENV_SETUP_SH}" | ||
84 | export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo" | ||
85 | mkdir -p "\$CARGO_HOME" | ||
86 | # Init the default target once, it might be otherwise user modified. | ||
87 | if [ ! -f "\$CARGO_HOME/config" ]; then | ||
88 | touch "\$CARGO_HOME/config" | ||
89 | echo "[build]" >> "\$CARGO_HOME/config" | ||
90 | echo 'target = "'${RUST_TARGET_SYS}'"' >> "\$CARGO_HOME/config" | ||
91 | echo '# TARGET_SYS' >> "\$CARGO_HOME/config" | ||
92 | echo '[target.'${RUST_TARGET_SYS}']' >> "\$CARGO_HOME/config" | ||
93 | echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config" | ||
94 | fi | ||
95 | |||
96 | # Keep the below off as long as HTTP/2 is disabled. | ||
97 | export CARGO_HTTP_MULTIPLEXING=false | ||
98 | |||
99 | export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt" | ||
100 | EOF | ||
64 | } | 101 | } |
65 | 102 | ||
66 | PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib" | 103 | PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib" |