OLD | NEW |
---|---|
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This script will check out llvm and clang into third_party/llvm and build it. | 6 # This script will check out llvm and clang into third_party/llvm and build it. |
7 | 7 |
8 # Do NOT CHANGE this if you don't know what you're doing -- see | 8 # Do NOT CHANGE this if you don't know what you're doing -- see |
9 # https://code.google.com/p/chromium/wiki/UpdatingClang | 9 # https://code.google.com/p/chromium/wiki/UpdatingClang |
10 # Reverting problematic clang rolls is safe, though. | 10 # Reverting problematic clang rolls is safe, though. |
11 CLANG_REVISION=247874 | 11 CLANG_REVISION=254049 |
12 | 12 |
13 # This is incremented when pushing a new build of Clang at the same revision. | 13 # This is incremented when pushing a new build of Clang at the same revision. |
14 CLANG_SUB_REVISION=1 | 14 CLANG_SUB_REVISION=1 |
15 | 15 |
16 PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}" | 16 PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}" |
17 | 17 |
18 THIS_DIR="$(dirname "${0}")" | 18 THIS_DIR="$(dirname "${0}")" |
19 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 19 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
20 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" | 20 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" |
21 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" | 21 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 fi | 525 fi |
526 | 526 |
527 | 527 |
528 # If building at head, define a macro that plugins can use for #ifdefing | 528 # If building at head, define a macro that plugins can use for #ifdefing |
529 # out code that builds at head, but not at CLANG_REVISION or vice versa. | 529 # out code that builds at head, but not at CLANG_REVISION or vice versa. |
530 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then | 530 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then |
531 CFLAGS="${CFLAGS} -DLLVM_FORCE_HEAD_REVISION" | 531 CFLAGS="${CFLAGS} -DLLVM_FORCE_HEAD_REVISION" |
532 CXXFLAGS="${CXXFLAGS} -DLLVM_FORCE_HEAD_REVISION" | 532 CXXFLAGS="${CXXFLAGS} -DLLVM_FORCE_HEAD_REVISION" |
533 fi | 533 fi |
534 | 534 |
535 # Pin MSan to the old ABI. | |
536 # TODO: revert this when instrumented libraries can be rebuilt with the new ABI. | |
Nico
2015/11/25 15:26:02
eugenis already filed a tracking bug for this that
hans
2015/11/25 17:55:13
Done.
| |
537 CXXFLAGS="${CXXFLAGS} -DMSAN_LINUX_X86_64_OLD_MAPPING" | |
538 | |
535 # Hook the Chromium tools into the LLVM build. Several Chromium tools have | 539 # Hook the Chromium tools into the LLVM build. Several Chromium tools have |
536 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools | 540 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools |
537 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to | 541 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to |
538 # the real directory for the Chromium tools. | 542 # the real directory for the Chromium tools. |
539 # Note that the shim directory name intentionally has no _ or _. The implicit | 543 # Note that the shim directory name intentionally has no _ or _. The implicit |
540 # tool detection logic munges them in a weird way. | 544 # tool detection logic munges them in a weird way. |
541 mkdir -v ${CHROME_TOOLS_SHIM_DIR} | 545 mkdir -v ${CHROME_TOOLS_SHIM_DIR} |
542 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF | 546 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF |
543 # Since tools/clang isn't actually a subdirectory, use the two argument version | 547 # Since tools/clang isn't actually a subdirectory, use the two argument version |
544 # to specify where build artifacts go. CMake doesn't allow reusing the same | 548 # to specify where build artifacts go. CMake doesn't allow reusing the same |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 strip ${STRIP_FLAGS} bin/clang | 592 strip ${STRIP_FLAGS} bin/clang |
589 popd | 593 popd |
590 | 594 |
591 # Build compiler-rt out-of-tree. | 595 # Build compiler-rt out-of-tree. |
592 # Do a clobbered build due to cmake changes. | 596 # Do a clobbered build due to cmake changes. |
593 rm -rf "${COMPILER_RT_BUILD_DIR}" | 597 rm -rf "${COMPILER_RT_BUILD_DIR}" |
594 mkdir -p "${COMPILER_RT_BUILD_DIR}" | 598 mkdir -p "${COMPILER_RT_BUILD_DIR}" |
595 pushd "${COMPILER_RT_BUILD_DIR}" | 599 pushd "${COMPILER_RT_BUILD_DIR}" |
596 | 600 |
597 rm -fv CMakeCache.txt | 601 rm -fv CMakeCache.txt |
598 MACOSX_DEPLOYMENT_TARGET=${deployment_target} CC="" CXX="" cmake -GNinja \ | 602 if [[ -z "${bootstrap}" ]]; then |
603 # compiler_rt doesn't build with Xcode 6's clang, but not all bots have | |
604 # Xcode 7 yet. So use the just-built clang for building compiler-rt. | |
605 # However, in bootstrap builds, we delete libc++ to work around PR24068 -- so | |
606 # compiler_rt's CMake checks can't find <iostream> and decide that no arch | |
607 # is supported. So use the installed bootstrap compiler in bootstrap builds, | |
608 # it has the libc++ headers installed (CXX is already set to that in | |
609 # bootstrap builds). | |
610 CC="${ABS_LLVM_BUILD_DIR}/bin/clang" | |
611 CXX="${ABS_LLVM_BUILD_DIR}/bin/clang++" | |
612 elif [[ "${OS}" = "Darwin" ]]; then | |
613 # ...except that compiler-rt currently doesn't build with the bootstrap | |
614 # compiler on Darwin either! So use the system compiler there. | |
615 # TOOD(thakis): Remove this once http://llvm.org/PR25465 is fixed. | |
616 CC=cc | |
617 CXX=c++ | |
618 fi | |
619 | |
620 # Pin MSan to the old ABI. | |
621 COMPILER_RT_CXXFLAGS="-DMSAN_LINUX_X86_64_OLD_MAPPING" | |
622 | |
623 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ | |
599 -DCMAKE_BUILD_TYPE=Release \ | 624 -DCMAKE_BUILD_TYPE=Release \ |
600 -DLLVM_ENABLE_ASSERTIONS=ON \ | 625 -DLLVM_ENABLE_ASSERTIONS=ON \ |
601 -DLLVM_ENABLE_THREADS=OFF \ | 626 -DLLVM_ENABLE_THREADS=OFF \ |
602 -DCMAKE_C_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang" \ | 627 -DCMAKE_C_COMPILER="${CC}" \ |
603 -DCMAKE_CXX_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang++" \ | 628 -DCMAKE_CXX_COMPILER="${CXX}" \ |
629 -DCMAKE_CXX_FLAGS="${COMPILER_RT_CXXFLAGS}" \ | |
604 -DSANITIZER_MIN_OSX_VERSION="10.7" \ | 630 -DSANITIZER_MIN_OSX_VERSION="10.7" \ |
605 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \ | 631 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \ |
606 "${ABS_COMPILER_RT_DIR}" | 632 "${ABS_COMPILER_RT_DIR}" |
607 | 633 |
608 ninja | 634 ninja |
609 | 635 |
610 # Copy selected output to the main tree. | 636 # Copy selected output to the main tree. |
611 # Darwin doesn't support cp --parents, so pipe through tar instead. | 637 # Darwin doesn't support cp --parents, so pipe through tar instead. |
612 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \ | 638 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \ |
613 sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p') | 639 sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p') |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 # Run Chrome tool tests. | 705 # Run Chrome tool tests. |
680 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 706 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
681 fi | 707 fi |
682 if [[ -n "$run_tests" ]]; then | 708 if [[ -n "$run_tests" ]]; then |
683 # Run the LLVM and Clang tests. | 709 # Run the LLVM and Clang tests. |
684 ninja -C "${LLVM_BUILD_DIR}" check-all | 710 ninja -C "${LLVM_BUILD_DIR}" check-all |
685 fi | 711 fi |
686 | 712 |
687 # After everything is done, log success for this revision. | 713 # After everything is done, log success for this revision. |
688 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 714 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
OLD | NEW |