2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # This script will check out llvm and clang into third_party/llvm and build it.
8 # Do NOT CHANGE this if you don't know what you're doing -- see
9 # https://code.google.com/p/chromium/wiki/UpdatingClang
10 # Reverting problematic clang rolls is safe, though.
13 THIS_DIR
="$(dirname "${0}")"
14 LLVM_DIR
="${THIS_DIR}/../../../third_party/llvm"
15 LLVM_BUILD_DIR
="${LLVM_DIR}/../llvm-build/Release+Asserts"
16 COMPILER_RT_BUILD_DIR
="${LLVM_DIR}/../llvm-build/compiler-rt"
17 LLVM_BOOTSTRAP_DIR
="${LLVM_DIR}/../llvm-bootstrap"
18 LLVM_BOOTSTRAP_INSTALL_DIR
="${LLVM_DIR}/../llvm-bootstrap-install"
19 CLANG_DIR
="${LLVM_DIR}/tools/clang"
20 COMPILER_RT_DIR
="${LLVM_DIR}/compiler-rt"
21 LIBCXX_DIR
="${LLVM_DIR}/projects/libcxx"
22 LIBCXXABI_DIR
="${LLVM_DIR}/projects/libcxxabi"
23 ANDROID_NDK_DIR
="${THIS_DIR}/../../../third_party/android_tools/ndk"
24 STAMP_FILE
="${LLVM_DIR}/../llvm-build/cr_build_revision"
26 ABS_LIBCXX_DIR
="${PWD}/${LIBCXX_DIR}"
27 ABS_LIBCXXABI_DIR
="${PWD}/${LIBCXXABI_DIR}"
28 ABS_LLVM_DIR
="${PWD}/${LLVM_DIR}"
29 ABS_LLVM_BUILD_DIR
="${PWD}/${LLVM_BUILD_DIR}"
30 ABS_COMPILER_RT_DIR
="${PWD}/${COMPILER_RT_DIR}"
33 # Use both the clang revision and the plugin revisions to test for updates.
34 BLINKGCPLUGIN_REVISION
=\
35 $
(grep 'set(LIBRARYNAME' "$THIS_DIR"/..
/blink_gc_plugin
/CMakeLists.txt \
36 | cut
-d ' ' -f 2 |
tr -cd '[0-9]')
37 CLANG_AND_PLUGINS_REVISION
="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}"
39 # ${A:-a} returns $A if it's set, a else.
40 LLVM_REPO_URL
=${LLVM_URL:-https://llvm.org/svn/llvm-project}
42 if [[ -z "$GYP_DEFINES" ]]; then
45 if [[ -z "$GYP_GENERATORS" ]]; then
50 # Die if any command dies, error on undefined variable expansions.
55 # Parse command line options.
61 chrome_tools
="plugins;blink_gc_plugin"
64 if [[ "${OS}" = "Darwin" ]]; then
68 while [[ $# > 0 ]]; do
91 if [[ $# == 0 ]]; then
92 echo "--with-chrome-tools requires an argument."
99 if [[ $# == 0 ]]; then
100 echo "--gcc-toolchain requires an argument."
103 if [[ -x "$1/bin/gcc" ]]; then
106 echo "Invalid --gcc-toolchain: '$1'."
107 echo "'$1/bin/gcc' does not appear to be valid."
113 echo "usage: $0 [--force-local-build] [--if-needed] [--run-tests] "
114 echo "--bootstrap: First build clang with CC, then with itself."
115 echo "--force-local-build: Don't try to download prebuilt binaries."
116 echo "--if-needed: Download clang only if the script thinks it is needed."
117 echo "--run-tests: Run tests after building. Only for local builds."
118 echo "--print-revision: Print current clang revision and exit."
119 echo "--without-android: Don't build ASan Android runtime library."
120 echo "--with-chrome-tools: Select which chrome tools to build." \
121 "Defaults to plugins;blink_gc_plugin."
122 echo " Example: --with-chrome-tools plugins;empty-string"
123 echo "--gcc-toolchain: Set the prefix for which GCC version should"
124 echo " be used for building. For example, to use gcc in"
125 echo " /opt/foo/bin/gcc, use '--gcc-toolchain '/opt/foo"
130 echo "Unknown argument: '$1'."
131 echo "Use --help for help."
138 if [[ -n "$if_needed" ]]; then
139 if [[ "${OS}" == "Darwin" ]]; then
140 # clang is used on Mac.
142 elif [[ "$GYP_DEFINES" =~ .
*(clang|tsan|asan|lsan|msan
)=1.
* ]]; then
143 # clang requested via $GYP_DEFINES.
145 elif [[ -d "${LLVM_BUILD_DIR}" ]]; then
146 # clang previously downloaded, remove third_party/llvm-build to prevent
149 elif [[ "${OS}" == "Linux" ]]; then
150 # Temporarily use clang on linux. Leave a stamp file behind, so that
151 # this script can remove clang again on machines where it was autoinstalled.
152 mkdir
-p "${LLVM_BUILD_DIR}"
153 touch "${LLVM_BUILD_DIR}/autoinstall_stamp"
156 # clang wasn't needed, not doing anything.
162 # Check if there's anything to be done, exit early if not.
163 if [[ -f "${STAMP_FILE}" ]]; then
164 PREVIOUSLY_BUILT_REVISON
=$
(cat "${STAMP_FILE}")
165 if [[ -z "$force_local_build" ]] && \
166 [[ "${PREVIOUSLY_BUILT_REVISON}" = \
167 "${CLANG_AND_PLUGINS_REVISION}" ]]; then
168 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}"
172 # To always force a new build if someone interrupts their build half way.
173 rm -f "${STAMP_FILE}"
176 if [[ -z "$force_local_build" ]]; then
177 # Check if there's a prebuilt binary and if so just fetch that. That's faster,
178 # and goma relies on having matching binary hashes on client and server too.
179 CDS_URL
=https
://commondatastorage.googleapis.com
/chromium-browser-clang
180 CDS_FILE
="clang-${CLANG_REVISION}.tgz"
181 CDS_OUT_DIR
=$
(mktemp
-d -t clang_download.XXXXXX
)
182 CDS_OUTPUT
="${CDS_OUT_DIR}/${CDS_FILE}"
183 if [ "${OS}" = "Linux" ]; then
184 CDS_FULL_URL
="${CDS_URL}/Linux_x64/${CDS_FILE}"
185 elif [ "${OS}" = "Darwin" ]; then
186 CDS_FULL_URL
="${CDS_URL}/Mac/${CDS_FILE}"
188 echo Trying to download prebuilt clang
189 if which curl
> /dev
/null
; then
190 curl
-L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \
191 rm -rf "${CDS_OUT_DIR}"
192 elif which wget
> /dev
/null
; then
193 wget
"${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}"
195 echo "Neither curl nor wget found. Please install one of these."
198 if [ -f "${CDS_OUTPUT}" ]; then
199 rm -rf "${LLVM_BUILD_DIR}"
200 mkdir
-p "${LLVM_BUILD_DIR}"
201 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
202 echo clang
"${CLANG_REVISION}" unpacked
203 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
204 rm -rf "${CDS_OUT_DIR}"
207 echo Did not
find prebuilt clang
at r
"${CLANG_REVISION}", building
211 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
212 echo "Android NDK not found at ${ANDROID_NDK_DIR}"
213 echo "The Android NDK is needed to build a Clang whose -fsanitize=address"
214 echo "works on Android. See "
215 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how"
216 echo "to install the NDK, or pass --without-android."
220 # Check that cmake and ninja are available.
221 if ! which cmake
> /dev
/null
; then
222 echo "CMake needed to build clang; please install"
225 if ! which ninja
> /dev
/null
; then
226 echo "ninja needed to build clang, please install"
230 echo Getting LLVM r
"${CLANG_REVISION}" in "${LLVM_DIR}"
231 if ! svn co
--force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
233 echo Checkout failed
, retrying
235 svn co
--force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}"
238 echo Getting clang r
"${CLANG_REVISION}" in "${CLANG_DIR}"
239 svn co
--force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"
241 # We have moved from building compiler-rt in the LLVM tree, to a separate
242 # directory. Nuke any previous checkout to avoid building it.
243 rm -rf "${LLVM_DIR}/projects/compiler-rt"
245 echo Getting compiler-rt r
"${CLANG_REVISION}" in "${COMPILER_RT_DIR}"
246 svn co
--force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \
249 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes
250 # (i.e. this is needed for bootstrap builds).
251 if [ "${OS}" = "Darwin" ]; then
252 echo Getting libc
++ r
"${CLANG_REVISION}" in "${LIBCXX_DIR}"
253 svn co
--force "${LLVM_REPO_URL}/libcxx/trunk@${CLANG_REVISION}" \
257 # While we're bundling our own libc++ on OS X, we need to compile libc++abi
258 # into it too (since OS X 10.6 doesn't have libc++abi.dylib either).
259 if [ "${OS}" = "Darwin" ]; then
260 echo Getting libc
++abi r
"${CLANG_REVISION}" in "${LIBCXXABI_DIR}"
261 svn co
--force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \
265 # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974)
267 svn revert test
/Index
/crash-recovery-modules.m
269 --- third_party
/llvm
/tools
/clang
/test
/Index
/crash-recovery-modules.m
(revision
202554)
270 +++ third_party
/llvm
/tools
/clang
/test
/Index
/crash-recovery-modules.m
(working copy
)
273 // REQUIRES
: crash-recovery
284 svn revert unittests
/libclang
/LibclangTest.cpp
286 --- unittests
/libclang
/LibclangTest.cpp
(revision
215949)
287 +++ unittests
/libclang
/LibclangTest.cpp
(working copy
)
289 EXPECT_EQ
(0U, clang_getNumDiagnostics
(ClangTU
));
292 -TEST_F(LibclangReparseTest
, ReparseWithModule
) {
293 +TEST_F
(LibclangReparseTest
, DISABLED_ReparseWithModule
) {
294 const char
*HeaderTop
= "#ifndef H\n#define H\nstruct Foo { int bar;";
295 const char
*HeaderBottom
= "\n};\n#endif\n";
296 const char
*MFile
= "#include \"HeaderFile.h\"\nint main() {"
301 # Apply r216684 to fix ASan array cookie instrumentation problem.
302 # (See https://code.google.com/p/chromium/issues/detail?id=400849#c17)
303 pushd "${COMPILER_RT_DIR}"
304 svn revert lib
/asan
/asan_rtl.cc
305 svn revert test
/asan
/TestCases
/Linux
/new_array_cookie_test.cc
307 --- a
/lib
/asan
/asan_rtl.cc
308 +++ b
/lib
/asan
/asan_rtl.cc
309 @@
-269,7 +269,7 @@ void InitializeFlags
(Flags
*f
, const char
*env
) {
310 f-
>allow_reexec
= true
;
311 f-
>print_full_thread_history
= true
;
312 f-
>poison_heap
= true
;
313 - f-
>poison_array_cookie
= true
;
314 + f-
>poison_array_cookie
= false
;
315 f-
>poison_partial
= true
;
316 // Turn off alloc
/dealloc mismatch checker on Mac and Windows
for now.
317 // https
://code.google.com
/p
/address-sanitizer
/issues
/detail?id
=131
318 diff --git a
/test
/asan
/TestCases
/Linux
/new_array_cookie_test.cc b
/test
/asan
/TestCases
/Linux
/new_array_cookie_test.cc
319 index
339120b.
.49545f0
100644
320 --- a
/test
/asan
/TestCases
/Linux
/new_array_cookie_test.cc
321 +++ b
/test
/asan
/TestCases
/Linux
/new_array_cookie_test.cc
323 // REQUIRES
: asan-64-bits
324 -// RUN
: %clangxx_asan
-O0 %s
-o %t
&& not
%run
%t
2>&1 | FileCheck
%s
325 -// RUN
: %clangxx_asan
-O3 %s
-o %t
&& not
%run
%t
2>&1 | FileCheck
%s
326 +// RUN
: %clangxx_asan
-O3 %s
-o %t
328 // RUN
: ASAN_OPTIONS
=poison_array_cookie
=1 not
%run
%t
2>&1 | FileCheck
%s
329 // RUN
: ASAN_OPTIONS
=poison_array_cookie
=0 %run
%t
338 # Set default values for CC and CXX if they're not set in the environment.
342 if [[ -n "${gcc_toolchain}" ]]; then
343 # Use the specified gcc installation for building.
344 CC
="$gcc_toolchain/bin/gcc"
345 CXX
="$gcc_toolchain/bin/g++"
346 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler,
347 # etc.) find the .so.
348 export LD_LIBRARY_PATH
="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))"
355 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
356 # needed, on OS X it requires libc++. clang only automatically links to libc++
357 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on
358 # OS X versions as old as 10.7.
359 # TODO(thakis): Some bots are still on 10.6, so for now bundle libc++.dylib.
360 # Remove this once all bots are on 10.7+, then use --enable-libcpp=yes and
361 # change deployment_target to 10.7.
364 if [ "${OS}" = "Darwin" ]; then
365 # When building on 10.9, /usr/include usually doesn't exist, and while
366 # Xcode's clang automatically sets a sysroot, self-built clangs don't.
367 CFLAGS
="-isysroot $(xcrun --show-sdk-path)"
369 CXXFLAGS
="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
371 if [[ -n "${bootstrap}" ]]; then
372 deployment_target
=10.6
376 # Build bootstrap clang if requested.
377 if [[ -n "${bootstrap}" ]]; then
378 ABS_INSTALL_DIR
="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}"
379 echo "Building bootstrap compiler"
380 mkdir
-p "${LLVM_BOOTSTRAP_DIR}"
381 pushd "${LLVM_BOOTSTRAP_DIR}"
384 -DCMAKE_BUILD_TYPE=Release \
385 -DLLVM_ENABLE_ASSERTIONS=ON \
386 -DLLVM_TARGETS_TO_BUILD=host \
387 -DLLVM_ENABLE_THREADS=OFF \
388 -DCMAKE_INSTALL_PREFIX="${ABS_INSTALL_DIR}" \
389 -DCMAKE_C_COMPILER="${CC}" \
390 -DCMAKE_CXX_COMPILER="${CXX}" \
391 -DCMAKE_C_FLAGS="${CFLAGS}" \
392 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
396 if [[ -n "${run_tests}" ]]; then
401 if [[ -n "${gcc_toolchain}" ]]; then
402 # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
403 # compiler can start.
404 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \
405 "${ABS_INSTALL_DIR}/lib/"
409 CC
="${ABS_INSTALL_DIR}/bin/clang"
410 CXX
="${ABS_INSTALL_DIR}/bin/clang++"
412 if [[ -n "${gcc_toolchain}" ]]; then
413 # Tell the bootstrap compiler to use a specific gcc prefix to search
414 # for standard library headers and shared object file.
415 CFLAGS
="--gcc-toolchain=${gcc_toolchain}"
416 CXXFLAGS
="--gcc-toolchain=${gcc_toolchain}"
419 echo "Building final compiler"
422 # Build clang (in a separate directory).
423 # The clang bots have this path hardcoded in built/scripts/slave/compile.py,
424 # so if you change it you also need to change these links.
425 mkdir
-p "${LLVM_BUILD_DIR}"
426 pushd "${LLVM_BUILD_DIR}"
428 # Build libc++.dylib while some bots are still on OS X 10.6.
429 if [ "${OS}" = "Darwin" ]; then
431 LIBCXXFLAGS
="-O3 -std=c++11 -fstrict-aliasing"
433 # libcxx and libcxxabi both have a file stdexcept.cpp, so put their .o files
434 # into different subdirectories.
435 mkdir
-p libcxxbuild
/libcxx
436 pushd libcxxbuild
/libcxx
437 ${CXX:-c++} -c ${CXXFLAGS} ${LIBCXXFLAGS} "${ABS_LIBCXX_DIR}"/src/*.cpp
440 mkdir -p libcxxbuild/libcxxabi
441 pushd libcxxbuild/libcxxabi
442 ${CXX:-c++} -c ${CXXFLAGS} ${LIBCXXFLAGS} "${ABS_LIBCXXABI_DIR}"/src/*.cpp -I"${ABS_LIBCXXABI_DIR}/include"
446 ${CC:-cc} libcxx
/*.o libcxxabi
/*.o
-o libc
++.1.dylib
-dynamiclib \
447 -nodefaultlibs -current_version 1 -compatibility_version 1 \
448 -lSystem -install_name @executable_path
/libc
++.dylib \
449 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib
/libc
++unexp.exp \
450 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib
/notweak.exp \
451 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib
/weak.exp
452 ln -sf libc
++.1.dylib libc
++.dylib
454 LDFLAGS
+="-stdlib=libc++ -L${PWD}/libcxxbuild"
457 rm -fv CMakeCache.txt
458 MACOSX_DEPLOYMENT_TARGET
=${deployment_target} cmake
-GNinja \
459 -DCMAKE_BUILD_TYPE=Release \
460 -DLLVM_ENABLE_ASSERTIONS=ON \
461 -DLLVM_ENABLE_THREADS=OFF \
462 -DCMAKE_C_COMPILER="${CC}" \
463 -DCMAKE_CXX_COMPILER="${CXX}" \
464 -DCMAKE_C_FLAGS="${CFLAGS}" \
465 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
466 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
467 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
468 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
472 if [[ -n "${gcc_toolchain}" ]]; then
473 # Copy in the right stdlibc++.so.6 so clang can start.
475 cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" lib
/
481 if [ "${OS}" = "Darwin" ]; then
482 # See http://crbug.com/256342
485 cp libcxxbuild
/libc
++.1.dylib bin
/
487 strip
${STRIP_FLAGS} bin
/clang
490 # Build compiler-rt out-of-tree.
491 mkdir
-p "${COMPILER_RT_BUILD_DIR}"
492 pushd "${COMPILER_RT_BUILD_DIR}"
494 rm -fv CMakeCache.txt
495 MACOSX_DEPLOYMENT_TARGET
=${deployment_target} cmake
-GNinja \
496 -DCMAKE_BUILD_TYPE=Release \
497 -DLLVM_ENABLE_ASSERTIONS=ON \
498 -DLLVM_ENABLE_THREADS=OFF \
499 -DCMAKE_C_COMPILER="${CC}" \
500 -DCMAKE_CXX_COMPILER="${CXX}" \
501 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
502 "${ABS_COMPILER_RT_DIR}"
506 # Copy selected output to the main tree.
507 # Darwin doesn't support cp --parents, so pipe through tar instead.
508 CLANG_VERSION
=$
("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \
509 sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p')
510 ABS_LLVM_CLANG_LIB_DIR
="${ABS_LLVM_BUILD_DIR}/lib/clang/${CLANG_VERSION}"
511 tar -c *blacklist.txt |
tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
512 tar -c include
/sanitizer |
tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
513 if [[ "${OS}" = "Darwin" ]]; then
514 tar -c lib
/darwin |
tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
516 tar -c lib
/linux |
tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
521 if [[ -n "${with_android}" ]]; then
522 # Make a standalone Android toolchain.
523 ${ANDROID_NDK_DIR}/build
/tools
/make-standalone-toolchain.sh \
524 --platform=android-14 \
525 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
526 --system=linux-x86_64 \
529 # Android NDK r9d copies a broken unwind.h into the toolchain, see
530 # http://crbug.com/357890
531 rm -v "${LLVM_BUILD_DIR}"/android-toolchain
/include
/c
++/*/unwind.h
533 # Build ASan runtime for Android in a separate build tree.
534 mkdir
-p ${LLVM_BUILD_DIR}/android
535 pushd ${LLVM_BUILD_DIR}/android
536 rm -fv CMakeCache.txt
537 MACOSX_DEPLOYMENT_TARGET
=${deployment_target} cmake
-GNinja \
538 -DCMAKE_BUILD_TYPE=Release \
539 -DLLVM_ENABLE_ASSERTIONS=ON \
540 -DLLVM_ENABLE_THREADS=OFF \
541 -DCMAKE_C_COMPILER=${PWD}/..
/bin
/clang \
542 -DCMAKE_CXX_COMPILER=${PWD}/..
/bin
/clang
++ \
543 -DLLVM_CONFIG_PATH=${PWD}/..
/bin
/llvm-config \
544 -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
545 -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
547 "${ABS_COMPILER_RT_DIR}"
548 ninja clang_rt.asan-arm-android
550 # And copy it into the main build tree.
551 cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
555 # Build Chrome-specific clang tools. Paths in this list should be relative to
557 TOOL_SRC_DIR
="${PWD}/${THIS_DIR}/../"
558 TOOL_BUILD_DIR
="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-extras"
560 rm -rf "${TOOL_BUILD_DIR}"
561 mkdir
-p "${TOOL_BUILD_DIR}"
562 pushd "${TOOL_BUILD_DIR}"
563 rm -fv CMakeCache.txt
564 MACOSX_DEPLOYMENT_TARGET
=${deployment_target} cmake
-GNinja \
565 -DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \
566 -DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \
567 -DCMAKE_C_COMPILER="${CC}" \
568 -DCMAKE_CXX_COMPILER="${CXX}" \
569 -DCMAKE_C_FLAGS="${CFLAGS}" \
570 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
571 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
572 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
573 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
574 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \
575 -DCHROMIUM_TOOLS="${chrome_tools}" \
578 ninja
-C "${TOOL_BUILD_DIR}" install
580 if [[ -n "$run_tests" ]]; then
581 # Run Chrome tool tests.
582 ninja
-C "${TOOL_BUILD_DIR}" check-all
583 # Run the LLVM and Clang tests.
584 ninja
-C "${LLVM_BUILD_DIR}" check-all
587 # After everything is done, log success for this revision.
588 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"