1 |
commit: 72925b1dccebbf082c31a2be89c7693d966ecd54 |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 26 22:32:02 2022 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 28 22:11:16 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72925b1d |
7 |
|
8 |
toolchain.eclass: Fix cross-compiling gcc for standalone prefix |
9 |
|
10 |
Standalone prefix has always configured gcc with a sysroot, but the |
11 |
location of this sysroot is different at build time when |
12 |
cross-compiling. gcc has a separate configure option for that. |
13 |
|
14 |
prefix-guest systems do not have a sysroot applied, as they use the |
15 |
host's libc. |
16 |
|
17 |
Move this code from the prefix profile into the eclass so that it's less |
18 |
of a special case. We can avoid relying on the `BOOTSTRAP_RAP_STAGE2` |
19 |
variable by checking for the `prefix-guest` USE flag instead, as a |
20 |
prefix-guest profile is now used for RAP stage 2. |
21 |
|
22 |
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> |
23 |
|
24 |
eclass/toolchain.eclass | 15 +++++++++++++++ |
25 |
profiles/features/prefix/standalone/profile.bashrc | 3 --- |
26 |
2 files changed, 15 insertions(+), 3 deletions(-) |
27 |
|
28 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
29 |
index 0dd23d93e383..479814f0df3e 100644 |
30 |
--- a/eclass/toolchain.eclass |
31 |
+++ b/eclass/toolchain.eclass |
32 |
@@ -1200,6 +1200,21 @@ toolchain_src_configure() { |
33 |
confgcc+=( --enable-threads=posix ) |
34 |
;; |
35 |
esac |
36 |
+ |
37 |
+ if ! use prefix-guest ; then |
38 |
+ # GNU ld scripts, such as those in glibc, reference unprefixed paths |
39 |
+ # as the sysroot given here is automatically prepended. For |
40 |
+ # prefix-guest, we use the host's libc instead. |
41 |
+ if [[ -n ${EPREFIX} ]] ; then |
42 |
+ confgcc+=( --with-sysroot="${EPREFIX}" ) |
43 |
+ fi |
44 |
+ |
45 |
+ # We need to build against the right headers and libraries. Again, |
46 |
+ # for prefix-guest, this is the host's. |
47 |
+ if [[ -n ${ESYSROOT} ]] ; then |
48 |
+ confgcc+=( --with-build-sysroot="${ESYSROOT}" ) |
49 |
+ fi |
50 |
+ fi |
51 |
fi |
52 |
|
53 |
# __cxa_atexit is "essential for fully standards-compliant handling of |
54 |
|
55 |
diff --git a/profiles/features/prefix/standalone/profile.bashrc b/profiles/features/prefix/standalone/profile.bashrc |
56 |
index 3cdda77b9a88..043f766c37e9 100644 |
57 |
--- a/profiles/features/prefix/standalone/profile.bashrc |
58 |
+++ b/profiles/features/prefix/standalone/profile.bashrc |
59 |
@@ -21,9 +21,6 @@ if [[ ${CATEGORY}/${PN} == sys-devel/gcc && ${EBUILD_PHASE} == configure ]]; the |
60 |
fi |
61 |
eend $? |
62 |
done |
63 |
- |
64 |
- # use sysroot of toolchain to get correct include and library at compile time |
65 |
- EXTRA_ECONF="${EXTRA_ECONF} --with-sysroot=${EPREFIX}" |
66 |
elif [[ ${CATEGORY}/${PN} == sys-devel/clang && ${EBUILD_PHASE} == configure ]]; then |
67 |
ebegin "Use ${EPREFIX} as default sysroot" |
68 |
sed -i -e "s@DEFAULT_SYSROOT \"\"@DEFAULT_SYSROOT \"${EPREFIX}\"@" "${S}"/CMakeLists.txt |