inherit rust-vars # add crate fetch support inherit crate-fetch # the binary we will use CARGO = "cargo" # Where we download our registry and dependencies to export CARGO_HOME = "${WORKDIR}/cargo_home" # We need cargo to compile for the target BASEDEPENDS_append = " cargo-native" # Ensure we get the right rust variant DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}" DEPENDS_append_class-native = " rust-native" # Cargo only supports in-tree builds at the moment B = "${S}" # In case something fails in the build process, give a bit more feedback on # where the issue occured export RUST_BACKTRACE = "1" # The pkg-config-rs library used by cargo build scripts disables itself when # cross compiling unless this is defined. We set up pkg-config appropriately # for cross compilation, so tell it we know better than it. export PKG_CONFIG_ALLOW_CROSS = "1" cargo_do_configure () { mkdir -p ${CARGO_HOME} # NOTE: we cannot pass more flags via this interface, the 'linker' is # assumed to be a path to a binary. If flags are needed, a wrapper must # be used. echo "paths = [" > ${CARGO_HOME}/config for p in ${EXTRA_OECARGO_PATHS}; do printf "\"%s\"\n" "$p" done | sed -e 's/$/,/' >> ${CARGO_HOME}/config echo "]" >> ${CARGO_HOME}/config # Point cargo at our local mirror of the registry cat >> ${CARGO_HOME}/config <