Skip to content

Commit

Permalink
scripts/bootstrap-prefix: be selective on where to use GCC-5 in stage1
Browse files Browse the repository at this point in the history
GCC-5 doesn't compile on ARM64, newer versions of macOS might also prove
to be capable of compiling GCC-14.

Signed-off-by: Fabian Groffen <[email protected]>
  • Loading branch information
grobian committed Jul 22, 2024
1 parent 636a653 commit a114199
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions scripts/bootstrap-prefix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ bootstrap_profile() {
profile="prefix/darwin/macos/10.$((rev - 4))/x64"
;;
*64-apple-darwin2[0123456789])
# Big Sur is 11.0
# Monterey is 12.0
# Ventura is 13.0
# Sanoma is 14.0
# Big Sur is 11.0 darwin20
# Monterey is 12.0 darwin21
# Ventura is 13.0 darwin22
# Sanoma is 14.0 darwin23
rev=${CHOST##*darwin}
case ${CHOST%%-*} in
x86_64) arch=x64 ;;
Expand Down Expand Up @@ -1483,11 +1483,9 @@ bootstrap_stage1() {
configure_toolchain
export CC CXX

# GCC 14 cannot be compiled by versions of Clang at least on
# Darwin17, so go the safe route and get GCC-5 which is sufficient
# and the last one we can compile without C11. This also compiles
# on Darwin 8 and 9.
# see also configure_toolchain
# default: empty = NO
local USEGCC5=

if [[ ${CHOST} == *-darwin* ]] ; then
# setup MacOSX.sdk symlink for GCC, this should probably be
# managed using an eselect module in the future
Expand Down Expand Up @@ -1525,11 +1523,25 @@ bootstrap_stage1() {
( cd "${ROOT}" && ln -s "${SDKPATH}" MacOSX.sdk )
einfo "using system sources from ${SDKPATH}"

# GCC 14 cannot be compiled by versions of Clang at least on
# Darwin17, so go the safe route and get GCC-5 which is sufficient
# and the last one we can compile without C11. This also compiles
# on Darwin 8 and 9.
# see also configure_toolchain
case ${CHOST} in
*-darwin[89]) USEGCC5=yes ;;
*86*-darwin*) USEGCC5=yes ;;
# arm64/M1 isn't supported by old GCC-5!
esac
fi

if [[ -n ${USEGCC5} ]] ; then
# benefit from 4.2 if it's present
if [[ -e /usr/bin/gcc-4.2 ]] ; then
export CC=gcc-4.2
export CXX=g++-4.2
fi

[[ -e ${ROOT}/tmp/usr/include/gmp.h ]] \
|| (bootstrap_gmp) || return 1
[[ -e ${ROOT}/tmp/usr/include/mpfr.h ]] \
Expand Down

0 comments on commit a114199

Please sign in to comment.