commit:     ae290517d47b26295c46a1bca0fbdcfdee5bb1a8
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 12 08:44:29 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Feb 12 08:44:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae290517

scripts/bootstrap-prefix: unbreak arm64-macos bootstrap

Trim down the guessing and more in configure_toolchain.

Problem is that configure_toolchain is called in all three stages, and
its output is used.  Since we need to bootstrap a compiler very early,
we need to rely on PATH for a compiler, which means in stage3 we always
pick up the stage2 emerged compiler.  This changes the output of the
function due to a change in env.

Avoid this by simply hardwiring the exceptional case, which is already
hardwired before already.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 36 +++++++++++-------------------------
 1 file changed, 11 insertions(+), 25 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 9a65ccf4fc..86ec75ee9f 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -180,34 +180,20 @@ configure_toolchain() {
                        einfo "Triggering Darwin with GCC toolchain"
                        compiler_stage1+=" sys-apps/darwin-miscutils"
                        compiler_stage1+=" sys-devel/gcc"
-                       # recent binutils-apple are hard to build (C++11 
features,
-                       # and cmake build system) so avoid going there, the 
system
-                       # ld on machines with compiler that supports C11 is good
-                       # enough to bring us to stage3, after which the @system 
set
-                       # will take care of the rest
-                       linker="sys-devel/native-cctools"
 
-                       local ccvers="$(unset CHOST; ${CC} --version 
2>/dev/null)"
-                       case "${ccvers}" in
-                               *"(GCC) "[1-9]*|"gcc ("*") "[1-9]*)
-                                       local cvers="${ccvers#*)}"; 
cvers="${cvers%%.*}"
-                                       # GCC-5 has C11 see above
-                                       if [[ ${cvers} -ge 5 ]] ; then
-                                               : # ok! stage1 bootstrapped 
one, get us a linker too
-                                               
linker="=sys-devel/binutils-apple-3.2.6*"
-                                       else
-                                               # FIXME: should probably stage1 
bootstrap GCC-5
-                                               # or something
-                                               eerror "compiler ${ccvers} is 
too old: ${cvers} < 5"
-                                               eerror "you need a C11/C++11 
compiler to bootstrap"
-                                       fi
-                                       ;;
-                               *"Apple clang version "*|*"Apple LLVM version 
"*)
-                                       : # ok!
+                       # binutils-apple/xtools doesn't work (yet) on arm64.  
The
+                       # profiles will mask and keep using native-cctools for 
that,
+                       # otherwise stage3 and @system will take care of 
switching
+                       # to binutils-apple.
+                       # one problem: when we have a really old linker, we need
+                       # to use it sooner or else packages like libffi won't
+                       # compile.
+                       case ${CHOST} in
+                               *-darwin[89])
+                                       
linker="=sys-devel/binutils-apple-3.2.6*"
                                        ;;
                                *)
-                                       eerror "unknown compiler: ${ccvers}"
-                                       return 1
+                                       linker="sys-devel/native-cctools"
                                        ;;
                        esac
                        ;;

Reply via email to