From afff45366a5e4b524e6fee4bb335e9f76d5610d0 Mon Sep 17 00:00:00 2001 From: David Michael Date: Mon, 27 Aug 2018 13:16:36 +0000 Subject: [PATCH] build_toolchains: Update sysroot settings for newer portage Since EAPI=7 was supported, portage can no longer use different ROOT and SYSROOT values. This adjusts the paths so that the first phase builds cross-toolchains under /usr/${CHOST}, then the native toolchains are built under /build/${BOARD} (as was being done previously). Now that the cross-toolchain development files can't be used when building the native toolchain, the headers and libs are stupidly copied into the board root to be used used and then overwritten by the board packages as they are built. Since this is all done in a chroot, these changes shouldn't affect the SDK host. --- build_library/catalyst_toolchains.sh | 9 +++++++-- build_library/toolchain_util.sh | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build_library/catalyst_toolchains.sh b/build_library/catalyst_toolchains.sh index 07428f7350..2ab4c46dae 100644 --- a/build_library/catalyst_toolchains.sh +++ b/build_library/catalyst_toolchains.sh @@ -19,17 +19,22 @@ configure_target_root() { CBUILD="$(portageq envvar CBUILD)" \ CHOST="${cross_chost}" \ ROOT="/build/${board}" \ - SYSROOT="/usr/${cross_chost}" \ + SYSROOT="/build/${board}" \ _configure_sysroot "${profile}" } build_target_toolchain() { local board="$1" local ROOT="/build/${board}" + local SYSROOT="/usr/$(get_board_chost "${board}")" + + mkdir -p "${ROOT}/usr" + cp -at "${ROOT}" "${SYSROOT}"/lib* + cp -at "${ROOT}"/usr "${SYSROOT}"/usr/include "${SYSROOT}"/usr/lib* # --root is required because run_merge overrides ROOT= PORTAGE_CONFIGROOT="$ROOT" \ - run_merge -u --root="$ROOT" "${TOOLCHAIN_PKGS[@]}" + run_merge -u --root="$ROOT" --sysroot="$ROOT" "${TOOLCHAIN_PKGS[@]}" } configure_crossdev_overlay / /tmp/crossdev diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index d8649a12d1..53f829a4b4 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -257,7 +257,7 @@ _configure_sysroot() { $sudo eselect profile set --force "$profile" $sudo tee "${ROOT}/etc/portage/make.conf" >/dev/null </dev/null # OK, clear as mud? Install those dependencies now! - PORTAGE_CONFIGROOT="$ROOT" ROOT="$ROOT" $sudo emerge "$@" -u $cross_deps + PORTAGE_CONFIGROOT="$ROOT" $sudo emerge --root="$ROOT" --sysroot="$ROOT" "$@" -u $cross_deps } # Get the latest GCC profile for a given CHOST