commit:     56f43886482ca23b91b6fd4f8738dd4e035f003b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 23 20:22:18 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Nov 23 20:22:18 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=56f43886

scripts/bootstrap-prefix: normalise DARWIN_USE_GCC codepath somewhat

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

 scripts/bootstrap-prefix.sh        | 68 +++++++++++++++++++++-----------------
 sys-devel/gcc/gcc-10.1.0-r1.ebuild |  2 +-
 2 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 458d18cc55..9ad307e1cd 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -180,8 +180,8 @@ configure_toolchain() {
        CXX=g++
 
        case ${CHOST}:${DARWIN_USE_GCC} in
-               powerpc-*darwin*|*:yes|*:1|*:true)
-                       einfo "Triggering Darwin with GCC toolchain path"
+               powerpc-*darwin*|*:1)
+                       einfo "Triggering Darwin with GCC toolchain"
                        compiler_stage1+=" sys-apps/darwin-miscutils 
sys-libs/csu"
                        local ccvers="$( (unset CHOST; gcc --version 
2>/dev/null) )"
                        case "${ccvers}" in
@@ -197,7 +197,9 @@ configure_toolchain() {
                                        ;;
                                *"(Gentoo "*)
                                        # probably the result of a bootstrap in 
progress
-                                       linker=sys-devel/binutils-apple
+                                       [[ ${DARWIN_USE_GCC} == 1 ]] \
+                                               && 
linker=sys-devel/native-cctools \
+                                               || 
linker=sys-devel/binutils-apple
                                        ;;
                                *"Apple clang version "*|*"Apple LLVM version 
"*)
                                        # gcc cannot build (recent) 
binutils-apple due to
@@ -213,7 +215,7 @@ configure_toolchain() {
                        compiler_stage1+=" sys-devel/gcc"
                        ;;
                *-darwin*)
-                       einfo "Triggering Darwin with Clang toolchain path"
+                       einfo "Triggering Darwin with LLVM/Clang toolchain"
                        # for compilers choice, see bug:
                        # https://bugs.gentoo.org/show_bug.cgi?id=538366
                        compiler_stage1="sys-apps/darwin-miscutils sys-libs/csu"
@@ -418,15 +420,16 @@ bootstrap_setup() {
                        rev=${CHOST##*darwin}
                        profile="prefix/darwin/macos/10.$((rev - 4))/x86"
                        ;;
+               x86_64-apple-darwin9|x86_64-apple-darwin1[012345678])
+                       rev=${CHOST##*darwin}
+                       profile="prefix/darwin/macos/10.$((rev - 4))/x64"
+                       ;;
                x86_64-apple-darwin19|x86_64-apple-darwin2[0123456789])
+                       # TODO: add profiles for these
                        # handle newer releases on the last profile we have 
headers
                        # and stuff for (https://opensource.apple.com/)
                        profile="prefix/darwin/macos/10.14/x64"
                        ;;
-               x86_64-apple-darwin9|x86_64-apple-darwin1[012345678])
-                       rev=${CHOST##*darwin}
-                       profile="prefix/darwin/macos/10.$((rev - 4))/x64"
-                       ;;
                i*86-pc-linux-gnu)
                        profile=${profile_linux/ARCH/x86}
                        ;;
@@ -500,6 +503,18 @@ bootstrap_setup() {
                        exit 1
                        ;;
        esac
+
+       if [[ ${DARWIN_USE_GCC} == 1 ]] ; then
+               # setup MacOSX.sdk symlink for GCC, this should probably be
+               # managed using an eselect module in the future
+               ( cd ${ROOT} && ln -s $(xcrun --show-sdk-path --sdk macosx) )
+               einfo "using system sources from $(\
+                       xcrun --show-sdk-version --sdk macosx)"
+
+               # amend profile, to use gcc one
+               profile="${profile}/gcc"
+       fi
+
        [[ -n ${PROFILE_BASE}${PROFILE_VARIANT} ]] &&
        
profile=${PROFILE_BASE:-prefix}/${profile#prefix/}${PROFILE_VARIANT:+/${PROFILE_VARIANT}}
        if [[ -n ${profile} && ! -e ${ROOT}/etc/portage/make.profile ]] ; then
@@ -509,16 +524,6 @@ bootstrap_setup() {
                einfo "Your profile is set to ${fullprofile}."
        fi
 
-       case ${DARWIN_USE_GCC} in
-               yes|1|true)
-                       # setup MacOSX.sdk symlink for GCC, this should 
probably be
-                       # managed using an eselect module in the future
-                       ( cd ${ROOT} && ln -s $(xcrun --show-sdk-path --sdk 
macosx) )
-                       einfo "using system sources from $(\
-                               xcrun --show-sdk-version --sdk macosx)"
-                       ;;
-       esac
-
        is-rap && cat >> "${ROOT}"/etc/portage/make.profile/make.defaults 
<<-'EOF'
        # For baselayout-prefix in stage2 only.
        ACCEPT_KEYWORDS="~${ARCH}-linux"
@@ -1731,19 +1736,7 @@ bootstrap_stage2() {
                >> "${ROOT}"/tmp/etc/portage/package.mask
 
        # unlock GCC on Darwin for DARWIN_USE_GCC bootstraps
-       if [[ ${DARWIN_USE_GCC} == 1 || ${DARWIN_USE_GCC} == "yes" || \
-               ${DARWIN_USE_GCC} == "true" ]]
-       then
-               {
-                       echo "# DARWIN_USE_GCC block"
-                       echo "sys-devel/gcc"
-                       echo "sys-devel/native-cctools"
-               } >> "${ROOT}"/tmp/etc/portage/package.unmask
-               {
-                       echo "# DARWIN_USE_GCC block"
-                       echo "sys-devel/gcc ~ppc-macos"
-               } >> "${ROOT}"/tmp/etc/portage/package.accept_keywords
-
+       if [[ ${DARWIN_USE_GCC} == 1 ]] ; then
                rm -f "${ROOT}"/tmp/MacOSX.sdk
                ( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk )
        fi
@@ -3088,6 +3081,19 @@ case ${CHOST} in
        ;;
 esac
 
+# handle GCC install path on recent Darwin
+case ${CHOST} in
+       *-darwin*)
+               # normalise value of DARWIN_USE_GCC
+               case ${DARWIN_USE_GCC} in
+                       yes|true|1)  DARWIN_USE_GCC=1  ;;
+               esac
+               ;;
+       *)
+               unset DARWIN_USE_GCC
+               ;;
+esac
+
 # deal with a problem on OSX with Python's locales
 case ${CHOST}:${LC_ALL}:${LANG} in
        *-darwin*:UTF-8:*|*-darwin*:*:UTF-8)

diff --git a/sys-devel/gcc/gcc-10.1.0-r1.ebuild 
b/sys-devel/gcc/gcc-10.1.0-r1.ebuild
index 8b2a273da8..9e0664ca00 100644
--- a/sys-devel/gcc/gcc-10.1.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-10.1.0-r1.ebuild
@@ -12,7 +12,7 @@ KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~sparc-solar
 RDEPEND=""
 BDEPEND="
        kernel_linux? ( ${CATEGORY}/binutils )
-       kernel_Darwin? ( ${CATEGORY}/binutils-apple )
+       kernel_Darwin? ( ${CATEGORY}/binutils-apple || 
${CATEGORY}/native-cctools )
        kernel_AIX? ( ${CATEGORY}/native-cctools )"
 
 src_prepare() {

Reply via email to