diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-11-07 13:31:53 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-11-07 13:31:53 +0000 |
| commit | 8c22ff0d8b70d9b12f0487ef696a7e915b9e3173 (patch) | |
| tree | efdc32587159d0050a69009bdf2330a531727d95 /meta/classes-recipe/cargo.bbclass | |
| parent | d412d2747595c1cc4a5e3ca975e3adc31b2f7891 (diff) | |
| download | poky-8c22ff0d8b70d9b12f0487ef696a7e915b9e3173.tar.gz | |
The poky repository master branch is no longer being updated.
You can either:
a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs
b) use the new bitbake-setup
You can find information about either approach in our documentation:
https://docs.yoctoproject.org/
Note that "poky" the distro setting is still available in meta-yocto as
before and we continue to use and maintain that.
Long live Poky!
Some further information on the background of this change can be found
in: https://lists.openembedded.org/g/openembedded-architecture/message/2179
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/cargo.bbclass')
| -rw-r--r-- | meta/classes-recipe/cargo.bbclass | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass deleted file mode 100644 index 2dd28e95d3..0000000000 --- a/meta/classes-recipe/cargo.bbclass +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | ## | ||
| 8 | ## Purpose: | ||
| 9 | ## This class is used by any recipes that are built using | ||
| 10 | ## Cargo. | ||
| 11 | |||
| 12 | inherit cargo_common | ||
| 13 | inherit rust-target-config | ||
| 14 | |||
| 15 | # the binary we will use | ||
| 16 | CARGO = "cargo" | ||
| 17 | |||
| 18 | # We need cargo to compile for the target | ||
| 19 | BASEDEPENDS:append = " cargo-native" | ||
| 20 | |||
| 21 | # Ensure we get the right rust variant | ||
| 22 | DEPENDS:append:class-target = " rust-native ${RUSTLIB_DEP}" | ||
| 23 | DEPENDS:append:class-nativesdk = " rust-native ${RUSTLIB_DEP}" | ||
| 24 | DEPENDS:append:class-native = " rust-native" | ||
| 25 | |||
| 26 | # Enable build separation | ||
| 27 | B = "${WORKDIR}/build" | ||
| 28 | |||
| 29 | # In case something fails in the build process, give a bit more feedback on | ||
| 30 | # where the issue occured | ||
| 31 | export RUST_BACKTRACE = "1" | ||
| 32 | |||
| 33 | RUSTFLAGS ??= "" | ||
| 34 | BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}" | ||
| 35 | # --frozen flag will prevent network access (which is required since only | ||
| 36 | # the do_fetch step is authorized to access network) | ||
| 37 | # and will require an up to date Cargo.lock file. | ||
| 38 | # This force the package being built to already ship a Cargo.lock, in the end | ||
| 39 | # this is what we want, at least, for reproducibility of the build. | ||
| 40 | CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${CARGO_MANIFEST_PATH}" | ||
| 41 | |||
| 42 | # This is based on the content of CARGO_BUILD_FLAGS and generally will need to | ||
| 43 | # change if CARGO_BUILD_FLAGS changes. | ||
| 44 | BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}" | ||
| 45 | CARGO_TARGET_SUBDIR = "${RUST_HOST_SYS}/${BUILD_DIR}" | ||
| 46 | oe_cargo_build () { | ||
| 47 | export RUSTFLAGS="${RUSTFLAGS}" | ||
| 48 | bbnote "Using rust targets from ${RUST_TARGET_PATH}" | ||
| 49 | bbnote "cargo = $(which ${CARGO})" | ||
| 50 | bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} ${PACKAGECONFIG_CONFARGS} $@" | ||
| 51 | "${CARGO}" build ${CARGO_BUILD_FLAGS} ${PACKAGECONFIG_CONFARGS} "$@" | ||
| 52 | } | ||
| 53 | |||
| 54 | do_compile[progress] = "outof:\s+(\d+)/(\d+)" | ||
| 55 | cargo_do_compile () { | ||
| 56 | oe_cargo_build | ||
| 57 | } | ||
| 58 | |||
| 59 | cargo_do_install () { | ||
| 60 | local have_installed=false | ||
| 61 | for tgt in "${B}/target/${CARGO_TARGET_SUBDIR}/"*; do | ||
| 62 | case $tgt in | ||
| 63 | *.so|*.rlib) | ||
| 64 | if [ -n "${CARGO_INSTALL_LIBRARIES}" ]; then | ||
| 65 | install -d "${D}${rustlibdir}" | ||
| 66 | install -m755 "$tgt" "${D}${rustlibdir}" | ||
| 67 | have_installed=true | ||
| 68 | fi | ||
| 69 | ;; | ||
| 70 | *examples) | ||
| 71 | if [ -d "$tgt" ]; then | ||
| 72 | for example in "$tgt/"*; do | ||
| 73 | if [ -f "$example" ] && [ -x "$example" ]; then | ||
| 74 | install -d "${D}${bindir}" | ||
| 75 | install -m755 "$example" "${D}${bindir}" | ||
| 76 | have_installed=true | ||
| 77 | fi | ||
| 78 | done | ||
| 79 | fi | ||
| 80 | ;; | ||
| 81 | *) | ||
| 82 | if [ -f "$tgt" ] && [ -x "$tgt" ]; then | ||
| 83 | install -d "${D}${bindir}" | ||
| 84 | install -m755 "$tgt" "${D}${bindir}" | ||
| 85 | have_installed=true | ||
| 86 | fi | ||
| 87 | ;; | ||
| 88 | esac | ||
| 89 | done | ||
| 90 | if ! $have_installed; then | ||
| 91 | die "Did not find anything to install" | ||
| 92 | fi | ||
| 93 | } | ||
| 94 | |||
| 95 | EXPORT_FUNCTIONS do_compile do_install | ||
