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 22 matching lines...) Expand all Loading... | |
33 # Parse command line options. | 33 # Parse command line options. |
34 force_local_build= | 34 force_local_build= |
35 mac_only= | 35 mac_only= |
36 run_tests= | 36 run_tests= |
37 bootstrap= | 37 bootstrap= |
38 with_android=yes | 38 with_android=yes |
39 # Temporary workaround for http://crbug.com/170629: use older Clang for ASan | 39 # Temporary workaround for http://crbug.com/170629: use older Clang for ASan |
40 # Mac builders. | 40 # Mac builders. |
41 is_asan_mac_builder_hackfix= | 41 is_asan_mac_builder_hackfix= |
42 with_tools_extra= | 42 with_tools_extra= |
43 chrome_tools="plugins" | |
44 | |
43 if [[ "${OS}" = "Darwin" ]]; then | 45 if [[ "${OS}" = "Darwin" ]]; then |
44 with_android= | 46 with_android= |
45 fi | 47 fi |
46 | 48 |
47 while [[ $# > 0 ]]; do | 49 while [[ $# > 0 ]]; do |
48 case $1 in | 50 case $1 in |
49 --bootstrap) | 51 --bootstrap) |
50 bootstrap=yes | 52 bootstrap=yes |
51 ;; | 53 ;; |
52 --force-local-build) | 54 --force-local-build) |
53 force_local_build=yes | 55 force_local_build=yes |
54 ;; | 56 ;; |
55 --mac-only) | 57 --mac-only) |
56 mac_only=yes | 58 mac_only=yes |
57 ;; | 59 ;; |
58 --run-tests) | 60 --run-tests) |
59 run_tests=yes | 61 run_tests=yes |
60 ;; | 62 ;; |
61 --without-android) | 63 --without-android) |
62 with_android= | 64 with_android= |
63 ;; | 65 ;; |
64 # Temporary workaround for http://crbug.com/170629 - use older Clang for | 66 # Temporary workaround for http://crbug.com/170629 - use older Clang for |
65 # ASan Mac builders. | 67 # ASan Mac builders. |
66 --is-asan-mac-builder-hackfix) | 68 --is-asan-mac-builder-hackfix) |
67 is_asan_mac_builder_hackfix=yes | 69 is_asan_mac_builder_hackfix=yes |
68 ;; | 70 ;; |
69 --with-tools-extra) | 71 --with-tools-extra) |
70 with_tools_extra=yes | 72 with_tools_extra=yes |
71 ;; | 73 ;; |
74 --with-chrome-tools) | |
75 shift | |
76 if [[ $# == 0 ]]; then | |
77 echo "--with-chrome-tools requires an argument." | |
78 exit 1 | |
79 fi | |
80 chrome_tools=$1 | |
81 ;; | |
72 --help) | 82 --help) |
73 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " | 83 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
74 echo "--bootstrap: First build clang with CC, then with itself." | 84 echo "--bootstrap: First build clang with CC, then with itself." |
75 echo "--force-local-build: Don't try to download prebuilt binaries." | 85 echo "--force-local-build: Don't try to download prebuilt binaries." |
76 echo "--mac-only: Do initial download only on Mac systems." | 86 echo "--mac-only: Do initial download only on Mac systems." |
77 echo "--run-tests: Run tests after building. Only for local builds." | 87 echo "--run-tests: Run tests after building. Only for local builds." |
78 echo "--without-android: Don't build ASan Android runtime library." | 88 echo "--without-android: Don't build ASan Android runtime library." |
79 echo "--is-asan-mac-builder-hackfix: Use older Clang" \ | 89 echo "--is-asan-mac-builder-hackfix: Use older Clang" \ |
80 "to build ASan on Mac." | 90 "to build ASan on Mac." |
81 echo "--with-tools-extra: Also build the clang-tools-extra repository." | 91 echo "--with-tools-extra: Also build the clang-tools-extra repository." |
92 echo "--with-chrome-tools: Select which chrome tools to build." \ | |
93 "Defaults to plugins." | |
Nico
2013/03/29 22:30:36
Maybe list `--with-chrome-tools='plugins empty-str
dcheng
2013/03/29 22:42:55
Done.
| |
94 echo | |
82 exit 1 | 95 exit 1 |
83 ;; | 96 ;; |
84 esac | 97 esac |
85 shift | 98 shift |
86 done | 99 done |
87 | 100 |
88 # Are we on a Chrome buildbot running ASan? | 101 # Are we on a Chrome buildbot running ASan? |
89 function on_asan_mac_host { | 102 function on_asan_mac_host { |
90 if [[ "${OS}" != "Darwin" ]]; then | 103 if [[ "${OS}" != "Darwin" ]]; then |
91 return 1 | 104 return 1 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 fi | 381 fi |
369 | 382 |
370 # Build ASan runtime for Android. | 383 # Build ASan runtime for Android. |
371 cd "${LLVM_BUILD_DIR}" | 384 cd "${LLVM_BUILD_DIR}" |
372 make -C tools/clang/runtime/ LLVM_ANDROID_TOOLCHAIN_DIR="../../../../${TC}" | 385 make -C tools/clang/runtime/ LLVM_ANDROID_TOOLCHAIN_DIR="../../../../${TC}" |
373 cd - | 386 cd - |
374 fi | 387 fi |
375 | 388 |
376 # Build Chrome-specific clang tools. Paths in this list should be relative to | 389 # Build Chrome-specific clang tools. Paths in this list should be relative to |
377 # tools/clang. | 390 # tools/clang. |
378 CHROME_TOOL_DIRS="plugins" | |
379 # For each tool directory, copy it into the clang tree and use clang's build | 391 # For each tool directory, copy it into the clang tree and use clang's build |
380 # system to compile it. | 392 # system to compile it. |
381 for CHROME_TOOL_DIR in ${CHROME_TOOL_DIRS}; do | 393 for CHROME_TOOL_DIR in ${chrome_tools}; do |
382 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" | 394 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" |
383 TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" | 395 TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" |
384 TOOL_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" | 396 TOOL_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" |
385 rm -rf "${TOOL_DST_DIR}" | 397 rm -rf "${TOOL_DST_DIR}" |
386 cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}" | 398 cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}" |
387 rm -rf "${TOOL_BUILD_DIR}" | 399 rm -rf "${TOOL_BUILD_DIR}" |
388 mkdir -p "${TOOL_BUILD_DIR}" | 400 mkdir -p "${TOOL_BUILD_DIR}" |
389 cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}" | 401 cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}" |
390 MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}" | 402 MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}" |
391 done | 403 done |
392 | 404 |
393 if [[ -n "$run_tests" ]]; then | 405 if [[ -n "$run_tests" ]]; then |
394 # Run a few tests. | 406 # Run a few tests. |
395 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" | 407 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" |
396 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 408 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
397 cd "${LLVM_BUILD_DIR}" | 409 cd "${LLVM_BUILD_DIR}" |
398 make check-all | 410 make check-all |
399 cd - | 411 cd - |
400 fi | 412 fi |
401 | 413 |
402 # After everything is done, log success for this revision. | 414 # After everything is done, log success for this revision. |
403 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 415 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
OLD | NEW |