commit:     10324f2bc1807469a6425e308c9564ed8513f2fe
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 30 12:27:02 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Dec 30 12:29:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=10324f2b

scripts/bootstrap-prefix: darwin-gcc: use gcc-10 with host gcc

GCC-11 needs C++11, which is at earliest in GCC-4.8, but if we bootstrap
from 4.2.1 (gcc-apple) we don't have this, so stick with GCC-10.  Avoid
upgrading immediately to 11 afterwards, because we'll recompile
everything lateron again.

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

 scripts/bootstrap-prefix.sh | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 70599da63a..233f606caf 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -190,9 +190,11 @@ configure_toolchain() {
                        einfo "Triggering Darwin with GCC toolchain"
                        compiler_stage1+=" sys-apps/darwin-miscutils"
                        local ccvers="$(unset CHOST; /usr/bin/gcc --version 
2>/dev/null)"
+                       local isgcc=
                        case "${ccvers}" in
                                *"(GCC) 4.2.1 "*)
                                        linker="=sys-devel/binutils-apple-3.2.6"
+                                       isgcc=true
                                        ;;
                                *"(GCC) 4.0.1 "*)
                                        linker="=sys-devel/binutils-apple-3.2.6"
@@ -200,6 +202,7 @@ configure_toolchain() {
                                        compiler_stage1+="
                                                sys-devel/gcc-apple
                                                =sys-devel/binutils-apple-3.2.6"
+                                       isgcc=true
                                        ;;
                                *"Apple clang version "*|*"Apple LLVM version 
"*)
                                        # recent binutils-apple are hard to 
build (C++11
@@ -214,9 +217,15 @@ configure_toolchain() {
                                        return 1
                                        ;;
                        esac
-                       # current compiler (gcc-11 requires C++11, which is
-                       # available since 4.8, so need to bootstrap with <11)
-                       compiler_stage1+=" <sys-devel/gcc-11"
+                       if [[ ${isgcc} == true ]] ; then
+                               # current compiler (gcc-11) requires C++11, 
which is
+                               # available since 4.8, so need to bootstrap 
with <11
+                               compiler_stage1+=" <sys-devel/gcc-11"
+                               compiler="${compiler%sys-devel/gcc} 
<sys-devel/gcc-11"
+                       else
+                               # assume LLVM/Clang has C++11 support
+                               compiler_stage1+=" sys-devel/gcc"
+                       fi
                        ;;
                *-darwin*)
                        einfo "Triggering Darwin with LLVM/Clang toolchain"

Reply via email to