public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "James Le Cuirot" <chewi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/features/prefix/standalone/, eclass/
Date: Sat, 28 Jan 2023 22:12:23 +0000 (UTC)	[thread overview]
Message-ID: <1674943876.72925b1dccebbf082c31a2be89c7693d966ecd54.chewi@gentoo> (raw)

commit:     72925b1dccebbf082c31a2be89c7693d966ecd54
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 22:32:02 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Jan 28 22:11:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72925b1d

toolchain.eclass: Fix cross-compiling gcc for standalone prefix

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 <AT> gentoo.org>

 eclass/toolchain.eclass                            | 15 +++++++++++++++
 profiles/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
 
 	# __cxa_atexit is "essential for fully standards-compliant handling of

diff --git a/profiles/features/prefix/standalone/profile.bashrc b/profiles/features/prefix/standalone/profile.bashrc
index 3cdda77b9a88..043f766c37e9 100644
--- a/profiles/features/prefix/standalone/profile.bashrc
+++ b/profiles/features/prefix/standalone/profile.bashrc
@@ -21,9 +21,6 @@ if [[ ${CATEGORY}/${PN} == sys-devel/gcc && ${EBUILD_PHASE} == configure ]]; the
 	fi
 	eend $?
     done
-
-    # use sysroot of toolchain to get correct include and library at compile time
-    EXTRA_ECONF="${EXTRA_ECONF} --with-sysroot=${EPREFIX}"
 elif [[ ${CATEGORY}/${PN} == sys-devel/clang && ${EBUILD_PHASE} == configure ]]; then
     ebegin "Use ${EPREFIX} as default sysroot"
     sed -i -e "s@DEFAULT_SYSROOT \"\"@DEFAULT_SYSROOT \"${EPREFIX}\"@" "${S}"/CMakeLists.txt


                 reply	other threads:[~2023-01-28 22:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1674943876.72925b1dccebbf082c31a2be89c7693d966ecd54.chewi@gentoo \
    --to=chewi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox