@@ -30,19 +30,44 @@ ${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 .
36+ variable is mandatory .
3737
38- CMAKE The CMake binary to use. This variable is optional.
39-
40- CLANG_FORMAT The clang-format binary to use when generating the format
41- ignore list.
38+ CMAKE The CMake binary to use. This variable is optional, it defaults
39+ to whatever 'cmake' binary is in the PATH.
4240
41+ CCACHE The ccache binary to use. This variable is optional and is only
42+ used by the bootstrapping build.
4343EOF
4444}
4545
46+ function step() {
47+ endstep
48+ set +x
49+ if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
50+ echo " ::group::$1 "
51+ export IN_GROUP=1
52+ else
53+ echo " --- $1 "
54+ fi
55+ set -x
56+ }
57+
58+ function endstep() {
59+ set +x
60+ if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
61+ echo " ::endgroup::"
62+ unset IN_GROUP
63+ fi
64+ set -x
65+ }
66+
67+ function error() {
68+ echo " ::error::$1 "
69+ }
70+
4671if [[ $# == 0 ]]; then
4772 usage
4873 exit 0
88113 NINJA=" ninja"
89114fi
90115
116+ if [ -z " ${CC} " ]; then
117+ error " Environment variable CC must be defined"
118+ exit 1
119+ fi
120+
121+ if [ -z " ${CXX} " ]; then
122+ error " Environment variable CXX must be defined"
123+ exit 1
124+ fi
125+
91126if [ -z " ${CMAKE} " ]; then
92127 if xcrun --find cmake & > /dev/null; then
93128 CMAKE=" $( xcrun --find cmake) "
@@ -96,39 +131,6 @@ if [ -z "${CMAKE}" ]; then
96131 fi
97132fi
98133
99- if [ -z " ${CC} " ]; then
100- CC=cc
101- fi
102-
103- if [ -z " ${CXX} " ]; then
104- CXX=c++
105- fi
106-
107- function step() {
108- endstep
109- set +x
110- if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
111- echo " ::group::$1 "
112- export IN_GROUP=1
113- else
114- echo " --- $1 "
115- fi
116- set -x
117- }
118-
119- function endstep() {
120- set +x
121- if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
122- echo " ::endgroup::"
123- unset IN_GROUP
124- fi
125- set -x
126- }
127-
128- function error() {
129- echo " ::error::$1 "
130- }
131-
132134# Print the version of a few tools to aid diagnostics in some cases
133135step " Diagnose tools in use"
134136${CMAKE} --version
@@ -167,11 +169,7 @@ function generate-cmake() {
167169}
168170
169171function generate-cmake-libcxx-win() {
170- generate-cmake-base \
171- -DLLVM_ENABLE_RUNTIMES=" libcxx" \
172- -DCMAKE_C_COMPILER=clang-cl \
173- -DCMAKE_CXX_COMPILER=clang-cl \
174- " ${@ } "
172+ generate-cmake-base -DLLVM_ENABLE_RUNTIMES=" libcxx" " ${@ } "
175173}
176174
177175function generate-cmake-android() {
@@ -391,16 +389,16 @@ generic-ubsan)
391389bootstrapping-build)
392390 clean
393391
394- if which ccache ; then
395- CCACHE =" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache "
392+ if [ ! -z ${CCACHE+x} ] ; then
393+ COMPILER_LAUNCHER =" -DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE} "
396394 fi
397395
398396 step " Generating CMake"
399397 ${CMAKE} \
400398 -S " ${MONOREPO_ROOT} /llvm" \
401399 -B " ${BUILD_DIR} " \
402400 -GNinja -DCMAKE_MAKE_PROGRAM=" ${NINJA} " \
403- ${CCACHE } \
401+ ${COMPILER_LAUNCHER } \
404402 -DCMAKE_BUILD_TYPE=Release \
405403 -DCMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
406404 -DLLVM_ENABLE_PROJECTS=" clang;lldb" \
@@ -727,14 +725,6 @@ mingw-static)
727725 -DLIBUNWIND_ENABLE_SHARED=OFF
728726 check-runtimes
729727;;
730- mingw-dll-i686)
731- clean
732- generate-cmake \
733- -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
734- -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
735- -C " ${MONOREPO_ROOT} /libcxx/cmake/caches/MinGW.cmake"
736- check-runtimes
737- ;;
738728mingw-incomplete-sysroot)
739729 # When bringing up a new cross compiler from scratch, we build
740730 # libunwind/libcxx in a setup where the toolchain is incomplete and
@@ -779,10 +769,6 @@ android-ndk-*)
779769 fi
780770 ARCH=$( arch_of_emu_img ${ANDROID_EMU_IMG} )
781771
782- # Use the Android compiler by default.
783- export CC=${CC:-/ opt/ android/ clang/ clang-current/ bin/ clang}
784- export CXX=${CXX:-/ opt/ android/ clang/ clang-current/ bin/ clang++}
785-
786772 # The NDK libc++_shared.so is always built against the oldest supported API
787773 # level. When tests are run against a device with a newer API level, test
788774 # programs can be built for any supported API level, but building for the
0 commit comments