inherit rust CARGO ?= "cargo" export CARGO_HOME = "${WORKDIR}/cargo_home" def cargo_base_dep(d): deps = "" if not d.getVar('INHIBIT_DEFAULT_DEPS') and not d.getVar('INHIBIT_CARGO_DEP'): deps += " cargo-native" return deps BASEDEPENDS_append = " ${@cargo_base_dep(d)}" # FIXME: this is a workaround for a misbehavior in cargo when used with quilt. # See https://github.com/rust-lang/cargo/issues/978 PATCHTOOL = "patch" # 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 () { mkdir -p .cargo # FIXME: we currently blow away the entire config because duplicate # sections are treated as a parse error by cargo (causing the entire # config to be silently ignored. # 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 <