summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/cargo_1.87.0.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/rust/cargo_1.87.0.bb')
-rw-r--r--meta/recipes-devtools/rust/cargo_1.87.0.bb85
1 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rust/cargo_1.87.0.bb b/meta/recipes-devtools/rust/cargo_1.87.0.bb
new file mode 100644
index 0000000000..fc41a19a25
--- /dev/null
+++ b/meta/recipes-devtools/rust/cargo_1.87.0.bb
@@ -0,0 +1,85 @@
1SUMMARY = "Cargo, a package manager for Rust."
2HOMEPAGE = "https://crates.io"
3LICENSE = "MIT | Apache-2.0"
4SECTION = "devel"
5
6DEPENDS = "openssl zlib curl ca-certificates libssh2"
7
8LIC_FILES_CHKSUM = " \
9 file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \
10 file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
11 file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
12"
13
14require rust-source.inc
15require rust-snapshot.inc
16
17S = "${RUSTSRC}/src/tools/cargo"
18CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
19
20inherit cargo pkgconfig
21
22DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
23
24do_cargo_setup_snapshot () {
25 ${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
26 # Need to use uninative's loader if enabled/present since the library paths
27 # are used internally by rust and result in symbol mismatches if we don't
28 if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
29 patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER}
30 fi
31}
32
33addtask cargo_setup_snapshot after do_unpack before do_configure
34do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}"
35do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER"
36
37do_compile:prepend () {
38 export RUSTC_BOOTSTRAP="1"
39}
40
41do_install () {
42 install -d "${D}${bindir}"
43 install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}"
44}
45
46do_install:append:class-nativesdk() {
47 # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling
48 # and running binaries with commands like `cargo run` and `cargo test`". Sadly it
49 # sets to libdir but not base_libdir leading to symbol mismatches depending on the
50 # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this.
51 create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir}
52
53 ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
54 mkdir "${ENV_SETUP_DIR}"
55 CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
56
57 cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
58 # Keep the below off as long as HTTP/2 is disabled.
59 export CARGO_HTTP_MULTIPLEXING=false
60
61 export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt"
62 EOF
63}
64
65FILES:${PN} += "${base_prefix}/environment-setup.d"
66
67# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1)
68# as shipped by Yocto Dunfell.
69# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between
70# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off.
71#export LIBGIT2_SYS_USE_PKG_CONFIG = "1"
72
73# Needed for pkg-config to be used
74export LIBSSH2_SYS_USE_PKG_CONFIG = "1"
75
76# When building cargo-native we don't have cargo-native to use and depend on,
77# so we must use the locally set up snapshot to bootstrap the build.
78BASEDEPENDS:remove:class-native = "cargo-native"
79CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
80
81DEPENDS:append:class-nativesdk = " nativesdk-rust"
82RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib"
83RUSTLIB_DEP:class-nativesdk = ""
84
85BBCLASSEXTEND = "native nativesdk"