summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Horodniceanu <a.horodniceanu@proton.me>2024-10-04 07:10:04 +0300
committerSam James <sam@gentoo.org>2024-10-07 05:12:41 +0100
commit434a6775ce93a15ef517478565a938aa73d1d528 (patch)
treede5a46b8d0a4c153a2f5e7f56a8d4a4c87636da3
parenttoolchain.eclass: also clear GDCFLAGS when cross-compiling (diff)
downloadgentoo-434a6775ce93a15ef517478565a938aa73d1d528.tar.gz
gentoo-434a6775ce93a15ef517478565a938aa73d1d528.tar.bz2
gentoo-434a6775ce93a15ef517478565a938aa73d1d528.zip
toolchain.eclass: Support cross GDC
While the D use flags is masked by crossdev the build used to work, on my limited number of machines, up until recently with the D code refactors. When building sys-devel/gcc or cross-${TARGET}/gcc natively the appropriate gdc compiler is installed under /usr/${CHOST}/gcc-bin and is provided by sys-devel/gcc[d]. When building sys-devel/gcc or cross-${CTARGET}/gcc for another system the appropriate gdc binary is under /usr/${CBUILD}/${CHOST}/gcc-bin and is provided by cross-${CHOST}/gcc[d]. Also use the full ${CHOST}-gdc executable names since plain gdc is only present on native builds. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me> Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--eclass/toolchain.eclass21
1 files changed, 15 insertions, 6 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 0d46d6f3a799..19357b4dfb2d 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1000,8 +1000,17 @@ toolchain_setup_ada() {
# Determine the most suitable GDC (D compiler) for bootstrapping
# and setup the environment for building.
toolchain_setup_d() {
- local latest_gcc=$(best_version -b "sys-devel/gcc")
- latest_gcc="${latest_gcc#sys-devel/gcc-}"
+ local gcc_pkg gcc_bin_base
+ if tc-is-cross-compiler ; then
+ gcc_pkg=cross-${CHOST}/gcc
+ gcc_bin_base=${BROOT}/usr/${CBUILD}/${CHOST}/gcc-bin
+ else
+ gcc_pkg=sys-devel/gcc
+ gcc_bin_base=${BROOT}/usr/${CHOST}/gcc-bin
+ fi
+
+ local latest_gcc=$(best_version -b "${gcc_pkg}")
+ latest_gcc="${latest_gcc#${gcc_pkg}-}"
latest_gcc=$(ver_cut 1 ${latest_gcc})
local d_bootstrap
@@ -1011,10 +1020,10 @@ toolchain_setup_d() {
# 2) Iterate downwards from the version being built;
# 3) Iterate upwards from the version being built to the greatest version installed.
for d_candidate in ${SLOT} $(seq $((${SLOT} - 1)) -1 10) $(seq $((${SLOT} + 1)) ${latest_gcc}) ; do
- has_version -b "sys-devel/gcc:${d_candidate}" || continue
+ has_version -b "${gcc_pkg}:${d_candidate}" || continue
- ebegin "Testing sys-devel/gcc:${d_candidate} for D"
- if has_version -b "sys-devel/gcc:${d_candidate}[d(-)]" ; then
+ ebegin "Testing ${gcc_pkg}:${d_candidate} for D"
+ if has_version -b "${gcc_pkg}:${d_candidate}[d(-)]" ; then
d_bootstrap=${d_candidate}
eend 0
@@ -1024,7 +1033,7 @@ toolchain_setup_d() {
done
if [[ -n ${d_bootstrap} ]] ; then
- export GDC="${BROOT}/usr/${CTARGET}/gcc-bin/${d_bootstrap}/gdc"
+ export GDC=${gcc_bin_base}/${d_bootstrap}/${CHOST}-gdc
fi
}