@@ -1437,95 +1437,6 @@ function cmake_config_opt() {
1437
1437
fi
1438
1438
}
1439
1439
1440
- function copy_lib_stripping_architecture() {
1441
- local source=" $1 "
1442
- local dest=" $2 "
1443
- local arch=" $3 "
1444
-
1445
- # An alternative approach would be to use || to first
1446
- # attempt the removal of the slice and fall back to the
1447
- # copy when failing.
1448
- # However, this would leave unneeded error messages in the logs
1449
- # that may hinder investigation; in addition, in this scenario
1450
- # the `call` function seems to not propagate correctly failure
1451
- # exit codes.
1452
- if lipo -archs " ${source} " | grep -q " ${arch} " ; then
1453
- call lipo -remove " ${arch} " " ${source} " -output " ${dest} "
1454
- else
1455
- call cp " ${source} " " ${dest} "
1456
- fi
1457
- }
1458
-
1459
- function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
1460
- local clang_dest_dir=" $1 "
1461
-
1462
- HOST_CXX_DIR=$( dirname " ${HOST_CXX} " )
1463
- HOST_LIB_CLANG_DIR=" ${HOST_CXX_DIR} /../lib/clang"
1464
- DEST_LIB_CLANG_DIR=" ${clang_dest_dir} /lib/clang"
1465
-
1466
- [ -d " ${HOST_LIB_CLANG_DIR} " -a -d " ${DEST_LIB_CLANG_DIR} " ] || return 0
1467
-
1468
- DEST_CXX_BUILTINS_VERSION=$( ls -1 " ${DEST_LIB_CLANG_DIR} " )
1469
- DEST_BUILTINS_DIR=" ${clang_dest_dir} /lib/clang/${DEST_CXX_BUILTINS_VERSION} /lib/darwin"
1470
-
1471
- if [[ -d " ${DEST_BUILTINS_DIR} " ]]; then
1472
- for HOST_CXX_BUILTINS_PATH in " ${HOST_LIB_CLANG_DIR} " /* ; do
1473
- HOST_CXX_BUILTINS_DIR=" ${HOST_CXX_BUILTINS_PATH} /lib/darwin"
1474
- echo " copying compiler-rt embedded builtins from ${HOST_CXX_BUILTINS_DIR} into the local clang build directory ${DEST_BUILTINS_DIR} ."
1475
-
1476
- for OS in ios watchos tvos; do
1477
- # Copy over the device .a when necessary
1478
- LIB_NAME=" libclang_rt.$OS .a"
1479
- HOST_LIB_PATH=" $HOST_CXX_BUILTINS_DIR /$LIB_NAME "
1480
- DEST_LIB_PATH=" ${DEST_BUILTINS_DIR} /${LIB_NAME} "
1481
- if [[ ! -f " ${DEST_LIB_PATH} " ]]; then
1482
- if [[ -f " ${HOST_LIB_PATH} " ]]; then
1483
- if [[ " $OS " == " tvos" ]]; then
1484
- # This is to avoid strip failures when generating a toolchain
1485
- copy_lib_stripping_architecture " ${HOST_LIB_PATH} " " ${DEST_LIB_PATH} " i386
1486
- else
1487
- call cp " ${HOST_LIB_PATH} " " ${DEST_LIB_PATH} "
1488
- fi
1489
- elif [[ " ${VERBOSE_BUILD} " ]]; then
1490
- echo " no file exists at ${HOST_LIB_PATH} "
1491
- fi
1492
- fi
1493
-
1494
- # Copy over the simulator .a when necessary
1495
- SIM_LIB_NAME=" libclang_rt.${OS} sim.a"
1496
- HOST_SIM_LIB_PATH=" $HOST_CXX_BUILTINS_DIR /$SIM_LIB_NAME "
1497
- DEST_SIM_LIB_PATH=" ${DEST_BUILTINS_DIR} /${SIM_LIB_NAME} "
1498
- if [[ ! -f " ${DEST_SIM_LIB_PATH} " ]]; then
1499
- if [[ -f " ${HOST_SIM_LIB_PATH} " ]]; then
1500
- if [[ " $OS " == " tvos" ]]; then
1501
- # This is to avoid strip failures when generating a toolchain
1502
- copy_lib_stripping_architecture " ${HOST_SIM_LIB_PATH} " " ${DEST_SIM_LIB_PATH} " i386
1503
- else
1504
- call cp " ${HOST_SIM_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1505
- fi
1506
- elif [[ -f " ${HOST_LIB_PATH} " ]]; then
1507
- # The simulator .a might not exist if the host
1508
- # Xcode is old. In that case, copy over the
1509
- # device library to the simulator location to allow
1510
- # clang to find it. The device library has the simulator
1511
- # slices in Xcode that doesn't have the simulator .a, so
1512
- # the link is still valid.
1513
- echo " copying over faux-sim library ${HOST_LIB_PATH} to ${SIM_LIB_NAME} "
1514
- if [[ " $OS " == " tvos" ]]; then
1515
- echo " Remove i386 from tvOS ${DEST_SIM_LIB_PATH} "
1516
- call lipo -remove i386 " ${HOST_LIB_PATH} " -output " ${DEST_SIM_LIB_PATH} "
1517
- else
1518
- call cp " ${HOST_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1519
- fi
1520
- elif [[ " ${VERBOSE_BUILD} " ]]; then
1521
- echo " no file exists at ${HOST_SIM_LIB_PATH} "
1522
- fi
1523
- fi
1524
- done
1525
- done
1526
- fi
1527
- }
1528
-
1529
1440
#
1530
1441
# Configure and build each product
1531
1442
#
0 commit comments