From c9d9b67368d168ebad11dfb6f39ff1c8409bcd82 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Mon, 17 Nov 2014 01:39:39 -0500 Subject: [PATCH] sysroot specification --- classes/internal-rust-cross.bbclass | 7 ++++--- classes/rust.bbclass | 6 ++++-- recipes/rust/rust.inc | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/classes/internal-rust-cross.bbclass b/classes/internal-rust-cross.bbclass index 6fe1923..e26f55e 100644 --- a/classes/internal-rust-cross.bbclass +++ b/classes/internal-rust-cross.bbclass @@ -7,14 +7,15 @@ DEPENDS += "virtual/${TARGET_PREFIX}gcc rust-native" PROVIDES = "virtual/${TARGET_PREFIX}rust" PN = "rust-cross-${TARGET_ARCH}" +# The same value as ${TOOLCHAIN_OPTIONS}. We can't use that variable directly +# here because cross.bblcass is "helpful" and blanks it out. +PRE_LINK_ARGS_PREPEND = "--sysroot=${STAGING_DIR_TARGET}" + ## gcc-cross settings # INHIBIT_DEFAULT_DEPS = "1" # INHIBIT_PACKAGE_STRIP = "1" # ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_NATIVE}${target_includedir}" -# TODO: use rust-native instead of a snapshot -EXTRA_OECONF += "" - # cross.bbclass is "helpful" and overrides our do_install. Tell it not to. do_install () { rust_do_install diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 5955d64..0eecae4 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -59,7 +59,9 @@ RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" # FIXME: the 'rustlib' element of this is to workaround rustc forgetting the libdir it was built with. -RUST_PATH_NATIVE="${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}:${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib" +RUST_PATH_NATIVE="${STAGING_LIBDIR_NATIVE}:\ +${STAGING_BASE_LIBDIR_NATIVE}:\ +${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib" # FIXME: set based on whether we are native vs cross vs buildsdk, etc export RUST_PATH ??= "${RUST_PATH_NATIVE}" @@ -107,7 +109,7 @@ oe_runcargo_build () { # FIXME: if there is already an entry for this target, in an existing # cargo/config, this won't work. which cargo - which rust + which rustc bbnote ${CARGO} build --target ${TARGET_SYS} "$@" oe_cargo_config "${CARGO}" build -v --target "${TARGET_SYS}" --release "$@" diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index d81fbbe..67d4e39 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -113,6 +113,7 @@ def rust_gen_target(d, thing, wd): features = d.getVarFlag('FEATURES', arch, True) or "" pre_link_args = (d.getVarFlag('PRE_LINK_ARGS', arch, True) or "").split() + pre_link_args.extend((d.getVar('PRE_LINK_ARGS_PREPEND', True) or "").split()) o.write('''{{ "data-layout": "{}",