From 1bf70b13a75daee1dff8730f3f67681c973ba746 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 28 Nov 2016 00:05:11 -0600 Subject: [PATCH] classes/cargo: revert to utilizing compiler/linker wrappers Don't supply the linker arguments via rustflags and then mangle with the RUSTFLAGS environment variable. This is also a parial reversion of 4e1bda643e and 5afc0cc471. These changes are reverted since it assumed people would build with cargo and not directly with rustc. ref #116. --- classes/cargo.bbclass | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 53fcec0..551c788 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -46,29 +46,18 @@ replace-with = "local" registry = "https://github.com/rust-lang/crates.io-index" EOF - # We need to use the real Yocto linker and get the linker - # flags to it. Yocto has the concept of BUILD and TARGET - # and uses HOST to be the currently selected one. However - # LDFLAGS and TOOLCHAIN_OPTIONS are not prefixed with HOST - echo "[build]" >> ${CARGO_HOME}/config - echo "rustflags = [" >> ${CARGO_HOME}/config - echo "'-C'," >> ${CARGO_HOME}/config - echo "'link-args=${LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}'," >> ${CARGO_HOME}/config - for p in ${RUSTFLAGS}; do - printf "'%s'\n" "$p" - done | sed -e 's/$/,/' >> ${CARGO_HOME}/config - echo "]" >> ${CARGO_HOME}/config echo "[target.${HOST_SYS}]" >> ${CARGO_HOME}/config echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config } +RUSTFLAGS ??= "" CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # This is based on the content of CARGO_BUILD_FLAGS and generally will need to # change if CARGO_BUILD_FLAGS changes. CARGO_TARGET_SUBDIR="${HOST_SYS}/release" oe_cargo_build () { - unset RUSTFLAGS + export RUSTFLAGS="${RUSTFLAGS}" bbnote "cargo = $(which cargo)" bbnote "rustc = $(which rustc)" bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"