| 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=230914 | 11 CLANG_REVISION=230914 |
| 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=2 |
| 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" |
| 22 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" | 22 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" |
| 23 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" | 23 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" |
| 24 CLANG_DIR="${LLVM_DIR}/tools/clang" | 24 CLANG_DIR="${LLVM_DIR}/tools/clang" |
| 25 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" | 25 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" |
| 26 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" | 26 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" |
| 27 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" | 27 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" |
| 28 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" | 28 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" |
| 29 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" | 29 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" |
| 30 CHROMIUM_TOOLS_DIR="${THIS_DIR}/.." | 30 CHROMIUM_TOOLS_DIR="${THIS_DIR}/.." |
| 31 BINUTILS_DIR="${THIS_DIR}/../../../third_party/binutils" |
| 31 | 32 |
| 32 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" | 33 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" |
| 33 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" | 34 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" |
| 34 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" | 35 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" |
| 35 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" | 36 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" |
| 36 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" | 37 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" |
| 37 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" | 38 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" |
| 39 ABS_BINUTILS_DIR="${PWD}/${BINUTILS_DIR}" |
| 38 | 40 |
| 39 # ${A:-a} returns $A if it's set, a else. | 41 # ${A:-a} returns $A if it's set, a else. |
| 40 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 42 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
| 41 | 43 |
| 42 if [[ -z "$GYP_DEFINES" ]]; then | 44 if [[ -z "$GYP_DEFINES" ]]; then |
| 43 GYP_DEFINES= | 45 GYP_DEFINES= |
| 44 fi | 46 fi |
| 45 if [[ -z "$GYP_GENERATORS" ]]; then | 47 if [[ -z "$GYP_GENERATORS" ]]; then |
| 46 GYP_GENERATORS= | 48 GYP_GENERATORS= |
| 47 fi | 49 fi |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 -nodefaultlibs -current_version 1 -compatibility_version 1 \ | 507 -nodefaultlibs -current_version 1 -compatibility_version 1 \ |
| 506 -lSystem -install_name @executable_path/libc++.dylib \ | 508 -lSystem -install_name @executable_path/libc++.dylib \ |
| 507 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ | 509 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ |
| 508 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ | 510 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ |
| 509 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp | 511 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp |
| 510 ln -sf libc++.1.dylib libc++.dylib | 512 ln -sf libc++.1.dylib libc++.dylib |
| 511 popd | 513 popd |
| 512 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" | 514 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" |
| 513 fi | 515 fi |
| 514 | 516 |
| 517 # Find the binutils include dir for the gold plugin. |
| 518 BINUTILS_INCDIR="" |
| 519 if [ "${OS}" = "Linux" ]; then |
| 520 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" |
| 521 fi |
| 522 |
| 515 # Hook the Chromium tools into the LLVM build. Several Chromium tools have | 523 # Hook the Chromium tools into the LLVM build. Several Chromium tools have |
| 516 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools | 524 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools |
| 517 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to | 525 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to |
| 518 # the real directory for the Chromium tools. | 526 # the real directory for the Chromium tools. |
| 519 # Note that the shim directory name intentionally has no _ or _. The implicit | 527 # Note that the shim directory name intentionally has no _ or _. The implicit |
| 520 # tool detection logic munges them in a weird way. | 528 # tool detection logic munges them in a weird way. |
| 521 mkdir -v ${CHROME_TOOLS_SHIM_DIR} | 529 mkdir -v ${CHROME_TOOLS_SHIM_DIR} |
| 522 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF | 530 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF |
| 523 # Since tools/clang isn't actually a subdirectory, use the two argument version | 531 # Since tools/clang isn't actually a subdirectory, use the two argument version |
| 524 # to specify where build artifacts go. CMake doesn't allow reusing the same | 532 # to specify where build artifacts go. CMake doesn't allow reusing the same |
| 525 # binary dir for multiple source dirs, so the build artifacts have to go into a | 533 # binary dir for multiple source dirs, so the build artifacts have to go into a |
| 526 # subdirectory... | 534 # subdirectory... |
| 527 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) | 535 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) |
| 528 EOF | 536 EOF |
| 529 rm -fv CMakeCache.txt | 537 rm -fv CMakeCache.txt |
| 530 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ | 538 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ |
| 531 -DCMAKE_BUILD_TYPE=Release \ | 539 -DCMAKE_BUILD_TYPE=Release \ |
| 532 -DLLVM_ENABLE_ASSERTIONS=ON \ | 540 -DLLVM_ENABLE_ASSERTIONS=ON \ |
| 533 -DLLVM_ENABLE_THREADS=OFF \ | 541 -DLLVM_ENABLE_THREADS=OFF \ |
| 542 -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \ |
| 534 -DCMAKE_C_COMPILER="${CC}" \ | 543 -DCMAKE_C_COMPILER="${CC}" \ |
| 535 -DCMAKE_CXX_COMPILER="${CXX}" \ | 544 -DCMAKE_CXX_COMPILER="${CXX}" \ |
| 536 -DCMAKE_C_FLAGS="${CFLAGS}" \ | 545 -DCMAKE_C_FLAGS="${CFLAGS}" \ |
| 537 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ | 546 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ |
| 538 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ | 547 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ |
| 539 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ | 548 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ |
| 540 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ | 549 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ |
| 541 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ | 550 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ |
| 542 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ | 551 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ |
| 543 -DCHROMIUM_TOOLS="${chrome_tools}" \ | 552 -DCHROMIUM_TOOLS="${chrome_tools}" \ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 | 643 |
| 635 if [[ -n "$run_tests" ]]; then | 644 if [[ -n "$run_tests" ]]; then |
| 636 # Run Chrome tool tests. | 645 # Run Chrome tool tests. |
| 637 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 646 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
| 638 # Run the LLVM and Clang tests. | 647 # Run the LLVM and Clang tests. |
| 639 ninja -C "${LLVM_BUILD_DIR}" check-all | 648 ninja -C "${LLVM_BUILD_DIR}" check-all |
| 640 fi | 649 fi |
| 641 | 650 |
| 642 # After everything is done, log success for this revision. | 651 # After everything is done, log success for this revision. |
| 643 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 652 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
| OLD | NEW |