@@ -391,9 +391,10 @@ bootstrap_profile() {
391
391
profile=" prefix/darwin/macos/10.$(( rev - 4 )) /x64"
392
392
;;
393
393
* 64-apple-darwin2[0123456789])
394
- # Big Sur is 11.0
394
+ # Big Sur is 11.0
395
395
# Monterey is 12.0
396
- # Ventura is 13.0
396
+ # Ventura is 13.0
397
+ # Sanoma is 14.0
397
398
rev=${CHOST##* darwin}
398
399
case ${CHOST%% -* } in
399
400
x86_64) arch=x64 ;;
@@ -453,44 +454,6 @@ bootstrap_profile() {
453
454
;;
454
455
esac
455
456
456
- if [[ ${CHOST} == * -darwin* ]] ; then
457
- # setup MacOSX.sdk symlink for GCC, this should probably be
458
- # managed using an eselect module in the future
459
- # FWIW, just use system (/) if it seems OK, for some reason
460
- # early versions of TAPI-based SDKs did not include some symbols
461
- # like fclose, which ld64 is able to resolve from the dylibs
462
- # although they are unvisible using e.g. nm.
463
- rm -f " ${ROOT} " /MacOSX.sdk
464
- local SDKPATH
465
- if [[ -e /usr/lib/libSystem.B.dylib && -d /usr/include ]] ; then
466
- SDKPATH=/
467
- else
468
- SDKPATH=$( xcrun --show-sdk-path --sdk macosx)
469
- if [[ -L ${SDKPATH} ]] ; then
470
- local fsdk
471
- local osvers
472
- # try and find a matching OS SDK
473
- fsdk=" $( readlink -f " ${SDKPATH} " ) "
474
- osvers=" $( sw_vers -productVersion) "
475
- if [[ ${osvers%% .* } -le 10 ]] ; then
476
- osvers=$( echo " ${osvers} " | cut -d' .' -f1-2)
477
- else
478
- osvers=${osvers%% .* }
479
- fi
480
- fsdk=${fsdk%/ MacOSX* .sdk}
481
- fsdk=${fsdk} /MacOSX${osvers} .sdk
482
- [[ -e ${fsdk} ]] && SDKPATH=${fsdk}
483
- fi
484
- if [[ ! -e ${SDKPATH} ]] ; then
485
- SDKPATH=$( xcodebuild -showsdks | sort -nr \
486
- | grep -o " macosx.*" | head -n1)
487
- SDKPATH=$( xcode-select -print-path) /SDKs/MacOSX${SDKPATH# macosx} .sdk
488
- fi
489
- fi
490
- ( cd " ${ROOT} " && ln -s " ${SDKPATH} " MacOSX.sdk )
491
- einfo " using system sources from ${SDKPATH} "
492
- fi
493
-
494
457
if [[ ${DARWIN_USE_GCC} == 1 ]] ; then
495
458
# amend profile, to use gcc one
496
459
profile=" ${profile} /gcc"
@@ -585,7 +548,7 @@ bootstrap_tree() {
585
548
# retain this comment and the line below to
586
549
# keep this snapshot around in the snapshots
587
550
# MKSNAPSHOT-ANCHOR -- directory of rsync slaves
588
- local PV=" 20240622 "
551
+ local PV=" 20240718 "
589
552
590
553
# RAP uses the latest gentoo main repo snapshot to bootstrap.
591
554
is-rap && LATEST_TREE_YES=1
@@ -919,8 +882,16 @@ bootstrap_gnu() {
919
882
" --disable-bootstrap"
920
883
" --disable-multilib"
921
884
" --disable-nls"
885
+ " --disable-libsanitizer"
922
886
)
923
887
888
+ if [[ ${CHOST} == * -darwin* ]] ; then
889
+ myconf+=(
890
+ " --with-native-system-header-dir=${ROOT} /MacOSX.sdk/usr/include"
891
+ " --with-ld=${ROOT} /tmp/usr/bin/ldwrapper"
892
+ )
893
+ fi
894
+
924
895
export CFLAGS=" -O1 -pipe"
925
896
export CXXFLAGS=" -O1 -pipe"
926
897
fi
@@ -1320,6 +1291,33 @@ bootstrap_mpc() {
1320
1291
bootstrap_gnu mpc 1.2.1
1321
1292
}
1322
1293
1294
+ bootstrap_ldwrapper () {
1295
+ A=ldwrapper.c
1296
+
1297
+ einfo " Bootstrapping ${A% .c} "
1298
+
1299
+ efetch " https://rsync.prefix.bitzolder.nl/sys-devel/binutils-config/files/${A} " || return 1
1300
+
1301
+ export S=" ${PORTAGE_TMPDIR} /ldwrapper"
1302
+ rm -rf " ${S} "
1303
+ mkdir -p " ${S} " || return 1
1304
+ cd " ${S} " || return 1
1305
+ cp " ${DISTDIR} /${A} " . || return 1
1306
+
1307
+ einfo " Compiling ${A% .c} "
1308
+ ${CC:- gcc} \
1309
+ -o ldwrapper \
1310
+ -DCHOST=" \" ${CHOST} \" " \
1311
+ -DEPREFIX=" \" ${ROOT} \" " \
1312
+ ldwrapper.c || return 1
1313
+
1314
+ einfo " Installing ${A% .c} "
1315
+ mkdir -p " ${ROOT} " /tmp/usr/bin
1316
+ cp -a ldwrapper " ${ROOT} " /tmp/usr/bin/ || return 1
1317
+
1318
+ einfo " ${A% .c} bootstrapped"
1319
+ }
1320
+
1323
1321
bootstrap_gcc5 () {
1324
1322
# bootstraps with gcc-4.0.1 (Darwin 8), provides C11
1325
1323
bootstrap_gnu gcc 5.5.0
@@ -1482,12 +1480,51 @@ bootstrap_stage1() {
1482
1480
[[ -e ${ROOT} /tmp/${x} ]] || ( cd " ${ROOT} " /tmp && ln -s usr/${x} )
1483
1481
done
1484
1482
1485
- # we could check compiler version here, but we just know
1486
- # it's Darwin 8 and 9 being affected here, so handle them to
1487
- # get a GCC-5 which is sufficient to compile the current tree
1488
- # packages
1483
+ configure_toolchain
1484
+ export CC CXX
1485
+
1486
+ # GCC 14 cannot be compiled by versions of Clang at least on
1487
+ # Darwin17, so go the safe route and get GCC-5 which is sufficient
1488
+ # and the last one we can compile without C11. This also compiles
1489
+ # on Darwin 8 and 9.
1489
1490
# see also configure_toolchain
1490
- if [[ ${CHOST} == * -darwin[89] ]] ; then
1491
+ if [[ ${CHOST} == * -darwin* ]] ; then
1492
+ # setup MacOSX.sdk symlink for GCC, this should probably be
1493
+ # managed using an eselect module in the future
1494
+ # FWIW, just use system (/) if it seems OK, for some reason
1495
+ # early versions of TAPI-based SDKs did not include some symbols
1496
+ # like fclose, which ld64 is able to resolve from the dylibs
1497
+ # although they are unvisible using e.g. nm.
1498
+ rm -f " ${ROOT} " /MacOSX.sdk
1499
+ local SDKPATH
1500
+ if [[ -e /usr/lib/libSystem.B.dylib && -d /usr/include ]] ; then
1501
+ SDKPATH=/
1502
+ else
1503
+ SDKPATH=$( xcrun --show-sdk-path --sdk macosx)
1504
+ if [[ -L ${SDKPATH} ]] ; then
1505
+ local fsdk
1506
+ local osvers
1507
+ # try and find a matching OS SDK
1508
+ fsdk=" $( readlink -f " ${SDKPATH} " ) "
1509
+ osvers=" $( sw_vers -productVersion) "
1510
+ if [[ ${osvers%% .* } -le 10 ]] ; then
1511
+ osvers=$( echo " ${osvers} " | cut -d' .' -f1-2)
1512
+ else
1513
+ osvers=${osvers%% .* }
1514
+ fi
1515
+ fsdk=${fsdk%/ MacOSX* .sdk}
1516
+ fsdk=${fsdk} /MacOSX${osvers} .sdk
1517
+ [[ -e ${fsdk} ]] && SDKPATH=${fsdk}
1518
+ fi
1519
+ if [[ ! -e ${SDKPATH} ]] ; then
1520
+ SDKPATH=$( xcodebuild -showsdks | sort -nr \
1521
+ | grep -o " macosx.*" | head -n1)
1522
+ SDKPATH=$( xcode-select -print-path) /SDKs/MacOSX${SDKPATH# macosx} .sdk
1523
+ fi
1524
+ fi
1525
+ ( cd " ${ROOT} " && ln -s " ${SDKPATH} " MacOSX.sdk )
1526
+ einfo " using system sources from ${SDKPATH} "
1527
+
1491
1528
# benefit from 4.2 if it's present
1492
1529
if [[ -e /usr/bin/gcc-4.2 ]] ; then
1493
1530
export CC=gcc-4.2
@@ -1499,12 +1536,47 @@ bootstrap_stage1() {
1499
1536
|| (bootstrap_mpfr) || return 1
1500
1537
[[ -e ${ROOT} /tmp/usr/include/mpc.h ]] \
1501
1538
|| (bootstrap_mpc) || return 1
1539
+ [[ -x ${ROOT} /tmp/usr/bin/ldwrapper ]] \
1540
+ || (bootstrap_ldwrapper) || return 1
1541
+ # get ldwrapper target in PATH
1542
+ export BINUTILS_CONFIG_LD=" $( type -P ld) "
1543
+ # force deployment target in GCCs build, GCC-5 doesn't quite get
1544
+ # the newer macOS versions (20+) and thus confuses ld when it
1545
+ # passes on the deployment version. Use High Sierra as it has
1546
+ # everything we need
1547
+ [[ ${CHOST##* darwin} -gt 10 ]] && export MACOSX_DEPLOYMENT_TARGET=10.13
1502
1548
[[ -x ${ROOT} /tmp/usr/bin/gcc ]] \
1503
1549
|| (bootstrap_gcc5) || return 1
1504
- fi
1505
1550
1506
- configure_toolchain
1507
- export CC CXX
1551
+ if [[ ${CHOST##* darwin} -gt 10 ]] ; then
1552
+ # install wrappers in tmp/usr/local/bin which comes before
1553
+ # /tmp/usr/bin in PATH
1554
+ mkdir -p " ${ROOT} " /tmp/usr/local/bin
1555
+ rm -f " ${ROOT} " /tmp/usr/local/bin/{gcc,${CHOST} -gcc}
1556
+ cat > " ${ROOT} /tmp/usr/local/bin/${CHOST} -gcc" << -EOS
1557
+ #!/usr/bin/env sh
1558
+ export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
1559
+ export BINUTILS_CONFIG_LD="$( type -P ld) "
1560
+ exec "${ROOT} "/tmp/usr/bin/${CHOST} -gcc "\$ @"
1561
+ EOS
1562
+ chmod 755 " ${ROOT} /tmp/usr/local/bin/${CHOST} -gcc"
1563
+ ln -s ${CHOST} -gcc " ${ROOT} " /tmp/usr/local/bin/gcc
1564
+
1565
+ rm -f " ${ROOT} " /tmp/usr/local/bin/{g++,${CHOST} -g++}
1566
+ cat > " ${ROOT} " /tmp/usr/local/bin/${CHOST} -g++ << -EOS
1567
+ #!/usr/bin/env sh
1568
+ export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
1569
+ export BINUTILS_CONFIG_LD="$( type -P ld) "
1570
+ exec "${ROOT} "/tmp/usr/bin/${CHOST} -g++ "\$ @"
1571
+ EOS
1572
+ chmod 755 " ${ROOT} " /tmp/usr/local/bin/${CHOST} -g++
1573
+ ln -s ${CHOST} -g++ " ${ROOT} " /tmp/usr/local/bin/g++
1574
+ fi
1575
+
1576
+ # reset after gcc-4.2 usage
1577
+ export CC=gcc
1578
+ export CXX=g++
1579
+ fi
1508
1580
1509
1581
# Run all bootstrap_* commands in a subshell since the targets
1510
1582
# frequently pollute the environment using exports which affect
@@ -3018,7 +3090,7 @@ EOF
3018
3090
# location seems ok
3019
3091
break
3020
3092
done
3021
- export PATH=" $EPREFIX /usr/bin:$EPREFIX /bin:$EPREFIX /tmp/usr/bin:$EPREFIX /tmp/bin:$EPREFIX /tmp/usr/local /bin:${PATH} "
3093
+ export PATH=" $EPREFIX /usr/bin:$EPREFIX /bin:$EPREFIX /tmp/usr/local/ bin:$EPREFIX /tmp/usr/ bin:$EPREFIX /tmp/bin:${PATH} "
3022
3094
3023
3095
cat << EOF
3024
3096
0 commit comments