Standalone prefix has always configured gcc with a sysroot, but the
location of this sysroot is different at build time when
cross-compiling. gcc has a separate configure option for that.
prefix-guest systems do not have a sysroot applied, as they use the
host's libc.
Move this code from the prefix profile into the eclass so that it's less
of a special case. We can avoid relying on the `BOOTSTRAP_RAP_STAGE2`
variable by checking for the `prefix-guest` USE flag instead, as a
prefix-guest profile is now used for RAP stage 2.
Signed-off-by: James Le Cuirot <
chewi@gentoo.org>
---
eclass/toolchain.eclass | 15 +++++++++++++++
.../features/prefix/standalone/profile.bashrc | 3 ---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 0dd23d93e383..479814f0df3e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1200,6 +1200,21 @@ toolchain_src_configure() {
confgcc+=( --enable-threads=posix )
;;
esac
+
+ if ! use prefix-guest ; then
+ # GNU ld scripts, such as those in glibc, reference unprefixed paths
+ # as the sysroot given here is automatically prepended. For
+ # prefix-guest, we use the host's libc instead.
+ if [[ -n ${EPREFIX} ]] ; then
+ confgcc+=( --with-sysroot="${EPREFIX}" )
+ fi
+
+ # We need to build against the right headers and libraries. Again,
+ # for prefix-guest, this is the host's.
+ if [[ -n ${ESYSROOT} ]] ; then
+ confgcc+=( --with-build-sysroot="${ESYSROOT}" ) + fi
+ fi
fi