@@ -30,17 +30,41 @@ ${PROGNAME} [options] <BUILDER>
3030
3131Environment variables
3232CC The C compiler to use, this value is used by CMake. This
33- variable is optional .
33+ variable is mandatory .
3434
3535CXX The C++ compiler to use, this value is used by CMake. This
36- variable is optional.
37-
38- CLANG_FORMAT The clang-format binary to use when generating the format
39- ignore list.
36+ variable is mandatory.
4037
38+ CCACHE The ccache binary to use. This variable is optional and is only
39+ used by the bootstrapping build.
4140EOF
4241}
4342
43+ function step() {
44+ endstep
45+ set +x
46+ if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
47+ echo " ::group::$1 "
48+ export IN_GROUP=1
49+ else
50+ echo " --- $1 "
51+ fi
52+ set -x
53+ }
54+
55+ function endstep() {
56+ set +x
57+ if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
58+ echo " ::endgroup::"
59+ unset IN_GROUP
60+ fi
61+ set -x
62+ }
63+
64+ function error() {
65+ echo " ::error::$1 "
66+ }
67+
4468if [[ $# == 0 ]]; then
4569 usage
4670 exit 0
@@ -96,6 +120,23 @@ function error() {
96120 echo " ::error::$1 "
97121}
98122
123+ if [ -z ${CC+x} ]; then
124+ error " Environment variable CC must be defined"
125+ exit 1
126+ fi
127+
128+ if [ -z ${CXX+x} ]; then
129+ error " Environment variable CXX must be defined"
130+ exit 1
131+ fi
132+
133+ # Print the version of a few tools to aid diagnostics in some cases
134+ step " Diagnose tools in use"
135+ cmake --version
136+ ninja --version
137+ ${CC} --version
138+ ${CXX} --version
139+
99140function clean() {
100141 rm -rf " ${BUILD_DIR} "
101142}
@@ -127,11 +168,7 @@ function generate-cmake() {
127168}
128169
129170function generate-cmake-libcxx-win() {
130- generate-cmake-base \
131- -DLLVM_ENABLE_RUNTIMES=" libcxx" \
132- -DCMAKE_C_COMPILER=clang-cl \
133- -DCMAKE_CXX_COMPILER=clang-cl \
134- " ${@ } "
171+ generate-cmake-base -DLLVM_ENABLE_RUNTIMES=" libcxx" " ${@ } "
135172}
136173
137174function generate-cmake-android() {
@@ -215,12 +252,6 @@ function test-armv7m-picolibc() {
215252 check-runtimes
216253}
217254
218- # Print the version of a few tools to aid diagnostics in some cases
219- step " Diagnose tools in use"
220- cmake --version
221- ninja --version
222- if [ ! -z " ${CXX} " ]; then ${CXX} --version; fi
223-
224255case " ${BUILDER} " in
225256check-generated-output)
226257 # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
@@ -357,12 +388,16 @@ generic-ubsan)
357388bootstrapping-build)
358389 clean
359390
391+ if [ ! -z ${CCACHE+x} ]; then
392+ COMPILER_LAUNCHER=" -DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE} "
393+ fi
394+
360395 step " Generating CMake"
361396 cmake \
362397 -S " ${MONOREPO_ROOT} /llvm" \
363398 -B " ${BUILD_DIR} " \
364399 -GNinja \
365- -DCMAKE_CXX_COMPILER_LAUNCHER= " ccache " \
400+ ${COMPILER_LAUNCHER} \
366401 -DCMAKE_BUILD_TYPE=Release \
367402 -DCMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
368403 -DLLVM_ENABLE_PROJECTS=" clang;lldb" \
@@ -689,14 +724,6 @@ mingw-static)
689724 -DLIBUNWIND_ENABLE_SHARED=OFF
690725 check-runtimes
691726;;
692- mingw-dll-i686)
693- clean
694- generate-cmake \
695- -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
696- -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
697- -C " ${MONOREPO_ROOT} /libcxx/cmake/caches/MinGW.cmake"
698- check-runtimes
699- ;;
700727mingw-incomplete-sysroot)
701728 # When bringing up a new cross compiler from scratch, we build
702729 # libunwind/libcxx in a setup where the toolchain is incomplete and
@@ -741,10 +768,6 @@ android-ndk-*)
741768 fi
742769 ARCH=$( arch_of_emu_img ${ANDROID_EMU_IMG} )
743770
744- # Use the Android compiler by default.
745- export CC=${CC:-/ opt/ android/ clang/ clang-current/ bin/ clang}
746- export CXX=${CXX:-/ opt/ android/ clang/ clang-current/ bin/ clang++}
747-
748771 # The NDK libc++_shared.so is always built against the oldest supported API
749772 # level. When tests are run against a device with a newer API level, test
750773 # programs can be built for any supported API level, but building for the
0 commit comments