diff options
| author | Randy MacLeod <Randy.MacLeod@windriver.com> | 2021-08-10 13:52:19 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-26 22:09:43 +0100 |
| commit | 61e1570c6a09c1984e919e8c0a82a74c1a08d821 (patch) | |
| tree | accab4b08aa3c62f098c9bb19399efb46906256a /meta/recipes-devtools/cargo/cargo-cross-canadian.inc | |
| parent | 705b1d757fa221614f4f72cabf0fac5884cb6bfd (diff) | |
| download | poky-61e1570c6a09c1984e919e8c0a82a74c1a08d821.tar.gz | |
rust: initial merge of most of meta-rust
In the meta-rust repo at commit:
448047c Upgrade to 1.54.0 (#359)
Make the required directories:
mkdir ../oe-core/meta/recipes-devtools/rust
mkdir ../oe-core/meta/recipes-devtools/cargo
mkdir ../oe-core/meta/recipes-example
and then:
cp recipes-devtools/rust/* ../oe-core/meta/recipes-devtools/rust
cp recipes-devtools/cargo/* ../oe-core/meta/recipes-devtools/cargo
cp lib/crate.py ../oe-core/meta/lib
cp recipes-example/* ../oe-core/meta/recipes-example
cp conf/distro/include/rust_* ../oe-core/meta/conf/distro/include/
cp classes/* ../oe-core/meta/classes/
cp recipes-core/packagegroups/packagegroup-rust-cross-canadian.bb ../oe-core/meta/recipes-core/packagegroups
(From OE-Core rev: 3ed57578cca93ff1ba4e0bf3f25566e10659a2f9)
Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/cargo/cargo-cross-canadian.inc')
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo-cross-canadian.inc | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc new file mode 100644 index 0000000000..840793c50b --- /dev/null +++ b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc | |||
| @@ -0,0 +1,74 @@ | |||
| 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 | require recipes-devtools/rust/rust-common.inc | ||
| 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 | LLVM_TARGET[x86_64] = "${RUST_HOST_SYS}" | ||
| 32 | |||
| 33 | python do_rust_gen_targets () { | ||
| 34 | wd = d.getVar('WORKDIR') + '/targets/' | ||
| 35 | |||
| 36 | rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH')) | ||
| 37 | rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH')) | ||
| 38 | } | ||
| 39 | |||
| 40 | do_compile:prepend () { | ||
| 41 | PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}" | ||
| 42 | } | ||
| 43 | |||
| 44 | do_install () { | ||
| 45 | SYS_BINDIR=$(dirname ${D}${bindir}) | ||
| 46 | install -d "${SYS_BINDIR}" | ||
| 47 | install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${SYS_BINDIR}" | ||
| 48 | for i in ${SYS_BINDIR}/*; do | ||
| 49 | chrpath -r "\$ORIGIN/../lib" ${i} | ||
| 50 | done | ||
| 51 | |||
| 52 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d | ||
| 53 | mkdir "${ENV_SETUP_DIR}" | ||
| 54 | ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh" | ||
| 55 | cat <<- EOF > "${ENV_SETUP_SH}" | ||
| 56 | export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo" | ||
| 57 | mkdir -p "\$CARGO_HOME" | ||
| 58 | # Init the default target once, it might be otherwise user modified. | ||
| 59 | if [ ! -f "\$CARGO_HOME/config" ]; then | ||
| 60 | touch "\$CARGO_HOME/config" | ||
| 61 | echo "[build]" >> "\$CARGO_HOME/config" | ||
| 62 | echo 'target = "'${TARGET_SYS}'"' >> "\$CARGO_HOME/config" | ||
| 63 | fi | ||
| 64 | |||
| 65 | # Keep the below off as long as HTTP/2 is disabled. | ||
| 66 | export CARGO_HTTP_MULTIPLEXING=false | ||
| 67 | |||
| 68 | export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt" | ||
| 69 | EOF | ||
| 70 | } | ||
| 71 | |||
| 72 | PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin" | ||
| 73 | FILES:${PN} += "${base_prefix}/environment-setup.d ${PKG_SYS_BINDIR}" | ||
| 74 | |||
