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.
This commit is contained in:
David Michael 2018-08-27 13:16:36 +00:00
parent 8a4fe09896
commit afff45366a
2 changed files with 9 additions and 4 deletions

View File

@ -19,17 +19,22 @@ configure_target_root() {
CBUILD="$(portageq envvar CBUILD)" \ CBUILD="$(portageq envvar CBUILD)" \
CHOST="${cross_chost}" \ CHOST="${cross_chost}" \
ROOT="/build/${board}" \ ROOT="/build/${board}" \
SYSROOT="/usr/${cross_chost}" \ SYSROOT="/build/${board}" \
_configure_sysroot "${profile}" _configure_sysroot "${profile}"
} }
build_target_toolchain() { build_target_toolchain() {
local board="$1" local board="$1"
local ROOT="/build/${board}" 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= # --root is required because run_merge overrides ROOT=
PORTAGE_CONFIGROOT="$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 configure_crossdev_overlay / /tmp/crossdev

View File

@ -257,7 +257,7 @@ _configure_sysroot() {
$sudo eselect profile set --force "$profile" $sudo eselect profile set --force "$profile"
$sudo tee "${ROOT}/etc/portage/make.conf" >/dev/null <<EOF $sudo tee "${ROOT}/etc/portage/make.conf" >/dev/null <<EOF
$(portageq envvar -v CHOST CBUILD ROOT SYSROOT \ $(portageq envvar -v CHOST CBUILD ROOT \
PORTDIR PORTDIR_OVERLAY DISTDIR PKGDIR) PORTDIR PORTDIR_OVERLAY DISTDIR PKGDIR)
HOSTCC=\${CBUILD}-gcc HOSTCC=\${CBUILD}-gcc
PKG_CONFIG_PATH="\${SYSROOT}/usr/lib/pkgconfig/" PKG_CONFIG_PATH="\${SYSROOT}/usr/lib/pkgconfig/"
@ -372,7 +372,7 @@ install_cross_libs() {
done | $sudo tee "${package_provided}/cross-${cross_chost}" >/dev/null done | $sudo tee "${package_provided}/cross-${cross_chost}" >/dev/null
# OK, clear as mud? Install those dependencies now! # 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 # Get the latest GCC profile for a given CHOST