diff options
| author | Alex Kiernan <alex.kiernan@gmail.com> | 2022-12-28 15:23:29 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-28 23:59:56 +0000 |
| commit | fd552bfcfaa5c339c8ffe7c21d73d2b12c7b3393 (patch) | |
| tree | b61f657620db83da89170997329100ef5eb3c99c | |
| parent | 4323ddb8a139874de77cd39399562168a7e4088f (diff) | |
| download | poky-fd552bfcfaa5c339c8ffe7c21d73d2b12c7b3393.tar.gz | |
cargo: Merge .inc into .bb
(From OE-Core rev: 15170dbc0579f57436730b1fc1c2f471aa0dea54)
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo.inc | 69 | ||||
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo_1.66.0.bb | 71 |
2 files changed, 69 insertions, 71 deletions
diff --git a/meta/recipes-devtools/cargo/cargo.inc b/meta/recipes-devtools/cargo/cargo.inc deleted file mode 100644 index 40421df4f7..0000000000 --- a/meta/recipes-devtools/cargo/cargo.inc +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | SUMMARY ?= "Cargo, a package manager for Rust." | ||
| 2 | HOMEPAGE = "https://crates.io" | ||
| 3 | LICENSE = "MIT | Apache-2.0" | ||
| 4 | SECTION = "devel" | ||
| 5 | |||
| 6 | DEPENDS = "openssl zlib curl ca-certificates libssh2" | ||
| 7 | |||
| 8 | LIC_FILES_CHKSUM = " \ | ||
| 9 | file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ | ||
| 10 | file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ | ||
| 11 | file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ | ||
| 12 | " | ||
| 13 | |||
| 14 | |||
| 15 | S = "${RUSTSRC}/src/tools/cargo" | ||
| 16 | CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" | ||
| 17 | EXCLUDE_FROM_WORLD = "1" | ||
| 18 | |||
| 19 | inherit cargo pkgconfig | ||
| 20 | |||
| 21 | do_cargo_setup_snapshot () { | ||
| 22 | ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig | ||
| 23 | # Need to use uninative's loader if enabled/present since the library paths | ||
| 24 | # are used internally by rust and result in symbol mismatches if we don't | ||
| 25 | if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then | ||
| 26 | patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} | ||
| 27 | fi | ||
| 28 | } | ||
| 29 | |||
| 30 | addtask cargo_setup_snapshot after do_unpack before do_configure | ||
| 31 | do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" | ||
| 32 | do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" | ||
| 33 | |||
| 34 | |||
| 35 | do_compile:prepend () { | ||
| 36 | export RUSTC_BOOTSTRAP="1" | ||
| 37 | } | ||
| 38 | |||
| 39 | do_install () { | ||
| 40 | install -d "${D}${bindir}" | ||
| 41 | install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" | ||
| 42 | } | ||
| 43 | |||
| 44 | do_install:append:class-nativesdk() { | ||
| 45 | # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling | ||
| 46 | # and running binaries with commands like `cargo run` and `cargo test`". Sadly it | ||
| 47 | # sets to libdir but not base_libdir leading to symbol mismatches depending on the | ||
| 48 | # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. | ||
| 49 | create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} | ||
| 50 | } | ||
| 51 | |||
| 52 | # Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) | ||
| 53 | # as shipped by Yocto Dunfell. | ||
| 54 | # According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between | ||
| 55 | # libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. | ||
| 56 | #export LIBGIT2_SYS_USE_PKG_CONFIG = "1" | ||
| 57 | |||
| 58 | # Needed for pkg-config to be used | ||
| 59 | export LIBSSH2_SYS_USE_PKG_CONFIG = "1" | ||
| 60 | |||
| 61 | # When building cargo-native we don't have cargo-native to use and depend on, | ||
| 62 | # so we must use the locally set up snapshot to bootstrap the build. | ||
| 63 | BASEDEPENDS:remove:class-native = "cargo-native" | ||
| 64 | CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" | ||
| 65 | |||
| 66 | DEPENDS:append:class-nativesdk = " nativesdk-rust" | ||
| 67 | RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" | ||
| 68 | |||
| 69 | |||
diff --git a/meta/recipes-devtools/cargo/cargo_1.66.0.bb b/meta/recipes-devtools/cargo/cargo_1.66.0.bb index 5c8527708c..6c167c0c5f 100644 --- a/meta/recipes-devtools/cargo/cargo_1.66.0.bb +++ b/meta/recipes-devtools/cargo/cargo_1.66.0.bb | |||
| @@ -1,5 +1,72 @@ | |||
| 1 | SUMMARY ?= "Cargo, a package manager for Rust." | ||
| 2 | HOMEPAGE = "https://crates.io" | ||
| 3 | LICENSE = "MIT | Apache-2.0" | ||
| 4 | SECTION = "devel" | ||
| 5 | |||
| 6 | DEPENDS = "openssl zlib curl ca-certificates libssh2" | ||
| 7 | |||
| 8 | LIC_FILES_CHKSUM = " \ | ||
| 9 | file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ | ||
| 10 | file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ | ||
| 11 | file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ | ||
| 12 | " | ||
| 13 | |||
| 1 | require recipes-devtools/rust/rust-source.inc | 14 | require recipes-devtools/rust/rust-source.inc |
| 2 | require recipes-devtools/rust/rust-snapshot.inc | 15 | require recipes-devtools/rust/rust-snapshot.inc |
| 3 | require cargo.inc | 16 | |
| 17 | S = "${RUSTSRC}/src/tools/cargo" | ||
| 18 | CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" | ||
| 19 | EXCLUDE_FROM_WORLD = "1" | ||
| 20 | |||
| 21 | inherit cargo pkgconfig | ||
| 22 | |||
| 23 | do_cargo_setup_snapshot () { | ||
| 24 | ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig | ||
| 25 | # Need to use uninative's loader if enabled/present since the library paths | ||
| 26 | # are used internally by rust and result in symbol mismatches if we don't | ||
| 27 | if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then | ||
| 28 | patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} | ||
| 29 | fi | ||
| 30 | } | ||
| 31 | |||
| 32 | addtask cargo_setup_snapshot after do_unpack before do_configure | ||
| 33 | do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" | ||
| 34 | do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" | ||
| 35 | |||
| 36 | |||
| 37 | do_compile:prepend () { | ||
| 38 | export RUSTC_BOOTSTRAP="1" | ||
| 39 | } | ||
| 40 | |||
| 41 | do_install () { | ||
| 42 | install -d "${D}${bindir}" | ||
| 43 | install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" | ||
| 44 | } | ||
| 45 | |||
| 46 | do_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 | |||
| 54 | # Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) | ||
| 55 | # as shipped by Yocto Dunfell. | ||
| 56 | # According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between | ||
| 57 | # libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. | ||
| 58 | #export LIBGIT2_SYS_USE_PKG_CONFIG = "1" | ||
| 59 | |||
| 60 | # Needed for pkg-config to be used | ||
| 61 | export LIBSSH2_SYS_USE_PKG_CONFIG = "1" | ||
| 62 | |||
| 63 | # When building cargo-native we don't have cargo-native to use and depend on, | ||
| 64 | # so we must use the locally set up snapshot to bootstrap the build. | ||
| 65 | BASEDEPENDS:remove:class-native = "cargo-native" | ||
| 66 | CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" | ||
| 67 | |||
| 68 | DEPENDS:append:class-nativesdk = " nativesdk-rust" | ||
| 69 | RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" | ||
| 70 | RUSTLIB_DEP:class-nativesdk = "" | ||
| 71 | |||
| 4 | BBCLASSEXTEND = "native nativesdk" | 72 | BBCLASSEXTEND = "native nativesdk" |
| 5 | RUSTLIB_DEP:class-nativesdk = "" \ No newline at end of file | ||
