Skip to content

Commit 880bd30

Browse files
authored
Merge pull request #5375 from apple/moredistcc
2 parents 4ac7968 + ce8295f commit 880bd30

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

utils/build-script-impl

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,24 @@ eval COMMON_CMAKE_OPTIONS=(${COMMON_CMAKE_OPTIONS})
14961496
eval EXTRA_CMAKE_OPTIONS=(${EXTRA_CMAKE_OPTIONS})
14971497
eval BUILD_ARGS=(${BUILD_ARGS})
14981498

1499+
if [[ -n "${DISTCC}" ]]; then
1500+
if [[ "$(uname -s)" == "Darwin" ]] ; then
1501+
# These are normally deduced by CMake, but when the compiler is set to
1502+
# distcc which is installed elsewhere, we need to set them explicitly.
1503+
COMMON_CMAKE_OPTIONS=(
1504+
"${COMMON_CMAKE_OPTIONS[@]}" "-DCMAKE_AR=$(xcrun_find_tool ar)"
1505+
"-DCMAKE_LINKER=$(xcrun_find_tool ld)"
1506+
"-DCMAKE_NM=$(xcrun_find_tool nm)"
1507+
"-DCMAKE_OBJDUMP=$(xcrun_find_tool objdump)"
1508+
"-DCMAKE_RANLIB=$(xcrun_find_tool ranlib)"
1509+
"-DCMAKE_STRIP=$(xcrun_find_tool strip)"
1510+
)
1511+
fi
1512+
fi
1513+
1514+
eval CMAKE_BUILD=("${DISTCC_PUMP}" "${CMAKE}" "--build")
1515+
1516+
14991517
if [[ "${CMAKE_GENERATOR}" == "Xcode" ]]; then
15001518
BUILD_TARGET_FLAG="-target"
15011519
fi
@@ -2485,10 +2503,10 @@ for host in "${ALL_HOSTS[@]}"; do
24852503

24862504
# Xcode can't restart itself if it turns out we need to reconfigure.
24872505
# Do an advance build to handle that.
2488-
call ${DISTCC_PUMP} "${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product})
2506+
call "${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product})
24892507
fi
24902508

2491-
call ${DISTCC_PUMP} "${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}" ${build_targets[@]}
2509+
call "${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}" ${build_targets[@]}
24922510
fi
24932511
done
24942512
done
@@ -2728,11 +2746,11 @@ for host in "${ALL_HOSTS[@]}"; do
27282746

27292747
trap "tests_busted ${product} ''" ERR
27302748
build_dir=$(build_directory ${host} ${product})
2731-
build_cmd=("${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}")
2749+
build_cmd=("${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}")
27322750

27332751
if [[ "${executable_target}" != "" ]]; then
27342752
echo "--- Building tests for ${product} ---"
2735-
call ${DISTCC_PUMP} "${build_cmd[@]}" ${BUILD_TARGET_FLAG} "${executable_target}"
2753+
call "${build_cmd[@]}" ${BUILD_TARGET_FLAG} "${executable_target}"
27362754
fi
27372755

27382756
# We can only run tests built for the host machine, because
@@ -3014,7 +3032,7 @@ for host in "${ALL_HOSTS[@]}"; do
30143032
echo "--- Installing ${product} ---"
30153033
build_dir=$(build_directory ${host} ${product})
30163034

3017-
call env DESTDIR="${host_install_destdir}" "${CMAKE}" --build "${build_dir}" -- ${INSTALL_TARGETS}
3035+
call env DESTDIR="${host_install_destdir}" "${CMAKE_BUILD[@]}" "${build_dir}" -- ${INSTALL_TARGETS}
30183036
done
30193037

30203038
if [[ "${DARWIN_INSTALL_EXTRACT_SYMBOLS}" ]] && [[ $(host_has_darwin_symbols ${host}) ]]; then

0 commit comments

Comments
 (0)