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/cargo | |
| 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/cargo')
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo-cross-canadian.inc | 85 | ||||
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo-cross-canadian_1.62.0.bb | 6 | ||||
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo.inc | 5 | ||||
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo_1.62.0.bb | 1 |
4 files changed, 6 insertions, 91 deletions
diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc deleted file mode 100644 index a2fac929d4..0000000000 --- a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc +++ /dev/null | |||
| @@ -1,85 +0,0 @@ | |||
| 1 | SUMMARY = "Cargo, a package manager for Rust cross canadian flavor." | ||
| 2 | |||
| 3 | RUST_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" | ||
| 4 | |||
| 5 | HOST_SYS = "${HOST_ARCH}-unknown-linux-gnu" | ||
| 6 | CARGO_RUST_TARGET_CCLD = "${RUST_BUILD_CCLD}" | ||
| 7 | |||
| 8 | inherit rust-target-config | ||
| 9 | require cargo.inc | ||
| 10 | |||
| 11 | CARGO = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" | ||
| 12 | BASEDEPENDS:remove = "cargo-native" | ||
| 13 | |||
| 14 | export RUST_TARGET_PATH="${WORKDIR}/targets/" | ||
| 15 | |||
| 16 | RUSTLIB = " \ | ||
| 17 | -L ${STAGING_DIR_NATIVE}/${SDKPATHNATIVE}/usr/lib/${TARGET_SYS}/rustlib/${HOST_SYS}/lib \ | ||
| 18 | " | ||
| 19 | |||
| 20 | DEPENDS += "rust-native \ | ||
| 21 | rust-cross-canadian-${TRANSLATED_TARGET_ARCH} \ | ||
| 22 | virtual/nativesdk-${HOST_PREFIX}compilerlibs \ | ||
| 23 | nativesdk-openssl nativesdk-zlib \ | ||
| 24 | virtual/nativesdk-libc \ | ||
| 25 | " | ||
| 26 | |||
| 27 | inherit cross-canadian | ||
| 28 | |||
| 29 | PN = "cargo-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
| 30 | |||
| 31 | RUST_TARGETGENS = "BUILD HOST" | ||
| 32 | |||
| 33 | do_compile:prepend () { | ||
| 34 | PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}" | ||
| 35 | } | ||
| 36 | |||
| 37 | create_sdk_wrapper () { | ||
| 38 | file="$1" | ||
| 39 | shift | ||
| 40 | |||
| 41 | cat <<- EOF > "${file}" | ||
| 42 | #!/bin/sh | ||
| 43 | \$$1 \$@ | ||
| 44 | EOF | ||
| 45 | |||
| 46 | chmod +x "$file" | ||
| 47 | } | ||
| 48 | |||
| 49 | do_install () { | ||
| 50 | SYS_BINDIR=$(dirname ${D}${bindir}) | ||
| 51 | install -d "${SYS_BINDIR}" | ||
| 52 | install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${SYS_BINDIR}" | ||
| 53 | for i in ${SYS_BINDIR}/*; do | ||
| 54 | chrpath -r "\$ORIGIN/../lib" ${i} | ||
| 55 | done | ||
| 56 | |||
| 57 | # Uses SDK's CC as linker so linked binaries works out of box. | ||
| 58 | create_sdk_wrapper "${SYS_BINDIR}/target-rust-ccld" "CC" | ||
| 59 | |||
| 60 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d | ||
| 61 | mkdir "${ENV_SETUP_DIR}" | ||
| 62 | ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh" | ||
| 63 | cat <<- EOF > "${ENV_SETUP_SH}" | ||
| 64 | export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo" | ||
| 65 | mkdir -p "\$CARGO_HOME" | ||
| 66 | # Init the default target once, it might be otherwise user modified. | ||
| 67 | if [ ! -f "\$CARGO_HOME/config" ]; then | ||
| 68 | touch "\$CARGO_HOME/config" | ||
| 69 | echo "[build]" >> "\$CARGO_HOME/config" | ||
| 70 | echo 'target = "'${TARGET_SYS}'"' >> "\$CARGO_HOME/config" | ||
| 71 | echo '# TARGET_SYS' >> "\$CARGO_HOME/config" | ||
| 72 | echo '[target.'${TARGET_SYS}']' >> "\$CARGO_HOME/config" | ||
| 73 | echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config" | ||
| 74 | fi | ||
| 75 | |||
| 76 | # Keep the below off as long as HTTP/2 is disabled. | ||
| 77 | export CARGO_HTTP_MULTIPLEXING=false | ||
| 78 | |||
| 79 | export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt" | ||
| 80 | EOF | ||
| 81 | } | ||
| 82 | |||
| 83 | PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin" | ||
| 84 | FILES:${PN} += "${base_prefix}/environment-setup.d ${PKG_SYS_BINDIR}" | ||
| 85 | |||
diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian_1.62.0.bb b/meta/recipes-devtools/cargo/cargo-cross-canadian_1.62.0.bb deleted file mode 100644 index 63fd69107b..0000000000 --- a/meta/recipes-devtools/cargo/cargo-cross-canadian_1.62.0.bb +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | require recipes-devtools/rust/rust-source.inc | ||
| 2 | require recipes-devtools/rust/rust-snapshot.inc | ||
| 3 | |||
| 4 | FILESEXTRAPATHS:prepend := "${THISDIR}/cargo-${PV}:" | ||
| 5 | |||
| 6 | require cargo-cross-canadian.inc | ||
diff --git a/meta/recipes-devtools/cargo/cargo.inc b/meta/recipes-devtools/cargo/cargo.inc index 978504052b..e34554a9d7 100644 --- a/meta/recipes-devtools/cargo/cargo.inc +++ b/meta/recipes-devtools/cargo/cargo.inc | |||
| @@ -56,3 +56,8 @@ export LIBSSH2_SYS_USE_PKG_CONFIG = "1" | |||
| 56 | # so we must use the locally set up snapshot to bootstrap the build. | 56 | # so we must use the locally set up snapshot to bootstrap the build. |
| 57 | BASEDEPENDS:remove:class-native = "cargo-native" | 57 | BASEDEPENDS:remove:class-native = "cargo-native" |
| 58 | CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" | 58 | CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" |
| 59 | |||
| 60 | DEPENDS:append:class-nativesdk = " nativesdk-rust" | ||
| 61 | RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" | ||
| 62 | |||
| 63 | |||
diff --git a/meta/recipes-devtools/cargo/cargo_1.62.0.bb b/meta/recipes-devtools/cargo/cargo_1.62.0.bb index eee58fc245..5c8527708c 100644 --- a/meta/recipes-devtools/cargo/cargo_1.62.0.bb +++ b/meta/recipes-devtools/cargo/cargo_1.62.0.bb | |||
| @@ -2,3 +2,4 @@ require recipes-devtools/rust/rust-source.inc | |||
| 2 | require recipes-devtools/rust/rust-snapshot.inc | 2 | require recipes-devtools/rust/rust-snapshot.inc |
| 3 | require cargo.inc | 3 | require cargo.inc |
| 4 | BBCLASSEXTEND = "native nativesdk" | 4 | BBCLASSEXTEND = "native nativesdk" |
| 5 | RUSTLIB_DEP:class-nativesdk = "" \ No newline at end of file | ||
