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

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

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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/scripts/update.py ('k') | tools/dart/update.py » ('j') | 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=238013 11 CLANG_REVISION=259396
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
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 fi 208 fi
200 export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}" 209 export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}"
201 fi 210 fi
202 fi 211 fi
203 212
204 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" 213 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}"
205 fi 214 fi
206 215
207 if [[ -n "$if_needed" ]]; then 216 if [[ -n "$if_needed" ]]; then
208 if [[ "${OS}" == "Darwin" ]]; then 217 if [[ "${OS}" == "Darwin" ]]; then
209 # clang is used on Mac. 218 # clang is always used on Mac.
219 true
220 elif [[ "${OS}" == "Linux" ]]; then
221 # clang is also aways used on Linux.
210 true 222 true
211 elif [[ "$GYP_DEFINES" =~ .*(clang|tsan|asan|lsan|msan)=1.* ]]; then 223 elif [[ "$GYP_DEFINES" =~ .*(clang|tsan|asan|lsan|msan)=1.* ]]; then
212 # clang requested via $GYP_DEFINES. 224 # clang requested via $GYP_DEFINES.
213 true 225 true
214 elif [[ -d "${LLVM_BUILD_DIR}" ]]; then 226 elif [[ -d "${LLVM_BUILD_DIR}" ]]; then
215 # clang previously downloaded, remove third_party/llvm-build to prevent 227 # clang previously downloaded, keep it up-to-date.
216 # updating. 228 # If you don't want this, delete third_party/llvm-build on your machine.
217 true
218 elif [[ "${OS}" == "Linux" ]]; then
219 # Temporarily use clang on linux. Leave a stamp file behind, so that
220 # this script can remove clang again on machines where it was autoinstalled.
221 mkdir -p "${LLVM_BUILD_DIR}"
222 touch "${LLVM_BUILD_DIR}/autoinstall_stamp"
223 true 229 true
224 else 230 else
225 # clang wasn't needed, not doing anything. 231 # clang wasn't needed, not doing anything.
226 exit 0 232 exit 0
227 fi 233 fi
228 fi 234 fi
229 235
230 236
231 # 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.
232 if [[ -f "${STAMP_FILE}" ]]; then 238 if [[ -f "${STAMP_FILE}" ]]; then
233 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}") 239 PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
234 if [[ -z "$force_local_build" ]] && \ 240 if [[ -z "$force_local_build" ]] && \
235 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ 241 [[ "${PREVIOUSLY_BUILT_REVISON}" = \
236 "${PACKAGE_VERSION}" ]]; then 242 "${PACKAGE_VERSION}" ]]; then
237 echo "Clang already at ${PACKAGE_VERSION}" 243 echo "Clang already at ${PACKAGE_VERSION}"
238 exit 0 244 if [[ -z "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]] || \
245 [[ -f "${LLVM_BUILD_DIR}/lib/LLVMgold.so" ]]; then
246 exit 0
247 fi
239 fi 248 fi
240 fi 249 fi
241 # 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.
242 rm -f "${STAMP_FILE}" 251 rm -f "${STAMP_FILE}"
243 252
244 253
245 if [[ -z "$force_local_build" ]]; then 254 if [[ -z "$force_local_build" ]]; then
246 # 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,
247 # 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.
248 CDS_FILE="clang-${PACKAGE_VERSION}.tgz" 257 CDS_FILE="clang-${PACKAGE_VERSION}.tgz"
(...skipping 14 matching lines...) Expand all
263 echo "Neither curl nor wget found. Please install one of these." 272 echo "Neither curl nor wget found. Please install one of these."
264 exit 1 273 exit 1
265 fi 274 fi
266 if [ -f "${CDS_OUTPUT}" ]; then 275 if [ -f "${CDS_OUTPUT}" ]; then
267 rm -rf "${LLVM_BUILD_DIR}" 276 rm -rf "${LLVM_BUILD_DIR}"
268 mkdir -p "${LLVM_BUILD_DIR}" 277 mkdir -p "${LLVM_BUILD_DIR}"
269 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" 278 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
270 echo clang "${PACKAGE_VERSION}" unpacked 279 echo clang "${PACKAGE_VERSION}" unpacked
271 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" 280 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
272 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
273 exit 0 287 exit 0
274 else 288 else
275 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building 289 echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
276 fi 290 fi
277 fi 291 fi
278 292
279 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then 293 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
280 echo "Android NDK not found at ${ANDROID_NDK_DIR}" 294 echo "Android NDK not found at ${ANDROID_NDK_DIR}"
281 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"
282 echo "works on Android. See " 296 echo "works on Android. See "
(...skipping 29 matching lines...) Expand all
312 "${LLVM_DIR}/test/Bindings/Go/go.test" \ 326 "${LLVM_DIR}/test/Bindings/Go/go.test" \
313 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ 327 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \
314 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ 328 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \
315 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ 329 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \
316 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ 330 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \
317 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ 331 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \
318 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ 332 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \
319 "${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" \
320 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ 334 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \
321 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \ 335 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \
336 "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \
337 "${COMPILER_RT_DIR}/CMakeLists.txt" \
338 "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \
322 ; do 339 ; do
323 if [[ -e "${i}" ]]; then 340 if [[ -e "${i}" ]]; then
324 rm -f "${i}" # For unversioned files. 341 rm -f "${i}" # For unversioned files.
325 svn revert "${i}" 342 svn revert "${i}"
326 fi; 343 fi;
327 done 344 done
328 345
329 echo Remove the Clang tools shim dir 346 echo Remove the Clang tools shim dir
330 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools 347 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools
331 rm -rfv ${CHROME_TOOLS_SHIM_DIR} 348 rm -rfv ${CHROME_TOOLS_SHIM_DIR}
(...skipping 27 matching lines...) Expand all
359 376
360 # 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
361 # 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).
362 if [ "${OS}" = "Darwin" ]; then 379 if [ "${OS}" = "Darwin" ]; then
363 echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}" 380 echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}"
364 svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \ 381 svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \
365 "${LIBCXXABI_DIR}" 382 "${LIBCXXABI_DIR}"
366 fi 383 fi
367 384
368 if [[ -n "$with_patches" ]]; then 385 if [[ -n "$with_patches" ]]; then
369 386 # No patches.
370 # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974) 387 true
371 pushd "${CLANG_DIR}"
372 cat << 'EOF' |
373 --- third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m» (revisio n 202554)
374 +++ third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m» (working copy)
375 @@ -12,6 +12,8 @@
376
377 // REQUIRES: crash-recovery
378 // REQUIRES: shell
379 +// XFAIL: *
380 +// (PR11974)
381
382 @import Crash;
383 EOF
384 patch -p4
385 popd
386
387 pushd "${CLANG_DIR}"
388 cat << 'EOF' |
389 --- unittests/libclang/LibclangTest.cpp (revision 215949)
390 +++ unittests/libclang/LibclangTest.cpp (working copy)
391 @@ -431,7 +431,7 @@
392 EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
393 }
394
395 -TEST_F(LibclangReparseTest, ReparseWithModule) {
396 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
397 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
398 const char *HeaderBottom = "\n};\n#endif\n";
399 const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
400 EOF
401 patch -p0
402 popd
403
404 # Cherry-pick r234010 [sancov] Shrink pc array on Android back to 2**24."
405 pushd "${COMPILER_RT_DIR}"
406 cat << 'EOF' |
407 diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/lib/sanitizer_ common/sanitizer_coverage_libcdep.cc
408 index 4b976fc..cfd9e7e 100644
409 --- a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
410 +++ b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
411 @@ -109,7 +109,8 @@ class CoverageData {
412
413 // Maximal size pc array may ever grow.
414 // We MmapNoReserve this space to ensure that the array is contiguous.
415 - static const uptr kPcArrayMaxSize = FIRST_32_SECOND_64(1 << 26, 1 << 27);
416 + static const uptr kPcArrayMaxSize =
417 + FIRST_32_SECOND_64(1 << (SANITIZER_ANDROID ? 24 : 26), 1 << 27);
418 // The amount file mapping for the pc array is grown by.
419 static const uptr kPcArrayMmapSize = 64 * 1024;
420
421 EOF
422 patch -p1
423 popd
424
425 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21 552)
426 pushd "${LLVM_DIR}"
427 cat << 'EOF' |
428 Index: test/Bindings/Go/go.test
429 ===================================================================
430 --- test/Bindings/Go/go.test (revision 223109)
431 +++ test/Bindings/Go/go.test (working copy)
432 @@ -1,3 +1,3 @@
433 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
434 +; RUN: true
435
436 ; REQUIRES: shell
437 EOF
438 patch -p0
439 popd
440
441
442 fi 388 fi
443 389
444 # Echo all commands. 390 # Echo all commands.
445 set -x 391 set -x
446 392
447 # 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.
448 CC=${CC:-cc} 394 CC=${CC:-cc}
449 CXX=${CXX:-c++} 395 CXX=${CXX:-c++}
450 396
451 if [[ -n "${gcc_toolchain}" ]]; then 397 if [[ -n "${gcc_toolchain}" ]]; then
452 # Use the specified gcc installation for building. 398 # Use the specified gcc installation for building.
453 CC="$gcc_toolchain/bin/gcc" 399 CC="$gcc_toolchain/bin/gcc"
454 CXX="$gcc_toolchain/bin/g++" 400 CXX="$gcc_toolchain/bin/g++"
455 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler, 401 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler,
456 # etc.) find the .so. 402 # etc.) find the .so.
457 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))"
458 fi 404 fi
459 405
460 CFLAGS="" 406 CFLAGS=""
461 CXXFLAGS="" 407 CXXFLAGS=""
462 LDFLAGS="" 408 LDFLAGS=""
463 409
464 # 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
465 # 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++
466 # 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
467 # OS X versions as old as 10.7. 413 # OS X versions as old as 10.7.
468 # 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
469 # 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
470 # change deployment_target to 10.7. 416 # -DLLVM_ENABLE_LIBCXX=ON and change deployment_target to 10.7.
471 deployment_target="" 417 deployment_target=""
472 418
473 if [ "${OS}" = "Darwin" ]; then 419 if [ "${OS}" = "Darwin" ]; then
474 # 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
475 # 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.
476 CFLAGS="-isysroot $(xcrun --show-sdk-path)" 422 CFLAGS="-isysroot $(xcrun --show-sdk-path)"
477 CPPFLAGS="${CFLAGS}"
478 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}" 423 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
479 424
480 if [[ -n "${bootstrap}" ]]; then 425 if [[ -n "${bootstrap}" ]]; then
481 deployment_target=10.6 426 deployment_target=10.6
482 fi 427 fi
483 fi 428 fi
484 429
485 # Build bootstrap clang if requested. 430 # Build bootstrap clang if requested.
486 if [[ -n "${bootstrap}" ]]; then 431 if [[ -n "${bootstrap}" ]]; then
487 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}" 432 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}"
(...skipping 25 matching lines...) Expand all
513 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \ 458 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \
514 "${ABS_INSTALL_DIR}/lib/" 459 "${ABS_INSTALL_DIR}/lib/"
515 fi 460 fi
516 461
517 popd 462 popd
518 CC="${ABS_INSTALL_DIR}/bin/clang" 463 CC="${ABS_INSTALL_DIR}/bin/clang"
519 CXX="${ABS_INSTALL_DIR}/bin/clang++" 464 CXX="${ABS_INSTALL_DIR}/bin/clang++"
520 465
521 if [[ -n "${gcc_toolchain}" ]]; then 466 if [[ -n "${gcc_toolchain}" ]]; then
522 # 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
523 # for standard library headers and shared object file. 468 # for standard library headers and shared object files.
524 CFLAGS="--gcc-toolchain=${gcc_toolchain}" 469 CFLAGS="--gcc-toolchain=${gcc_toolchain}"
525 CXXFLAGS="--gcc-toolchain=${gcc_toolchain}" 470 CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
526 fi 471 fi
527 472
528 echo "Building final compiler" 473 echo "Building final compiler"
529 fi 474 fi
530 475
531 # Build clang (in a separate directory). 476 # Build clang (in a separate directory).
532 # 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,
533 # 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
554 pushd libcxxbuild 499 pushd libcxxbuild
555 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ 500 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \
556 -nodefaultlibs -current_version 1 -compatibility_version 1 \ 501 -nodefaultlibs -current_version 1 -compatibility_version 1 \
557 -lSystem -install_name @executable_path/libc++.dylib \ 502 -lSystem -install_name @executable_path/libc++.dylib \
558 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ 503 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \
559 -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 \
560 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp 505 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp
561 ln -sf libc++.1.dylib libc++.dylib 506 ln -sf libc++.1.dylib libc++.dylib
562 popd 507 popd
563 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
564 fi 519 fi
565 520
566 # Find the binutils include dir for the gold plugin. 521 # Find the binutils include dir for the gold plugin.
567 BINUTILS_INCDIR="" 522 BINUTILS_INCDIR=""
568 if [ "${OS}" = "Linux" ]; then 523 if [ "${OS}" = "Linux" ]; then
569 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" 524 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include"
570 fi 525 fi
571 526
572 527
573 # 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
589 # 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
590 # 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
591 # subdirectory... 546 # subdirectory...
592 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a) 547 add_subdirectory(\${CHROMIUM_TOOLS_SRC} \${CMAKE_CURRENT_BINARY_DIR}/a)
593 EOF 548 EOF
594 rm -fv CMakeCache.txt 549 rm -fv CMakeCache.txt
595 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ 550 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
596 -DCMAKE_BUILD_TYPE=Release \ 551 -DCMAKE_BUILD_TYPE=Release \
597 -DLLVM_ENABLE_ASSERTIONS=ON \ 552 -DLLVM_ENABLE_ASSERTIONS=ON \
598 -DLLVM_ENABLE_THREADS=OFF \ 553 -DLLVM_ENABLE_THREADS=OFF \
554 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
599 -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \ 555 -DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \
600 -DCMAKE_C_COMPILER="${CC}" \ 556 -DCMAKE_C_COMPILER="${CC}" \
601 -DCMAKE_CXX_COMPILER="${CXX}" \ 557 -DCMAKE_CXX_COMPILER="${CXX}" \
602 -DCMAKE_C_FLAGS="${CFLAGS}" \ 558 -DCMAKE_C_FLAGS="${CFLAGS}" \
603 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ 559 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
604 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ 560 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
605 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ 561 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
606 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ 562 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
607 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \ 563 -DCMAKE_INSTALL_PREFIX="${ABS_LLVM_BUILD_DIR}" \
608 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \ 564 -DCHROMIUM_TOOLS_SRC="${ABS_CHROMIUM_TOOLS_DIR}" \
(...skipping 17 matching lines...) Expand all
626 if [ "${OS}" = "Darwin" ]; then 582 if [ "${OS}" = "Darwin" ]; then
627 # See http://crbug.com/256342 583 # See http://crbug.com/256342
628 STRIP_FLAGS=-x 584 STRIP_FLAGS=-x
629 585
630 cp libcxxbuild/libc++.1.dylib bin/ 586 cp libcxxbuild/libc++.1.dylib bin/
631 fi 587 fi
632 strip ${STRIP_FLAGS} bin/clang 588 strip ${STRIP_FLAGS} bin/clang
633 popd 589 popd
634 590
635 # 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}"
636 mkdir -p "${COMPILER_RT_BUILD_DIR}" 594 mkdir -p "${COMPILER_RT_BUILD_DIR}"
637 pushd "${COMPILER_RT_BUILD_DIR}" 595 pushd "${COMPILER_RT_BUILD_DIR}"
638 596
639 rm -fv CMakeCache.txt 597 rm -fv CMakeCache.txt
640 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \ 598 MACOSX_DEPLOYMENT_TARGET=${deployment_target} CC="" CXX="" cmake -GNinja \
641 -DCMAKE_BUILD_TYPE=Release \ 599 -DCMAKE_BUILD_TYPE=Release \
642 -DLLVM_ENABLE_ASSERTIONS=ON \ 600 -DLLVM_ENABLE_ASSERTIONS=ON \
643 -DLLVM_ENABLE_THREADS=OFF \ 601 -DLLVM_ENABLE_THREADS=OFF \
644 -DCMAKE_C_COMPILER="${CC}" \ 602 -DCMAKE_C_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang" \
645 -DCMAKE_CXX_COMPILER="${CXX}" \ 603 -DCMAKE_CXX_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang++" \
604 -DSANITIZER_MIN_OSX_VERSION="10.7" \
646 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \ 605 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
647 "${ABS_COMPILER_RT_DIR}" 606 "${ABS_COMPILER_RT_DIR}"
648 607
649 ninja 608 ninja
650 609
651 # Copy selected output to the main tree. 610 # Copy selected output to the main tree.
652 # Darwin doesn't support cp --parents, so pipe through tar instead. 611 # Darwin doesn't support cp --parents, so pipe through tar instead.
653 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \ 612 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \
654 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')
655 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}"
656 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
657 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
658 if [[ "${OS}" = "Darwin" ]]; then 617 if [[ "${OS}" = "Darwin" ]]; then
659 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
660 else 619 else
661 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
662 fi 621 fi
663 622
664 popd 623 popd
665 624
666 if [[ -n "${with_android}" ]]; then 625 if [[ -n "${with_android}" ]]; then
667 # Make a standalone Android toolchain. 626 # Make a standalone Android toolchain.
668 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ 627 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
669 --platform=android-14 \ 628 --platform=android-19 \
670 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \ 629 --install-dir="${LLVM_BUILD_DIR}/android-toolchain-arm" \
671 --system=linux-x86_64 \ 630 --system=linux-x86_64 \
672 --stl=libcxx \ 631 --stl=stlport \
673 --toolchain=arm-linux-androideabi-4.9 632 --toolchain=arm-linux-androideabi-4.9
674 633
675 # Android NDK r9d copies a broken unwind.h into the toolchain, see 634 # Do the same for x86.
676 # http://crbug.com/357890 635 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
677 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
678 641
679 # Build ASan runtime for Android in a separate build tree. 642 for target_arch in "arm" "i686"; do
680 mkdir -p ${LLVM_BUILD_DIR}/android 643 # Android NDK r9d copies a broken unwind.h into the toolchain, see
681 pushd ${LLVM_BUILD_DIR}/android 644 # http://crbug.com/357890
682 rm -fv CMakeCache.txt 645 rm -v "${LLVM_BUILD_DIR}"/android-toolchain-${target_arch}/include/c++/*/unw ind.h
683 MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
684 -DCMAKE_BUILD_TYPE=Release \
685 -DLLVM_ENABLE_ASSERTIONS=ON \
686 -DLLVM_ENABLE_THREADS=OFF \
687 -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
688 -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
689 -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
690 -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../androi d-toolchain/sysroot -B${PWD}/../android-toolchain" \
691 -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../andr oid-toolchain/sysroot -B${PWD}/../android-toolchain" \
692 -DANDROID=1 \
693 "${ABS_COMPILER_RT_DIR}"
694 ninja libclang_rt.asan-arm-android.so
695 646
696 # And copy it into the main build tree. 647 # Build ASan runtime for Android in a separate build tree.
697 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}
698 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
699 fi 668 fi
700 669
701 if [[ -n "$run_tests" ]]; then 670 if [[ -n "$run_tests" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then
702 # Run Chrome tool tests. 671 # Run Chrome tool tests.
703 ninja -C "${LLVM_BUILD_DIR}" cr-check-all 672 ninja -C "${LLVM_BUILD_DIR}" cr-check-all
673 fi
674 if [[ -n "$run_tests" ]]; then
704 # Run the LLVM and Clang tests. 675 # Run the LLVM and Clang tests.
705 ninja -C "${LLVM_BUILD_DIR}" check-all 676 ninja -C "${LLVM_BUILD_DIR}" check-all
706 fi 677 fi
707 678
708 # After everything is done, log success for this revision. 679 # After everything is done, log success for this revision.
709 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" 680 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
OLDNEW
« no previous file with comments | « tools/clang/scripts/update.py ('k') | tools/dart/update.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698