Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: tools/clang/scripts/update.sh

Issue 583143002: Build clang tools using CMake (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/Makefile ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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=216630 11 CLANG_REVISION=216630
12 12
13 THIS_DIR="$(dirname "${0}")" 13 THIS_DIR="$(dirname "${0}")"
14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" 14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts"
16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" 16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt"
17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" 17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" 18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
19 CLANG_DIR="${LLVM_DIR}/tools/clang" 19 CLANG_DIR="${LLVM_DIR}/tools/clang"
20 CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra"
21 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt" 20 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt"
22 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" 21 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
23 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" 22 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi"
24 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk" 23 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk"
25 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision" 24 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
26 25
27 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" 26 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}"
28 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" 27 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}"
29 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" 28 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}"
30 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" 29 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}"
(...skipping 21 matching lines...) Expand all
52 set -eu 51 set -eu
53 52
54 OS="$(uname -s)" 53 OS="$(uname -s)"
55 54
56 # Parse command line options. 55 # Parse command line options.
57 if_needed= 56 if_needed=
58 force_local_build= 57 force_local_build=
59 run_tests= 58 run_tests=
60 bootstrap= 59 bootstrap=
61 with_android=yes 60 with_android=yes
62 chrome_tools="plugins blink_gc_plugin" 61 chrome_tools="plugins;blink_gc_plugin"
63 gcc_toolchain= 62 gcc_toolchain=
64 63
65 if [[ "${OS}" = "Darwin" ]]; then 64 if [[ "${OS}" = "Darwin" ]]; then
66 with_android= 65 with_android=
67 fi 66 fi
68 67
69 while [[ $# > 0 ]]; do 68 while [[ $# > 0 ]]; do
70 case $1 in 69 case $1 in
71 --bootstrap) 70 --bootstrap)
72 bootstrap=yes 71 bootstrap=yes
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 111
113 --help) 112 --help)
114 echo "usage: $0 [--force-local-build] [--if-needed] [--run-tests] " 113 echo "usage: $0 [--force-local-build] [--if-needed] [--run-tests] "
115 echo "--bootstrap: First build clang with CC, then with itself." 114 echo "--bootstrap: First build clang with CC, then with itself."
116 echo "--force-local-build: Don't try to download prebuilt binaries." 115 echo "--force-local-build: Don't try to download prebuilt binaries."
117 echo "--if-needed: Download clang only if the script thinks it is needed." 116 echo "--if-needed: Download clang only if the script thinks it is needed."
118 echo "--run-tests: Run tests after building. Only for local builds." 117 echo "--run-tests: Run tests after building. Only for local builds."
119 echo "--print-revision: Print current clang revision and exit." 118 echo "--print-revision: Print current clang revision and exit."
120 echo "--without-android: Don't build ASan Android runtime library." 119 echo "--without-android: Don't build ASan Android runtime library."
121 echo "--with-chrome-tools: Select which chrome tools to build." \ 120 echo "--with-chrome-tools: Select which chrome tools to build." \
122 "Defaults to plugins." 121 "Defaults to plugins;blink_gc_plugin."
123 echo " Example: --with-chrome-tools 'plugins empty-string'" 122 echo " Example: --with-chrome-tools plugins;empty-string"
124 echo "--gcc-toolchain: Set the prefix for which GCC version should" 123 echo "--gcc-toolchain: Set the prefix for which GCC version should"
125 echo " be used for building. For example, to use gcc in" 124 echo " be used for building. For example, to use gcc in"
126 echo " /opt/foo/bin/gcc, use '--gcc-toolchain '/opt/foo" 125 echo " /opt/foo/bin/gcc, use '--gcc-toolchain '/opt/foo"
127 echo 126 echo
128 exit 1 127 exit 1
129 ;; 128 ;;
130 *) 129 *)
131 echo "Unknown argument: '$1'." 130 echo "Unknown argument: '$1'."
132 echo "Use --help for help." 131 echo "Use --help for help."
133 exit 1 132 exit 1
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 "${ABS_COMPILER_RT_DIR}" 539 "${ABS_COMPILER_RT_DIR}"
541 ninja clang_rt.asan-arm-android 540 ninja clang_rt.asan-arm-android
542 541
543 # And copy it into the main build tree. 542 # And copy it into the main build tree.
544 cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/ lib/linux/" 543 cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/ lib/linux/"
545 popd 544 popd
546 fi 545 fi
547 546
548 # Build Chrome-specific clang tools. Paths in this list should be relative to 547 # Build Chrome-specific clang tools. Paths in this list should be relative to
549 # tools/clang. 548 # tools/clang.
550 # For each tool directory, copy it into the clang tree and use clang's build 549 TOOL_SRC_DIR="${PWD}/${THIS_DIR}/../"
551 # system to compile it. 550 TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-extras"
552 for CHROME_TOOL_DIR in ${chrome_tools}; do
553 TOOL_SRC_DIR="${PWD}/${THIS_DIR}/../${CHROME_TOOL_DIR}"
554 TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_D IR}"
555 551
556 rm -rf "${TOOL_BUILD_DIR}" 552 rm -rf "${TOOL_BUILD_DIR}"
557 mkdir -p "${TOOL_BUILD_DIR}" 553 mkdir -p "${TOOL_BUILD_DIR}"
558 pushd "${TOOL_BUILD_DIR}" 554 pushd "${TOOL_BUILD_DIR}"
559 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \ 555 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
560 -DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \ 556 -DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \
561 -DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \ 557 -DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \
562 -DCMAKE_C_COMPILER="${CC}" \ 558 -DCMAKE_C_COMPILER="${CC}" \
563 -DCMAKE_CXX_COMPILER="${CXX}" \ 559 -DCMAKE_CXX_COMPILER="${CXX}" \
564 -DCMAKE_C_FLAGS="${CFLAGS}" \ 560 -DCMAKE_C_FLAGS="${CFLAGS}" \
565 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ 561 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
566 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ 562 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
567 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ 563 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
568 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ 564 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
569 "${TOOL_SRC_DIR}" 565 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \
570 ninja 566 -DCHROMIUM_TOOLS="${chrome_tools}" \
571 cp -v "${TOOL_BUILD_DIR}/lib"/* "${ABS_LLVM_BUILD_DIR}/lib/" 567 "${TOOL_SRC_DIR}"
572 popd 568 popd
573 done 569 ninja -C "${TOOL_BUILD_DIR}" install
574 570
575 if [[ -n "$run_tests" ]]; then 571 if [[ -n "$run_tests" ]]; then
576 # Run the tests for each chrome tool. 572 # Run Chrome tool tests.
577 for CHROME_TOOL_DIR in ${chrome_tools}; do 573 ninja -C "${TOOL_BUILD_DIR}" check-all
578 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}"
579 TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL _DIR}"
580 LIBNAME=$(basename $(ls "${TOOL_BUILD_DIR}/lib/"))
581 if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then
582 "${TOOL_SRC_DIR}/tests/test.sh" "${ABS_LLVM_BUILD_DIR}/bin/clang" \
583 "${ABS_LLVM_BUILD_DIR}/lib/${LIBNAME}"
584 fi
585 done
586 # Run the LLVM and Clang tests. 574 # Run the LLVM and Clang tests.
587 ninja -C "${LLVM_BUILD_DIR}" check-all 575 ninja -C "${LLVM_BUILD_DIR}" check-all
588 fi 576 fi
589 577
590 # After everything is done, log success for this revision. 578 # After everything is done, log success for this revision.
591 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 579 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
OLDNEW
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/Makefile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698