| 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=238013 | 11 CLANG_REVISION=247874 |
| 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=3 | 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" |
| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 42 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
| 43 | 43 |
| 44 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | 44 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang |
| 45 | 45 |
| 46 if [[ -z "$GYP_DEFINES" ]]; then | 46 if [[ -z "$GYP_DEFINES" ]]; then |
| 47 GYP_DEFINES= | 47 GYP_DEFINES= |
| 48 fi | 48 fi |
| 49 if [[ -z "$GYP_GENERATORS" ]]; then | 49 if [[ -z "$GYP_GENERATORS" ]]; then |
| 50 GYP_GENERATORS= | 50 GYP_GENERATORS= |
| 51 fi | 51 fi |
| 52 if [[ -z "$LLVM_DOWNLOAD_GOLD_PLUGIN" ]]; then |
| 53 LLVM_DOWNLOAD_GOLD_PLUGIN= |
| 54 fi |
| 52 | 55 |
| 56 if [[ "${OS}" == "Linux" ]] && \ |
| 57 [[ "$GYP_DEFINES" =~ .*buildtype=Official.* ]] && \ |
| 58 [[ "$GYP_DEFINES" =~ .*branding=Chrome.* ]] ; then |
| 59 # LLVM Gold plugin is required to build with this configuration. |
| 60 LLVM_DOWNLOAD_GOLD_PLUGIN=1 |
| 61 fi |
| 53 | 62 |
| 54 # Die if any command dies, error on undefined variable expansions. | 63 # Die if any command dies, error on undefined variable expansions. |
| 55 set -eu | 64 set -eu |
| 56 | 65 |
| 57 | 66 |
| 58 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then | 67 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then |
| 59 # Use a real revision number rather than HEAD to make sure that the stamp file | 68 # Use a real revision number rather than HEAD to make sure that the stamp file |
| 60 # logic works. | 69 # logic works. |
| 61 CLANG_REVISION=$(svn info "$LLVM_REPO_URL" \ | 70 CLANG_REVISION=$(svn info "$LLVM_REPO_URL" \ |
| 62 | grep 'Revision:' | awk '{ printf $2; }') | 71 | grep 'Revision:' | awk '{ printf $2; }') |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 fi | 234 fi |
| 226 | 235 |
| 227 | 236 |
| 228 # Check if there's anything to be done, exit early if not. | 237 # Check if there's anything to be done, exit early if not. |
| 229 if [[ -f "${STAMP_FILE}" ]]; then | 238 if [[ -f "${STAMP_FILE}" ]]; then |
| 230 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") | 239 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") |
| 231 if [[ -z "$force_local_build" ]] && \ | 240 if [[ -z "$force_local_build" ]] && \ |
| 232 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ | 241 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ |
| 233 "${PACKAGE_VERSION}" ]]; then | 242 "${PACKAGE_VERSION}" ]]; then |
| 234 echo "Clang already at ${PACKAGE_VERSION}" | 243 echo "Clang already at ${PACKAGE_VERSION}" |
| 235 exit 0 | 244 if [[ -z "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]] || \ |
| 245 [[ -f "${LLVM_BUILD_DIR}/lib/LLVMgold.so" ]]; then |
| 246 exit 0 |
| 247 fi |
| 236 fi | 248 fi |
| 237 fi | 249 fi |
| 238 # To always force a new build if someone interrupts their build half way. | 250 # To always force a new build if someone interrupts their build half way. |
| 239 rm -f "${STAMP_FILE}" | 251 rm -f "${STAMP_FILE}" |
| 240 | 252 |
| 241 | 253 |
| 242 if [[ -z "$force_local_build" ]]; then | 254 if [[ -z "$force_local_build" ]]; then |
| 243 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 255 # Check if there's a prebuilt binary and if so just fetch that. That's faster, |
| 244 # and goma relies on having matching binary hashes on client and server too. | 256 # and goma relies on having matching binary hashes on client and server too. |
| 245 CDS_FILE="clang-${PACKAGE_VERSION}.tgz" | 257 CDS_FILE="clang-${PACKAGE_VERSION}.tgz" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 260 echo "Neither curl nor wget found. Please install one of these." | 272 echo "Neither curl nor wget found. Please install one of these." |
| 261 exit 1 | 273 exit 1 |
| 262 fi | 274 fi |
| 263 if [ -f "${CDS_OUTPUT}" ]; then | 275 if [ -f "${CDS_OUTPUT}" ]; then |
| 264 rm -rf "${LLVM_BUILD_DIR}" | 276 rm -rf "${LLVM_BUILD_DIR}" |
| 265 mkdir -p "${LLVM_BUILD_DIR}" | 277 mkdir -p "${LLVM_BUILD_DIR}" |
| 266 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" | 278 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" |
| 267 echo clang "${PACKAGE_VERSION}" unpacked | 279 echo clang "${PACKAGE_VERSION}" unpacked |
| 268 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 280 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
| 269 rm -rf "${CDS_OUT_DIR}" | 281 rm -rf "${CDS_OUT_DIR}" |
| 282 # Download the gold plugin if requested to by an environment variable. |
| 283 # This is used by the CFI ClusterFuzz bot. |
| 284 if [[ -n "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]]; then |
| 285 ${THIS_DIR}/../../../build/download_gold_plugin.py |
| 286 fi |
| 270 exit 0 | 287 exit 0 |
| 271 else | 288 else |
| 272 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building | 289 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building |
| 273 fi | 290 fi |
| 274 fi | 291 fi |
| 275 | 292 |
| 276 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then | 293 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then |
| 277 echo "Android NDK not found at ${ANDROID_NDK_DIR}" | 294 echo "Android NDK not found at ${ANDROID_NDK_DIR}" |
| 278 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" | 295 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" |
| 279 echo "works on Android. See " | 296 echo "works on Android. See " |
| (...skipping 30 matching lines...) Expand all Loading... |
| 310 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ | 327 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ |
| 311 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ | 328 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ |
| 312 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ | 329 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ |
| 313 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ | 330 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ |
| 314 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ | 331 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ |
| 315 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ | 332 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ |
| 316 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ | 333 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ |
| 317 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ | 334 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ |
| 318 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \ | 335 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \ |
| 319 "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \ | 336 "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \ |
| 337 "${COMPILER_RT_DIR}/CMakeLists.txt" \ |
| 320 "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \ | 338 "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \ |
| 321 ; do | 339 ; do |
| 322 if [[ -e "${i}" ]]; then | 340 if [[ -e "${i}" ]]; then |
| 323 rm -f "${i}" # For unversioned files. | 341 rm -f "${i}" # For unversioned files. |
| 324 svn revert "${i}" | 342 svn revert "${i}" |
| 325 fi; | 343 fi; |
| 326 done | 344 done |
| 327 | 345 |
| 328 echo Remove the Clang tools shim dir | 346 echo Remove the Clang tools shim dir |
| 329 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools | 347 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools |
| (...skipping 28 matching lines...) Expand all Loading... |
| 358 | 376 |
| 359 # While we're bundling our own libc++ on OS X, we need to compile libc++abi | 377 # While we're bundling our own libc++ on OS X, we need to compile libc++abi |
| 360 # into it too (since OS X 10.6 doesn't have libc++abi.dylib either). | 378 # into it too (since OS X 10.6 doesn't have libc++abi.dylib either). |
| 361 if [ "${OS}" = "Darwin" ]; then | 379 if [ "${OS}" = "Darwin" ]; then |
| 362 echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}" | 380 echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}" |
| 363 svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \ | 381 svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \ |
| 364 "${LIBCXXABI_DIR}" | 382 "${LIBCXXABI_DIR}" |
| 365 fi | 383 fi |
| 366 | 384 |
| 367 if [[ -n "$with_patches" ]]; then | 385 if [[ -n "$with_patches" ]]; then |
| 368 | 386 # No patches. |
| 369 # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974) | 387 true |
| 370 pushd "${CLANG_DIR}" | |
| 371 cat << 'EOF' | | |
| 372 --- third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m» (revisio
n 202554) | |
| 373 +++ third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m» (working
copy) | |
| 374 @@ -12,6 +12,8 @@ | |
| 375 | |
| 376 // REQUIRES: crash-recovery | |
| 377 // REQUIRES: shell | |
| 378 +// XFAIL: * | |
| 379 +// (PR11974) | |
| 380 | |
| 381 @import Crash; | |
| 382 EOF | |
| 383 patch -p4 | |
| 384 popd | |
| 385 | |
| 386 pushd "${CLANG_DIR}" | |
| 387 cat << 'EOF' | | |
| 388 --- unittests/libclang/LibclangTest.cpp (revision 215949) | |
| 389 +++ unittests/libclang/LibclangTest.cpp (working copy) | |
| 390 @@ -431,7 +431,7 @@ | |
| 391 EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU)); | |
| 392 } | |
| 393 | |
| 394 -TEST_F(LibclangReparseTest, ReparseWithModule) { | |
| 395 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { | |
| 396 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; | |
| 397 const char *HeaderBottom = "\n};\n#endif\n"; | |
| 398 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" | |
| 399 EOF | |
| 400 patch -p0 | |
| 401 popd | |
| 402 | |
| 403 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21
552) | |
| 404 pushd "${LLVM_DIR}" | |
| 405 cat << 'EOF' | | |
| 406 Index: test/Bindings/Go/go.test | |
| 407 =================================================================== | |
| 408 --- test/Bindings/Go/go.test (revision 223109) | |
| 409 +++ test/Bindings/Go/go.test (working copy) | |
| 410 @@ -1,3 +1,3 @@ | |
| 411 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm | |
| 412 +; RUN: true | |
| 413 | |
| 414 ; REQUIRES: shell | |
| 415 EOF | |
| 416 patch -p0 | |
| 417 popd | |
| 418 | |
| 419 # The UBSan run-time, which is now bundled with the ASan run-time, doesn't wor
k | |
| 420 # on Mac OS X 10.8 (PR23539). | |
| 421 pushd "${COMPILER_RT_DIR}" | |
| 422 cat << 'EOF' | | |
| 423 --- a/cmake/config-ix.cmake | |
| 424 +++ b/cmake/config-ix.cmake | |
| 425 @@ -319,7 +319,7 @@ else() | |
| 426 endif() | |
| 427 | |
| 428 if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND | |
| 429 - OS_NAME MATCHES "Darwin|Linux|FreeBSD") | |
| 430 + OS_NAME MATCHES "Linux|FreeBSD") | |
| 431 set(COMPILER_RT_HAS_UBSAN TRUE) | |
| 432 else() | |
| 433 set(COMPILER_RT_HAS_UBSAN FALSE) | |
| 434 diff --git a/lib/ubsan/ubsan_platform.h b/lib/ubsan/ubsan_platform.h | |
| 435 index 8ba253b..d5dce8d 100644 | |
| 436 --- a/lib/ubsan/ubsan_platform.h | |
| 437 +++ b/lib/ubsan/ubsan_platform.h | |
| 438 @@ -14,7 +14,7 @@ | |
| 439 #define UBSAN_PLATFORM_H | |
| 440 | |
| 441 // Other platforms should be easy to add, and probably work as-is. | |
| 442 -#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \ | |
| 443 +#if (defined(__linux__) || defined(__FreeBSD__)) && \ | |
| 444 (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \ | |
| 445 defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__)) | |
| 446 # define CAN_SANITIZE_UB 1 | |
| 447 EOF | |
| 448 patch -p1 | |
| 449 popd | |
| 450 | |
| 451 fi | 388 fi |
| 452 | 389 |
| 453 # Echo all commands. | 390 # Echo all commands. |
| 454 set -x | 391 set -x |
| 455 | 392 |
| 456 # Set default values for CC and CXX if they're not set in the environment. | 393 # Set default values for CC and CXX if they're not set in the environment. |
| 457 CC=${CC:-cc} | 394 CC=${CC:-cc} |
| 458 CXX=${CXX:-c++} | 395 CXX=${CXX:-c++} |
| 459 | 396 |
| 460 if [[ -n "${gcc_toolchain}" ]]; then | 397 if [[ -n "${gcc_toolchain}" ]]; then |
| 461 # Use the specified gcc installation for building. | 398 # Use the specified gcc installation for building. |
| 462 CC="$gcc_toolchain/bin/gcc" | 399 CC="$gcc_toolchain/bin/gcc" |
| 463 CXX="$gcc_toolchain/bin/g++" | 400 CXX="$gcc_toolchain/bin/g++" |
| 464 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler, | 401 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler, |
| 465 # etc.) find the .so. | 402 # etc.) find the .so. |
| 466 export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))" | 403 export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))" |
| 467 fi | 404 fi |
| 468 | 405 |
| 469 CFLAGS="" | 406 CFLAGS="" |
| 470 CXXFLAGS="" | 407 CXXFLAGS="" |
| 471 LDFLAGS="" | 408 LDFLAGS="" |
| 472 | 409 |
| 473 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is | 410 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is |
| 474 # needed, on OS X it requires libc++. clang only automatically links to libc++ | 411 # needed, on OS X it requires libc++. clang only automatically links to libc++ |
| 475 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on | 412 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on |
| 476 # OS X versions as old as 10.7. | 413 # OS X versions as old as 10.7. |
| 477 # TODO(thakis): Some bots are still on 10.6, so for now bundle libc++.dylib. | 414 # TODO(thakis): Some bots are still on 10.6 (nacl...), so for now bundle |
| 478 # Remove this once all bots are on 10.7+, then use --enable-libcpp=yes and | 415 # libc++.dylib. Remove this once all bots are on 10.7+, then use |
| 479 # change deployment_target to 10.7. | 416 # -DLLVM_ENABLE_LIBCXX=ON and change deployment_target to 10.7. |
| 480 deployment_target="" | 417 deployment_target="" |
| 481 | 418 |
| 482 if [ "${OS}" = "Darwin" ]; then | 419 if [ "${OS}" = "Darwin" ]; then |
| 483 # When building on 10.9, /usr/include usually doesn't exist, and while | 420 # When building on 10.9, /usr/include usually doesn't exist, and while |
| 484 # Xcode's clang automatically sets a sysroot, self-built clangs don't. | 421 # Xcode's clang automatically sets a sysroot, self-built clangs don't. |
| 485 CFLAGS="-isysroot $(xcrun --show-sdk-path)" | 422 CFLAGS="-isysroot $(xcrun --show-sdk-path)" |
| 486 CPPFLAGS="${CFLAGS}" | |
| 487 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}" | 423 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}" |
| 488 | 424 |
| 489 if [[ -n "${bootstrap}" ]]; then | 425 if [[ -n "${bootstrap}" ]]; then |
| 490 deployment_target=10.6 | 426 deployment_target=10.6 |
| 491 fi | 427 fi |
| 492 fi | 428 fi |
| 493 | 429 |
| 494 # Build bootstrap clang if requested. | 430 # Build bootstrap clang if requested. |
| 495 if [[ -n "${bootstrap}" ]]; then | 431 if [[ -n "${bootstrap}" ]]; then |
| 496 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}" | 432 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 522 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \ | 458 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \ |
| 523 "${ABS_INSTALL_DIR}/lib/" | 459 "${ABS_INSTALL_DIR}/lib/" |
| 524 fi | 460 fi |
| 525 | 461 |
| 526 popd | 462 popd |
| 527 CC="${ABS_INSTALL_DIR}/bin/clang" | 463 CC="${ABS_INSTALL_DIR}/bin/clang" |
| 528 CXX="${ABS_INSTALL_DIR}/bin/clang++" | 464 CXX="${ABS_INSTALL_DIR}/bin/clang++" |
| 529 | 465 |
| 530 if [[ -n "${gcc_toolchain}" ]]; then | 466 if [[ -n "${gcc_toolchain}" ]]; then |
| 531 # Tell the bootstrap compiler to use a specific gcc prefix to search | 467 # Tell the bootstrap compiler to use a specific gcc prefix to search |
| 532 # for standard library headers and shared object file. | 468 # for standard library headers and shared object files. |
| 533 CFLAGS="--gcc-toolchain=${gcc_toolchain}" | 469 CFLAGS="--gcc-toolchain=${gcc_toolchain}" |
| 534 CXXFLAGS="--gcc-toolchain=${gcc_toolchain}" | 470 CXXFLAGS="--gcc-toolchain=${gcc_toolchain}" |
| 535 fi | 471 fi |
| 536 | 472 |
| 537 echo "Building final compiler" | 473 echo "Building final compiler" |
| 538 fi | 474 fi |
| 539 | 475 |
| 540 # Build clang (in a separate directory). | 476 # Build clang (in a separate directory). |
| 541 # The clang bots have this path hardcoded in built/scripts/slave/compile.py, | 477 # The clang bots have this path hardcoded in built/scripts/slave/compile.py, |
| 542 # so if you change it you also need to change these links. | 478 # so if you change it you also need to change these links. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 563 pushd libcxxbuild | 499 pushd libcxxbuild |
| 564 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ | 500 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ |
| 565 -nodefaultlibs -current_version 1 -compatibility_version 1 \ | 501 -nodefaultlibs -current_version 1 -compatibility_version 1 \ |
| 566 -lSystem -install_name @executable_path/libc++.dylib \ | 502 -lSystem -install_name @executable_path/libc++.dylib \ |
| 567 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ | 503 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ |
| 568 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ | 504 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ |
| 569 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp | 505 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp |
| 570 ln -sf libc++.1.dylib libc++.dylib | 506 ln -sf libc++.1.dylib libc++.dylib |
| 571 popd | 507 popd |
| 572 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" | 508 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" |
| 509 |
| 510 if [[ -n "${bootstrap}" ]]; then |
| 511 # Now that the libc++ headers have been installed and libc++.dylib is built, |
| 512 # delete the libc++ checkout again so that it's not part of the main |
| 513 # build below -- the libc++(abi) tests don't pass on OS X in bootstrap |
| 514 # builds (http://llvm.org/PR24068) |
| 515 rm -rf "${ABS_LIBCXX_DIR}" |
| 516 rm -rf "${ABS_LIBCXXABI_DIR}" |
| 517 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_INSTALL_DIR}/include/c++/v1 ${C
FLAGS}" |
| 518 fi |
| 573 fi | 519 fi |
| 574 | 520 |
| 575 # Find the binutils include dir for the gold plugin. | 521 # Find the binutils include dir for the gold plugin. |
| 576 BINUTILS_INCDIR="" | 522 BINUTILS_INCDIR="" |
| 577 if [ "${OS}" = "Linux" ]; then | 523 if [ "${OS}" = "Linux" ]; then |
| 578 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" | 524 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" |
| 579 fi | 525 fi |
| 580 | 526 |
| 581 | 527 |
| 582 # 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 598 # to specify where build artifacts go. CMake doesn't allow reusing the same | 544 # to specify where build artifacts go. CMake doesn't allow reusing the same |
| 599 # binary dir for multiple source dirs, so the build artifacts have to go into a | 545 # binary dir for multiple source dirs, so the build artifacts have to go into a |
| 600 # subdirectory... | 546 # subdirectory... |
| 601 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) | 547 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) |
| 602 EOF | 548 EOF |
| 603 rm -fv CMakeCache.txt | 549 rm -fv CMakeCache.txt |
| 604 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ | 550 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ |
| 605 -DCMAKE_BUILD_TYPE=Release \ | 551 -DCMAKE_BUILD_TYPE=Release \ |
| 606 -DLLVM_ENABLE_ASSERTIONS=ON \ | 552 -DLLVM_ENABLE_ASSERTIONS=ON \ |
| 607 -DLLVM_ENABLE_THREADS=OFF \ | 553 -DLLVM_ENABLE_THREADS=OFF \ |
| 554 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \ |
| 608 -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \ | 555 -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \ |
| 609 -DCMAKE_C_COMPILER="${CC}" \ | 556 -DCMAKE_C_COMPILER="${CC}" \ |
| 610 -DCMAKE_CXX_COMPILER="${CXX}" \ | 557 -DCMAKE_CXX_COMPILER="${CXX}" \ |
| 611 -DCMAKE_C_FLAGS="${CFLAGS}" \ | 558 -DCMAKE_C_FLAGS="${CFLAGS}" \ |
| 612 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ | 559 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ |
| 613 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ | 560 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ |
| 614 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ | 561 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ |
| 615 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ | 562 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ |
| 616 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ | 563 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ |
| 617 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ | 564 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 635 if [ "${OS}" = "Darwin" ]; then | 582 if [ "${OS}" = "Darwin" ]; then |
| 636 # See http://crbug.com/256342 | 583 # See http://crbug.com/256342 |
| 637 STRIP_FLAGS=-x | 584 STRIP_FLAGS=-x |
| 638 | 585 |
| 639 cp libcxxbuild/libc++.1.dylib bin/ | 586 cp libcxxbuild/libc++.1.dylib bin/ |
| 640 fi | 587 fi |
| 641 strip ${STRIP_FLAGS} bin/clang | 588 strip ${STRIP_FLAGS} bin/clang |
| 642 popd | 589 popd |
| 643 | 590 |
| 644 # Build compiler-rt out-of-tree. | 591 # Build compiler-rt out-of-tree. |
| 592 # Do a clobbered build due to cmake changes. |
| 593 rm -rf "${COMPILER_RT_BUILD_DIR}" |
| 645 mkdir -p "${COMPILER_RT_BUILD_DIR}" | 594 mkdir -p "${COMPILER_RT_BUILD_DIR}" |
| 646 pushd "${COMPILER_RT_BUILD_DIR}" | 595 pushd "${COMPILER_RT_BUILD_DIR}" |
| 647 | 596 |
| 648 rm -fv CMakeCache.txt | 597 rm -fv CMakeCache.txt |
| 649 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ | 598 MACOSX_DEPLOYMENT_TARGET=${deployment_target} CC="" CXX="" cmake -GNinja \ |
| 650 -DCMAKE_BUILD_TYPE=Release \ | 599 -DCMAKE_BUILD_TYPE=Release \ |
| 651 -DLLVM_ENABLE_ASSERTIONS=ON \ | 600 -DLLVM_ENABLE_ASSERTIONS=ON \ |
| 652 -DLLVM_ENABLE_THREADS=OFF \ | 601 -DLLVM_ENABLE_THREADS=OFF \ |
| 653 -DCMAKE_C_COMPILER="${CC}" \ | 602 -DCMAKE_C_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang" \ |
| 654 -DCMAKE_CXX_COMPILER="${CXX}" \ | 603 -DCMAKE_CXX_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang++" \ |
| 604 -DSANITIZER_MIN_OSX_VERSION="10.7" \ |
| 655 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \ | 605 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \ |
| 656 "${ABS_COMPILER_RT_DIR}" | 606 "${ABS_COMPILER_RT_DIR}" |
| 657 | 607 |
| 658 ninja | 608 ninja |
| 659 | 609 |
| 660 # Copy selected output to the main tree. | 610 # Copy selected output to the main tree. |
| 661 # Darwin doesn't support cp --parents, so pipe through tar instead. | 611 # Darwin doesn't support cp --parents, so pipe through tar instead. |
| 662 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \ | 612 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \ |
| 663 sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p') | 613 sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p') |
| 664 ABS_LLVM_CLANG_LIB_DIR="${ABS_LLVM_BUILD_DIR}/lib/clang/${CLANG_VERSION}" | 614 ABS_LLVM_CLANG_LIB_DIR="${ABS_LLVM_BUILD_DIR}/lib/clang/${CLANG_VERSION}" |
| 665 tar -c *blacklist.txt | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv | 615 tar -c *blacklist.txt | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv |
| 666 tar -c include/sanitizer | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv | 616 tar -c include/sanitizer | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv |
| 667 if [[ "${OS}" = "Darwin" ]]; then | 617 if [[ "${OS}" = "Darwin" ]]; then |
| 668 tar -c lib/darwin | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv | 618 tar -c lib/darwin | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv |
| 669 else | 619 else |
| 670 tar -c lib/linux | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv | 620 tar -c lib/linux | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv |
| 671 fi | 621 fi |
| 672 | 622 |
| 673 popd | 623 popd |
| 674 | 624 |
| 675 if [[ -n "${with_android}" ]]; then | 625 if [[ -n "${with_android}" ]]; then |
| 676 # Make a standalone Android toolchain. | 626 # Make a standalone Android toolchain. |
| 677 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ | 627 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ |
| 678 --platform=android-19 \ | 628 --platform=android-19 \ |
| 679 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \ | 629 --install-dir="${LLVM_BUILD_DIR}/android-toolchain-arm" \ |
| 680 --system=linux-x86_64 \ | 630 --system=linux-x86_64 \ |
| 681 --stl=stlport \ | 631 --stl=stlport \ |
| 682 --toolchain=arm-linux-androideabi-4.9 | 632 --toolchain=arm-linux-androideabi-4.9 |
| 683 | 633 |
| 684 # Android NDK r9d copies a broken unwind.h into the toolchain, see | 634 # Do the same for x86. |
| 685 # http://crbug.com/357890 | 635 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ |
| 686 rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h | 636 --platform=android-19 \ |
| 637 --install-dir="${LLVM_BUILD_DIR}/android-toolchain-i686" \ |
| 638 --system=linux-x86_64 \ |
| 639 --stl=stlport \ |
| 640 --toolchain=x86-4.9 |
| 687 | 641 |
| 688 # Build ASan runtime for Android in a separate build tree. | 642 for target_arch in "arm" "i686"; do |
| 689 mkdir -p ${LLVM_BUILD_DIR}/android | 643 # Android NDK r9d copies a broken unwind.h into the toolchain, see |
| 690 pushd ${LLVM_BUILD_DIR}/android | 644 # http://crbug.com/357890 |
| 691 rm -fv CMakeCache.txt | 645 rm -v "${LLVM_BUILD_DIR}"/android-toolchain-${target_arch}/include/c++/*/unw
ind.h |
| 692 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ | |
| 693 -DCMAKE_BUILD_TYPE=Release \ | |
| 694 -DLLVM_ENABLE_ASSERTIONS=ON \ | |
| 695 -DLLVM_ENABLE_THREADS=OFF \ | |
| 696 -DCMAKE_C_COMPILER=${PWD}/../bin/clang \ | |
| 697 -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \ | |
| 698 -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \ | |
| 699 -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../androi
d-toolchain/sysroot -B${PWD}/../android-toolchain" \ | |
| 700 -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../andr
oid-toolchain/sysroot -B${PWD}/../android-toolchain" \ | |
| 701 -DANDROID=1 \ | |
| 702 "${ABS_COMPILER_RT_DIR}" | |
| 703 ninja libclang_rt.asan-arm-android.so | |
| 704 | 646 |
| 705 # And copy it into the main build tree. | 647 # Build ASan runtime for Android in a separate build tree. |
| 706 cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/
lib/linux/" | 648 mkdir -p ${LLVM_BUILD_DIR}/android-${target_arch} |
| 707 popd | 649 pushd ${LLVM_BUILD_DIR}/android-${target_arch} |
| 650 rm -fv CMakeCache.txt |
| 651 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ |
| 652 -DCMAKE_BUILD_TYPE=Release \ |
| 653 -DLLVM_ENABLE_ASSERTIONS=ON \ |
| 654 -DLLVM_ENABLE_THREADS=OFF \ |
| 655 -DCMAKE_C_COMPILER=${PWD}/../bin/clang \ |
| 656 -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \ |
| 657 -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \ |
| 658 -DCMAKE_C_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${P
WD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${
target_arch}" \ |
| 659 -DCMAKE_CXX_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=$
{PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-
${target_arch}" \ |
| 660 -DANDROID=1 \ |
| 661 "${ABS_COMPILER_RT_DIR}" |
| 662 ninja libclang_rt.asan-${target_arch}-android.so |
| 663 |
| 664 # And copy it into the main build tree. |
| 665 cp "$(find -name libclang_rt.asan-${target_arch}-android.so)" "${ABS_LLVM_CL
ANG_LIB_DIR}/lib/linux/" |
| 666 popd |
| 667 done |
| 708 fi | 668 fi |
| 709 | 669 |
| 710 if [[ -n "$run_tests" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then | 670 if [[ -n "$run_tests" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then |
| 711 # Run Chrome tool tests. | 671 # Run Chrome tool tests. |
| 712 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 672 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
| 713 fi | 673 fi |
| 714 if [[ -n "$run_tests" ]]; then | 674 if [[ -n "$run_tests" ]]; then |
| 715 # Run the LLVM and Clang tests. | 675 # Run the LLVM and Clang tests. |
| 716 ninja -C "${LLVM_BUILD_DIR}" check-all | 676 ninja -C "${LLVM_BUILD_DIR}" check-all |
| 717 fi | 677 fi |
| 718 | 678 |
| 719 # After everything is done, log success for this revision. | 679 # After everything is done, log success for this revision. |
| 720 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 680 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
| OLD | NEW |