inherit rust CARGO ?= "cargo" export CARGO_HOME = "${WORKDIR}/cargo_home" def cargo_base_dep(d): deps = "" if not d.getVar('INHIBIT_DEFAULT_DEPS', True) and not d.getVar('INHIBIT_CARGO_DEP', True): deps += " cargo-native" return deps BASEDEPENDS_append = " ${@cargo_base_dep(d)}" # 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" EXTRA_OECARGO_PATHS ??= "" cargo_do_configure () { # FIXME: we currently make a mess in the directory above us # (${WORKDIR}), which may not be ideal. Look into whether this is # allowed mkdir -p ../.cargo # 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/config for p in ${EXTRA_OECARGO_PATHS}; do printf "\"%s\"\n" "$p" done | sed -e 's/$/,/' >>../.cargo/config echo "]" >>../.cargo/config } rust_cargo_patch () { # FIXME: if there is already an entry for this target, in an existing # cargo/config, this won't work. cd "${S}" cat >>Cargo.toml <