diff --git a/classes/rust.bbclass b/classes/rust.bbclass index dce8074..b5d2ba0 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -6,7 +6,6 @@ RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath" def rust_base_dep(d): # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to # use rust instead of gcc - deps = "" if not d.getVar('INHIBIT_DEFAULT_DEPS'): if (d.getVar('HOST_SYS', True) != d.getVar('BUILD_SYS', True)): @@ -57,17 +56,17 @@ RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" # -L${STAGING_BASE_LIBDIR_NATIVE} \ #" +RUST_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}" -# 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" +## Note: the 'rustlib' element of this was a workaround rustc forgetting the +## libdir it was built with. It now remembers so this should be unneeded +#RUST_PATH_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}" -# FIXME: set this to something (sysroot?) for each of target,native,cross -# For now, tuned so target builds are correct. -native happens to work because -# the target specs happen to match. -export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rust/targets:${STAGING_LIBDIR_NATIVE}/rust/targets" +## This is builtin to rustc with the value "$libdir/rust/targets" +# RUST_TARGET_PATH = "foo:bar" CARGO = "cargo" diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index 64131d7..9e6c20d 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -15,6 +15,7 @@ LIC_FILES_CHKSUM ="\ # For -native, we set this to "0" by default. USE_LOCAL_RUST = "1" +# We generate local targets, and need to be able to locate them export RUST_TARGET_PATH="${WORKDIR}/targets/" ## arm-unknown-linux-gnueabihf @@ -226,10 +227,17 @@ do_configure () { unset CXXFLAGS unset CPPFLAGS - # rpath is required otherwise rustc fails to resolve symbols + if [ "${USE_LOCAL_RUST}" -eq 1 ]; then + # FIXME: this path to rustc may not be quite right in the case + # where we're reinstalling the compiler. May want to try for a real + # path based on bitbake vars + my_conf="--enable-local-rust --local-rust-root=$(dirname $(which rustc))" + else + my_conf="" + fi - # TODO: consider setting --local-rust-root for -cross and -target - # builds. + # - rpath is required otherwise rustc fails to resolve symbols + # - submodule management is done by bitbake's fetching ${S}/configure \ "--enable-rpath" \ "--disable-verify-install" \ @@ -245,7 +253,7 @@ do_configure () { "--libdir=${libdir}" \ "--bindir=${bindir}" \ "--disable-manage-submodules" \ - ${@base_conditional('USE_LOCAL_RUST', '1', '--enable-local-rust', '', d)} \ + ${my_conf} \ ${EXTRA_OECONF} } @@ -289,7 +297,7 @@ do_install () { ## We abuse the BBCLASSEXTEND system to avoid creating multiple .bb for every ## rust version (which is what gcc does). -## +## ## Right now 'target' doesn't need any special settings, but at some point we may need to: ## - add an internal-rust-target ## - set the PN of this package to something like "rust-internal" or otherwise