| 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. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | 44 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang |
| 43 | 45 |
| 44 if [[ -z "$GYP_DEFINES" ]]; then | 46 if [[ -z "$GYP_DEFINES" ]]; then |
| 45 GYP_DEFINES= | 47 GYP_DEFINES= |
| 46 fi | 48 fi |
| 47 if [[ -z "$GYP_GENERATORS" ]]; then | 49 if [[ -z "$GYP_GENERATORS" ]]; then |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 -nodefaultlibs -current_version 1 -compatibility_version 1 \ | 538 -nodefaultlibs -current_version 1 -compatibility_version 1 \ |
| 537 -lSystem -install_name @executable_path/libc++.dylib \ | 539 -lSystem -install_name @executable_path/libc++.dylib \ |
| 538 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ | 540 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ |
| 539 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ | 541 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ |
| 540 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp | 542 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp |
| 541 ln -sf libc++.1.dylib libc++.dylib | 543 ln -sf libc++.1.dylib libc++.dylib |
| 542 popd | 544 popd |
| 543 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" | 545 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" |
| 544 fi | 546 fi |
| 545 | 547 |
| 548 # Find the binutils include dir for the gold plugin. |
| 549 BINUTILS_INCDIR="" |
| 550 if [ "${OS}" = "Linux" ]; then |
| 551 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" |
| 552 fi |
| 553 |
| 546 # Hook the Chromium tools into the LLVM build. Several Chromium tools have | 554 # Hook the Chromium tools into the LLVM build. Several Chromium tools have |
| 547 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools | 555 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools |
| 548 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to | 556 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to |
| 549 # the real directory for the Chromium tools. | 557 # the real directory for the Chromium tools. |
| 550 # Note that the shim directory name intentionally has no _ or _. The implicit | 558 # Note that the shim directory name intentionally has no _ or _. The implicit |
| 551 # tool detection logic munges them in a weird way. | 559 # tool detection logic munges them in a weird way. |
| 552 mkdir -v ${CHROME_TOOLS_SHIM_DIR} | 560 mkdir -v ${CHROME_TOOLS_SHIM_DIR} |
| 553 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF | 561 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF |
| 554 # Since tools/clang isn't actually a subdirectory, use the two argument version | 562 # Since tools/clang isn't actually a subdirectory, use the two argument version |
| 555 # to specify where build artifacts go. CMake doesn't allow reusing the same | 563 # to specify where build artifacts go. CMake doesn't allow reusing the same |
| 556 # binary dir for multiple source dirs, so the build artifacts have to go into a | 564 # binary dir for multiple source dirs, so the build artifacts have to go into a |
| 557 # subdirectory... | 565 # subdirectory... |
| 558 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) | 566 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) |
| 559 EOF | 567 EOF |
| 560 rm -fv CMakeCache.txt | 568 rm -fv CMakeCache.txt |
| 561 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ | 569 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ |
| 562 -DCMAKE_BUILD_TYPE=Release \ | 570 -DCMAKE_BUILD_TYPE=Release \ |
| 563 -DLLVM_ENABLE_ASSERTIONS=ON \ | 571 -DLLVM_ENABLE_ASSERTIONS=ON \ |
| 564 -DLLVM_ENABLE_THREADS=OFF \ | 572 -DLLVM_ENABLE_THREADS=OFF \ |
| 573 -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \ |
| 565 -DCMAKE_C_COMPILER="${CC}" \ | 574 -DCMAKE_C_COMPILER="${CC}" \ |
| 566 -DCMAKE_CXX_COMPILER="${CXX}" \ | 575 -DCMAKE_CXX_COMPILER="${CXX}" \ |
| 567 -DCMAKE_C_FLAGS="${CFLAGS}" \ | 576 -DCMAKE_C_FLAGS="${CFLAGS}" \ |
| 568 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ | 577 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ |
| 569 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ | 578 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ |
| 570 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ | 579 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ |
| 571 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ | 580 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ |
| 572 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ | 581 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ |
| 573 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ | 582 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ |
| 574 -DCHROMIUM_TOOLS="${chrome_tools}" \ | 583 -DCHROMIUM_TOOLS="${chrome_tools}" \ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 | 674 |
| 666 if [[ -n "$run_tests" ]]; then | 675 if [[ -n "$run_tests" ]]; then |
| 667 # Run Chrome tool tests. | 676 # Run Chrome tool tests. |
| 668 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 677 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
| 669 # Run the LLVM and Clang tests. | 678 # Run the LLVM and Clang tests. |
| 670 ninja -C "${LLVM_BUILD_DIR}" check-all | 679 ninja -C "${LLVM_BUILD_DIR}" check-all |
| 671 fi | 680 fi |
| 672 | 681 |
| 673 # After everything is done, log success for this revision. | 682 # After everything is done, log success for this revision. |
| 674 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 683 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
| OLD | NEW |