diff --git a/README.md b/README.md index 2db0c54..d0f2a98 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,10 @@ SUMMARY = "GPIO Utilities" HOMEPAGE = "git://github.com/rust-embedded/gpio-utils" LICENSE = "MIT" -inherit cargo +inherit cargo_bin + +# Enable network for the compile task allowing cargo to download dependencies +do_compile[network] = "1" SRC_URI = "git://github.com/rust-embedded/gpio-utils.git;protocol=https;branch=master" SRCREV="02b0658cd7e13e46f6b1a5de3fd9655711749759" @@ -40,10 +43,14 @@ S = "${WORKDIR}/git" LIC_FILES_CHKSUM = "file://LICENSE-MIT;md5=935a9b2a57ae70704d8125b9c0e39059" ``` -As you can see, there is almost no overhead introduced from the `cargo` class -beyond simply inheriting it. The `cargo` class adds the appropriate Rust +As you can see, there is almost no overhead introduced from the `cargo_bin` class +beyond simply inheriting it. The `cargo_bin` class adds the appropriate Rust dependencies as well as default compile and install steps. +> **Warning** +> In previous versions of `meta-rust-bin` the class `cargo` was used instead +> of `cargo_bin`. Follow this [guide](#updating-from-an-old-meta-rust-bin) if you +> are updating your `meta-rust-bin` layer from an old version. ## Features @@ -79,12 +86,15 @@ downloads dependencies, so add the following line to the recipe: do_compile[network] = "1" ``` -### Use with Yocto Release 3.4 (honister) and Above +### Updating from an old `meta-rust-bin` + +To avoid conflicts with the offical Rust layer of Yocto, the class `cargo` of +`meta-rust-bin` was renamed to `cargo_bin`. + +If you are updating `meta-rust-bin` from an old version please make sure to +update the inherited class of your recipe to `cargo_bin`. -Rust is included directly in `openmbedded-core` as of Yocto version 3.4. The -included recipe builds Rust components from the sources. To use binaries from -the `meta-rust-bin` layer instead, set `BBMASK` to exclude the package in your -configuration: +After the update it's safe to remove the previously used `BBMASK`: ```bitbake BBMASK = "poky/meta/recipes-devtools/rust" diff --git a/classes/cargo.bbclass b/classes/cargo_bin.bbclass similarity index 98% rename from classes/cargo.bbclass rename to classes/cargo_bin.bbclass index 84229d1..c1c341c 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo_bin.bbclass @@ -1,4 +1,4 @@ -inherit rust-common +inherit rust_bin-common # Many crates rely on pkg-config to find native versions of their libraries for # linking - do the simple thing and make it generally available. @@ -75,7 +75,7 @@ create_cargo_config() { echo "debug = true" >> ${CARGO_HOME}/config } -cargo_do_configure() { +cargo_bin_do_configure() { mkdir -p "${B}" mkdir -p "${CARGO_HOME}" mkdir -p "${WRAPPER_DIR}" @@ -111,7 +111,7 @@ cargo_do_configure() { create_cargo_config } -cargo_do_compile() { +cargo_bin_do_compile() { export TARGET_CC="${WRAPPER_DIR}/cc-wrapper.sh" export TARGET_CXX="${WRAPPER_DIR}/cxx-wrapper.sh" export CC="${WRAPPER_DIR}/cc-native-wrapper.sh" @@ -130,7 +130,7 @@ cargo_do_compile() { cargo build ${CARGO_BUILD_FLAGS} } -cargo_do_install() { +cargo_bin_do_install() { if [ "${CARGO_BUILD_TYPE}" = "--release" ]; then local cargo_bindir="${CARGO_RELEASE_DIR}" else diff --git a/classes/rust-common.bbclass b/classes/rust_bin-common.bbclass similarity index 100% rename from classes/rust-common.bbclass rename to classes/rust_bin-common.bbclass diff --git a/conf/layer.conf b/conf/layer.conf index d91b233..572e55d 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -16,4 +16,5 @@ LAYERSERIES_COMPAT_rust-bin-layer = " \ hardknott \ honister \ kirkstone \ + langdale \ " diff --git a/recipes-devtools/rust/cargo-bin-cross.inc b/recipes-devtools/rust/cargo-bin-cross.inc index 83b22f3..7f35dc6 100644 --- a/recipes-devtools/rust/cargo-bin-cross.inc +++ b/recipes-devtools/rust/cargo-bin-cross.inc @@ -4,7 +4,7 @@ LICENSE = "Apache-2.0 | MIT" SECTION = "devel" inherit cross -inherit rust-common +inherit rust_bin-common PN = "cargo-bin-cross-${TARGET_ARCH}" diff --git a/recipes-devtools/rust/rust-bin-cross.inc b/recipes-devtools/rust/rust-bin-cross.inc index bdbbb6e..b8c21c3 100644 --- a/recipes-devtools/rust/rust-bin-cross.inc +++ b/recipes-devtools/rust/rust-bin-cross.inc @@ -4,7 +4,7 @@ LICENSE = "Apache-2.0 | MIT" SECTION = "devel" inherit cross -inherit rust-common +inherit rust_bin-common # Required to link binaries DEPENDS += "gcc-cross-${TARGET_ARCH}"