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

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

Issue 575833003: Roll Clang 214024:216630 (+216684) and switch to CMake (try 3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make sure RPATH gets set when building the plugins 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/scripts/repackage.sh ('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=214024 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" 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts"
16 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt"
16 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" 17 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
17 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" 18 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install"
18 CLANG_DIR="${LLVM_DIR}/tools/clang" 19 CLANG_DIR="${LLVM_DIR}/tools/clang"
19 CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra" 20 CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra"
20 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" 21 COMPILER_RT_DIR="${LLVM_DIR}/compiler-rt"
21 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx" 22 LIBCXX_DIR="${LLVM_DIR}/projects/libcxx"
22 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi" 23 LIBCXXABI_DIR="${LLVM_DIR}/projects/libcxxabi"
23 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" 24 ANDROID_NDK_DIR="${THIS_DIR}/../../../third_party/android_tools/ndk"
24 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" 25 STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
25 26
26 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" 27 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}"
27 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" 28 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}"
29 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}"
30 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}"
31 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}"
28 32
29 33
30 # Use both the clang revision and the plugin revisions to test for updates. 34 # Use both the clang revision and the plugin revisions to test for updates.
31 BLINKGCPLUGIN_REVISION=\ 35 BLINKGCPLUGIN_REVISION=\
32 $(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \ 36 $(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \
33 | cut -d '_' -f 2) 37 | cut -d ' ' -f 2 | tr -cd '[0-9]')
34 CLANG_AND_PLUGINS_REVISION="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}" 38 CLANG_AND_PLUGINS_REVISION="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}"
35 39
36 # ${A:-a} returns $A if it's set, a else. 40 # ${A:-a} returns $A if it's set, a else.
37 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} 41 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
38 42
39 if [[ -z "$GYP_DEFINES" ]]; then 43 if [[ -z "$GYP_DEFINES" ]]; then
40 GYP_DEFINES= 44 GYP_DEFINES=
41 fi 45 fi
42 if [[ -z "$GYP_GENERATORS" ]]; then 46 if [[ -z "$GYP_GENERATORS" ]]; then
43 GYP_GENERATORS= 47 GYP_GENERATORS=
(...skipping 10 matching lines...) Expand all
54 force_local_build= 58 force_local_build=
55 run_tests= 59 run_tests=
56 bootstrap= 60 bootstrap=
57 with_android=yes 61 with_android=yes
58 chrome_tools="plugins blink_gc_plugin" 62 chrome_tools="plugins blink_gc_plugin"
59 gcc_toolchain= 63 gcc_toolchain=
60 64
61 if [[ "${OS}" = "Darwin" ]]; then 65 if [[ "${OS}" = "Darwin" ]]; then
62 with_android= 66 with_android=
63 fi 67 fi
64 if [ "${OS}" = "FreeBSD" ]; then
65 MAKE=gmake
66 else
67 MAKE=make
68 fi
69 68
70 while [[ $# > 0 ]]; do 69 while [[ $# > 0 ]]; do
71 case $1 in 70 case $1 in
72 --bootstrap) 71 --bootstrap)
73 bootstrap=yes 72 bootstrap=yes
74 ;; 73 ;;
75 --if-needed) 74 --if-needed)
76 if_needed=yes 75 if_needed=yes
77 ;; 76 ;;
78 --force-local-build) 77 --force-local-build)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if which curl > /dev/null; then 190 if which curl > /dev/null; then
192 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ 191 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \
193 rm -rf "${CDS_OUT_DIR}" 192 rm -rf "${CDS_OUT_DIR}"
194 elif which wget > /dev/null; then 193 elif which wget > /dev/null; then
195 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" 194 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}"
196 else 195 else
197 echo "Neither curl nor wget found. Please install one of these." 196 echo "Neither curl nor wget found. Please install one of these."
198 exit 1 197 exit 1
199 fi 198 fi
200 if [ -f "${CDS_OUTPUT}" ]; then 199 if [ -f "${CDS_OUTPUT}" ]; then
201 rm -rf "${LLVM_BUILD_DIR}/Release+Asserts" 200 rm -rf "${LLVM_BUILD_DIR}"
202 mkdir -p "${LLVM_BUILD_DIR}/Release+Asserts" 201 mkdir -p "${LLVM_BUILD_DIR}"
203 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}/Release+Asserts" 202 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
204 echo clang "${CLANG_REVISION}" unpacked 203 echo clang "${CLANG_REVISION}" unpacked
205 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 204 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
206 rm -rf "${CDS_OUT_DIR}" 205 rm -rf "${CDS_OUT_DIR}"
207 exit 0 206 exit 0
208 else 207 else
209 echo Did not find prebuilt clang at r"${CLANG_REVISION}", building 208 echo Did not find prebuilt clang at r"${CLANG_REVISION}", building
210 fi 209 fi
211 fi 210 fi
212 211
213 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then 212 if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
214 echo "Android NDK not found at ${ANDROID_NDK_DIR}" 213 echo "Android NDK not found at ${ANDROID_NDK_DIR}"
215 echo "The Android NDK is needed to build a Clang whose -fsanitize=address" 214 echo "The Android NDK is needed to build a Clang whose -fsanitize=address"
216 echo "works on Android. See " 215 echo "works on Android. See "
217 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how" 216 echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how"
218 echo "to install the NDK, or pass --without-android." 217 echo "to install the NDK, or pass --without-android."
219 exit 1 218 exit 1
220 fi 219 fi
221 220
221 # Check that cmake and ninja are available.
222 if ! which cmake > /dev/null; then
223 echo "CMake needed to build clang; please install"
224 exit 1
225 fi
226 if ! which ninja > /dev/null; then
227 echo "ninja needed to build clang, please install"
228 exit 1
229 fi
230
222 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}" 231 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
223 if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \ 232 if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
224 "${LLVM_DIR}"; then 233 "${LLVM_DIR}"; then
225 echo Checkout failed, retrying 234 echo Checkout failed, retrying
226 rm -rf "${LLVM_DIR}" 235 rm -rf "${LLVM_DIR}"
227 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" 236 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}"
228 fi 237 fi
229 238
230 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" 239 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}"
231 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" 240 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"
232 241
242 # We have moved from building compiler-rt in the LLVM tree, to a separate
Nico 2015/04/29 19:58:46 (this is annoying every time I need to debug somet
hans 2015/04/29 20:02:33 The deleting part or the fact that it moved? Are y
243 # directory. Nuke any previous checkout to avoid building it.
244 rm -rf "${LLVM_DIR}/projects/compiler-rt"
245
233 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" 246 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}"
234 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ 247 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \
235 "${COMPILER_RT_DIR}" 248 "${COMPILER_RT_DIR}"
236 249
237 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes 250 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes
238 # (i.e. this is needed for bootstrap builds). 251 # (i.e. this is needed for bootstrap builds).
239 if [ "${OS}" = "Darwin" ]; then 252 if [ "${OS}" = "Darwin" ]; then
240 echo Getting libc++ r"${CLANG_REVISION}" in "${LIBCXX_DIR}" 253 echo Getting libc++ r"${CLANG_REVISION}" in "${LIBCXX_DIR}"
241 svn co --force "${LLVM_REPO_URL}/libcxx/trunk@${CLANG_REVISION}" \ 254 svn co --force "${LLVM_REPO_URL}/libcxx/trunk@${CLANG_REVISION}" \
242 "${LIBCXX_DIR}" 255 "${LIBCXX_DIR}"
243 fi 256 fi
244 257
245 # While we're bundling our own libc++ on OS X, we need to compile libc++abi 258 # While we're bundling our own libc++ on OS X, we need to compile libc++abi
246 # into it too (since OS X 10.6 doesn't have libc++abi.dylib either). 259 # into it too (since OS X 10.6 doesn't have libc++abi.dylib either).
247 if [ "${OS}" = "Darwin" ]; then 260 if [ "${OS}" = "Darwin" ]; then
248 echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}" 261 echo Getting libc++abi r"${CLANG_REVISION}" in "${LIBCXXABI_DIR}"
249 svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \ 262 svn co --force "${LLVM_REPO_URL}/libcxxabi/trunk@${CLANG_REVISION}" \
250 "${LIBCXXABI_DIR}" 263 "${LIBCXXABI_DIR}"
251 fi 264 fi
252 265
253 # Apply patch for test failing with --disable-pthreads (llvm.org/PR11974) 266 # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974)
254 pushd "${CLANG_DIR}" 267 pushd "${CLANG_DIR}"
255 svn revert test/Index/crash-recovery-modules.m 268 svn revert test/Index/crash-recovery-modules.m
256 cat << 'EOF' | 269 cat << 'EOF' |
257 --- third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m (revisio n 202554) 270 --- third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m (revisio n 202554)
258 +++ third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m (working copy) 271 +++ third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m (working copy)
259 @@ -12,6 +12,8 @@ 272 @@ -12,6 +12,8 @@
260 273
261 // REQUIRES: crash-recovery 274 // REQUIRES: crash-recovery
262 // REQUIRES: shell 275 // REQUIRES: shell
263 +// XFAIL: * 276 +// XFAIL: *
264 +// (PR11974) 277 +// (PR11974)
265 278
266 @import Crash; 279 @import Crash;
267 EOF 280 EOF
268 patch -p4 281 patch -p4
269 popd 282 popd
270 283
284 pushd "${CLANG_DIR}"
285 svn revert unittests/libclang/LibclangTest.cpp
286 cat << 'EOF' |
287 --- unittests/libclang/LibclangTest.cpp (revision 215949)
288 +++ unittests/libclang/LibclangTest.cpp (working copy)
289 @@ -431,7 +431,7 @@
290 EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
291 }
292
293 -TEST_F(LibclangReparseTest, ReparseWithModule) {
294 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
295 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
296 const char *HeaderBottom = "\n};\n#endif\n";
297 const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
298 EOF
299 patch -p0
300 popd
301
302 # Apply r216684 to fix ASan array cookie instrumentation problem.
303 # (See https://code.google.com/p/chromium/issues/detail?id=400849#c17)
304 pushd "${COMPILER_RT_DIR}"
305 svn revert lib/asan/asan_rtl.cc
306 svn revert test/asan/TestCases/Linux/new_array_cookie_test.cc
Nico 2014/09/17 17:13:23 :-)
307 cat << 'EOF' |
308 --- a/lib/asan/asan_rtl.cc
309 +++ b/lib/asan/asan_rtl.cc
310 @@ -269,7 +269,7 @@ void InitializeFlags(Flags *f, const char *env) {
311 f->allow_reexec = true;
312 f->print_full_thread_history = true;
313 f->poison_heap = true;
314 - f->poison_array_cookie = true;
315 + f->poison_array_cookie = false;
316 f->poison_partial = true;
317 // Turn off alloc/dealloc mismatch checker on Mac and Windows for now.
318 // https://code.google.com/p/address-sanitizer/issues/detail?id=131
319 diff --git a/test/asan/TestCases/Linux/new_array_cookie_test.cc b/test/asan/Test Cases/Linux/new_array_cookie_test.cc
320 index 339120b..49545f0 100644
321 --- a/test/asan/TestCases/Linux/new_array_cookie_test.cc
322 +++ b/test/asan/TestCases/Linux/new_array_cookie_test.cc
323 @@ -1,6 +1,6 @@
324 // REQUIRES: asan-64-bits
325 -// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
326 -// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
327 +// RUN: %clangxx_asan -O3 %s -o %t
328 +// RUN %run %t
329 // RUN: ASAN_OPTIONS=poison_array_cookie=1 not %run %t 2>&1 | FileCheck %s
330 // RUN: ASAN_OPTIONS=poison_array_cookie=0 %run %t
331 #include <stdio.h>
332 EOF
333 patch -p1
334 popd
335
271 # Echo all commands. 336 # Echo all commands.
272 set -x 337 set -x
273 338
274 NUM_JOBS=3 339 # Set default values for CC and CXX if they're not set in the environment.
275 if [[ "${OS}" = "Linux" ]]; then 340 CC=${CC:-cc}
276 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" 341 CXX=${CXX:-c++}
277 elif [ "${OS}" = "Darwin" -o "${OS}" = "FreeBSD" ]; then
278 NUM_JOBS="$(sysctl -n hw.ncpu)"
279 fi
280 342
281 if [[ -n "${gcc_toolchain}" ]]; then 343 if [[ -n "${gcc_toolchain}" ]]; then
282 # Use the specified gcc installation for building. 344 # Use the specified gcc installation for building.
283 export CC="$gcc_toolchain/bin/gcc" 345 CC="$gcc_toolchain/bin/gcc"
284 export CXX="$gcc_toolchain/bin/g++" 346 CXX="$gcc_toolchain/bin/g++"
285 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler, 347 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler,
286 # etc.) find the .so. 348 # etc.) find the .so.
287 export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))" 349 export LD_LIBRARY_PATH="$(dirname $(${CXX} -print-file-name=libstdc++.so.6))"
288 fi 350 fi
289 351
290 export CFLAGS="" 352 CFLAGS=""
291 export CXXFLAGS="" 353 CXXFLAGS=""
354 LDFLAGS=""
292 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is 355 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
293 # needed, on OS X it requires libc++. clang only automatically links to libc++ 356 # needed, on OS X it requires libc++. clang only automatically links to libc++
294 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on 357 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on
295 # OS X versions as old as 10.7. 358 # OS X versions as old as 10.7.
296 # TODO(thakis): Some bots are still on 10.6, so for now bundle libc++.dylib. 359 # TODO(thakis): Some bots are still on 10.6, so for now bundle libc++.dylib.
297 # Remove this once all bots are on 10.7+, then use --enable-libcpp=yes and 360 # Remove this once all bots are on 10.7+, then use --enable-libcpp=yes and
298 # change all MACOSX_DEPLOYMENT_TARGET values to 10.7. 361 # change all MACOSX_DEPLOYMENT_TARGET values to 10.7.
299 if [ "${OS}" = "Darwin" ]; then 362 if [ "${OS}" = "Darwin" ]; then
300 # When building on 10.9, /usr/include usually doesn't exist, and while 363 # When building on 10.9, /usr/include usually doesn't exist, and while
301 # Xcode's clang automatically sets a sysroot, self-built clangs don't. 364 # Xcode's clang automatically sets a sysroot, self-built clangs don't.
302 export CFLAGS="-isysroot $(xcrun --show-sdk-path)" 365 CFLAGS="-isysroot $(xcrun --show-sdk-path)"
303 export CPPFLAGS="${CFLAGS}" 366 CPPFLAGS="${CFLAGS}"
304 export CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLA GS}" 367 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
305 fi 368 fi
306 369
307 # Build bootstrap clang if requested. 370 # Build bootstrap clang if requested.
308 if [[ -n "${bootstrap}" ]]; then 371 if [[ -n "${bootstrap}" ]]; then
309 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}" 372 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}"
310 echo "Building bootstrap compiler" 373 echo "Building bootstrap compiler"
311 mkdir -p "${LLVM_BOOTSTRAP_DIR}" 374 mkdir -p "${LLVM_BOOTSTRAP_DIR}"
312 pushd "${LLVM_BOOTSTRAP_DIR}" 375 pushd "${LLVM_BOOTSTRAP_DIR}"
313 if [[ ! -f ./config.status ]]; then 376
314 # The bootstrap compiler only needs to be able to build the real compiler, 377 cmake -GNinja \
315 # so it needs no cross-compiler output support. In general, the host 378 -DCMAKE_BUILD_TYPE=Release \
316 # compiler should be as similar to the final compiler as possible, so do 379 -DLLVM_ENABLE_ASSERTIONS=ON \
317 # keep --disable-threads & co. 380 -DLLVM_TARGETS_TO_BUILD=host \
318 ../llvm/configure \ 381 -DLLVM_ENABLE_THREADS=OFF \
319 --enable-optimized \ 382 -DCMAKE_INSTALL_PREFIX="${ABS_INSTALL_DIR}" \
320 --enable-targets=host-only \ 383 -DCMAKE_C_COMPILER="${CC}" \
321 --enable-libedit=no \ 384 -DCMAKE_CXX_COMPILER="${CXX}" \
322 --disable-threads \ 385 -DCMAKE_C_FLAGS="${CFLAGS}" \
323 --disable-pthreads \ 386 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
324 --without-llvmgcc \ 387 ../llvm
325 --without-llvmgxx \ 388
326 --prefix="${ABS_INSTALL_DIR}" 389 ninja
390 if [[ -n "${run_tests}" ]]; then
391 ninja check-all
327 fi 392 fi
328 393
329 ${MAKE} -j"${NUM_JOBS}" 394 ninja install
330 if [[ -n "${run_tests}" ]]; then
331 ${MAKE} check-all
332 fi
333
334 ${MAKE} install
335 if [[ -n "${gcc_toolchain}" ]]; then 395 if [[ -n "${gcc_toolchain}" ]]; then
336 # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap 396 # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
337 # compiler can start. 397 # compiler can start.
338 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \ 398 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \
339 "${ABS_INSTALL_DIR}/lib/" 399 "${ABS_INSTALL_DIR}/lib/"
340 fi 400 fi
341 401
342 popd 402 popd
343 export CC="${ABS_INSTALL_DIR}/bin/clang" 403 CC="${ABS_INSTALL_DIR}/bin/clang"
344 export CXX="${ABS_INSTALL_DIR}/bin/clang++" 404 CXX="${ABS_INSTALL_DIR}/bin/clang++"
345 405
346 if [[ -n "${gcc_toolchain}" ]]; then 406 if [[ -n "${gcc_toolchain}" ]]; then
347 # Tell the bootstrap compiler to use a specific gcc prefix to search 407 # Tell the bootstrap compiler to use a specific gcc prefix to search
348 # for standard library headers and shared object file. 408 # for standard library headers and shared object file.
349 export CFLAGS="--gcc-toolchain=${gcc_toolchain}" 409 CFLAGS="--gcc-toolchain=${gcc_toolchain}"
350 export CXXFLAGS="--gcc-toolchain=${gcc_toolchain}" 410 CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
351 fi 411 fi
352 412
353 echo "Building final compiler" 413 echo "Building final compiler"
354 fi 414 fi
355 415
356 # Build clang (in a separate directory). 416 # Build clang (in a separate directory).
357 # The clang bots have this path hardcoded in built/scripts/slave/compile.py, 417 # The clang bots have this path hardcoded in built/scripts/slave/compile.py,
358 # so if you change it you also need to change these links. 418 # so if you change it you also need to change these links.
359 mkdir -p "${LLVM_BUILD_DIR}" 419 mkdir -p "${LLVM_BUILD_DIR}"
360 pushd "${LLVM_BUILD_DIR}" 420 pushd "${LLVM_BUILD_DIR}"
(...skipping 17 matching lines...) Expand all
378 438
379 pushd libcxxbuild 439 pushd libcxxbuild
380 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ 440 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \
381 -nodefaultlibs -current_version 1 -compatibility_version 1 \ 441 -nodefaultlibs -current_version 1 -compatibility_version 1 \
382 -lSystem -install_name @executable_path/libc++.dylib \ 442 -lSystem -install_name @executable_path/libc++.dylib \
383 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ 443 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \
384 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ 444 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \
385 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp 445 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp
386 ln -sf libc++.1.dylib libc++.dylib 446 ln -sf libc++.1.dylib libc++.dylib
387 popd 447 popd
388 export LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" 448 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
389 fi 449 fi
390 450
391 if [[ ! -f ./config.status ]]; then 451 if [[ ! -f ./CMakeCache.txt ]]; then
392 ../llvm/configure \ 452 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
393 --enable-optimized \ 453 -DCMAKE_BUILD_TYPE=Release \
394 --enable-libedit=no \ 454 -DLLVM_ENABLE_ASSERTIONS=ON \
395 --disable-threads \ 455 -DLLVM_ENABLE_THREADS=OFF \
396 --disable-pthreads \ 456 -DCMAKE_C_COMPILER="${CC}" \
397 --without-llvmgcc \ 457 -DCMAKE_CXX_COMPILER="${CXX}" \
398 --without-llvmgxx 458 -DCMAKE_C_FLAGS="${CFLAGS}" \
459 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
460 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
461 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
462 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
463 "${ABS_LLVM_DIR}"
464 env
399 fi 465 fi
400 466
401 if [[ -n "${gcc_toolchain}" ]]; then 467 if [[ -n "${gcc_toolchain}" ]]; then
402 # Copy in the right stdlibc++.so.6 so clang can start. 468 # Copy in the right stdlibc++.so.6 so clang can start.
403 mkdir -p Release+Asserts/lib 469 mkdir -p lib
404 cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" \ 470 cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" lib/
405 Release+Asserts/lib/
406 fi 471 fi
407 MACOSX_DEPLOYMENT_TARGET=10.5 ${MAKE} -j"${NUM_JOBS}" 472
473 ninja
474
408 STRIP_FLAGS= 475 STRIP_FLAGS=
409 if [ "${OS}" = "Darwin" ]; then 476 if [ "${OS}" = "Darwin" ]; then
410 # See http://crbug.com/256342 477 # See http://crbug.com/256342
411 STRIP_FLAGS=-x 478 STRIP_FLAGS=-x
412 479
413 cp libcxxbuild/libc++.1.dylib Release+Asserts/bin 480 cp libcxxbuild/libc++.1.dylib bin/
414 fi 481 fi
415 strip ${STRIP_FLAGS} Release+Asserts/bin/clang 482 strip ${STRIP_FLAGS} bin/clang
483 popd
484
485 # Build compiler-rt out-of-tree.
486 mkdir -p "${COMPILER_RT_BUILD_DIR}"
487 pushd "${COMPILER_RT_BUILD_DIR}"
488
489 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
490 -DCMAKE_BUILD_TYPE=Release \
491 -DLLVM_ENABLE_ASSERTIONS=ON \
492 -DLLVM_ENABLE_THREADS=OFF \
493 -DCMAKE_C_COMPILER="${CC}" \
494 -DCMAKE_CXX_COMPILER="${CXX}" \
495 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
496 "${ABS_COMPILER_RT_DIR}"
497
498 ninja
499
500 # Copy selected output to the main tree.
501 # Darwin doesn't support cp --parents, so pipe through tar instead.
502 CLANG_VERSION=$("${ABS_LLVM_BUILD_DIR}/bin/clang" --version | \
503 sed -ne 's/clang version \([0-9]\.[0-9]\.[0-9]\).*/\1/p')
504 ABS_LLVM_CLANG_LIB_DIR="${ABS_LLVM_BUILD_DIR}/lib/clang/${CLANG_VERSION}"
505 tar -c *blacklist.txt | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
506 tar -c include/sanitizer | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
507 if [[ "${OS}" = "Darwin" ]]; then
508 tar -c lib/darwin | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
509 else
510 tar -c lib/linux | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
511 fi
512
416 popd 513 popd
417 514
418 if [[ -n "${with_android}" ]]; then 515 if [[ -n "${with_android}" ]]; then
419 # Make a standalone Android toolchain. 516 # Make a standalone Android toolchain.
420 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ 517 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
421 --platform=android-14 \ 518 --platform=android-14 \
422 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \ 519 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
423 --system=linux-x86_64 \ 520 --system=linux-x86_64 \
424 --stl=stlport 521 --stl=stlport
425 522
426 # Android NDK r9d copies a broken unwind.h into the toolchain, see 523 # Android NDK r9d copies a broken unwind.h into the toolchain, see
427 # http://crbug.com/357890 524 # http://crbug.com/357890
428 rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h 525 rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h
429 526
430 # Build ASan runtime for Android. 527 # Build ASan runtime for Android in a separate build tree.
431 # Note: LLVM_ANDROID_TOOLCHAIN_DIR is not relative to PWD, but to where we 528 mkdir -p ${LLVM_BUILD_DIR}/android
432 # build the runtime, i.e. third_party/llvm/projects/compiler-rt. 529 pushd ${LLVM_BUILD_DIR}/android
433 pushd "${LLVM_BUILD_DIR}" 530 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
434 ${MAKE} -C tools/clang/runtime/ \ 531 -DCMAKE_BUILD_TYPE=Release \
435 LLVM_ANDROID_TOOLCHAIN_DIR="../../../llvm-build/android-toolchain" 532 -DLLVM_ENABLE_ASSERTIONS=ON \
533 -DLLVM_ENABLE_THREADS=OFF \
534 -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
535 -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
536 -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
537 -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../androi d-toolchain/sysroot -B${PWD}/../android-toolchain" \
538 -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../andr oid-toolchain/sysroot -B${PWD}/../android-toolchain" \
539 -DANDROID=1 \
540 "${ABS_COMPILER_RT_DIR}"
541 ninja clang_rt.asan-arm-android
542
543 # 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/"
436 popd 545 popd
437 fi 546 fi
438 547
439 # Build Chrome-specific clang tools. Paths in this list should be relative to 548 # Build Chrome-specific clang tools. Paths in this list should be relative to
440 # tools/clang. 549 # tools/clang.
441 # For each tool directory, copy it into the clang tree and use clang's build 550 # For each tool directory, copy it into the clang tree and use clang's build
442 # system to compile it. 551 # system to compile it.
443 for CHROME_TOOL_DIR in ${chrome_tools}; do 552 for CHROME_TOOL_DIR in ${chrome_tools}; do
444 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" 553 TOOL_SRC_DIR="${PWD}/${THIS_DIR}/../${CHROME_TOOL_DIR}"
445 TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" 554 TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_D IR}"
446 TOOL_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" 555
447 rm -rf "${TOOL_DST_DIR}"
448 cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}"
449 rm -rf "${TOOL_BUILD_DIR}" 556 rm -rf "${TOOL_BUILD_DIR}"
450 mkdir -p "${TOOL_BUILD_DIR}" 557 mkdir -p "${TOOL_BUILD_DIR}"
451 cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}" 558 pushd "${TOOL_BUILD_DIR}"
452 MACOSX_DEPLOYMENT_TARGET=10.5 ${MAKE} -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}" 559 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
560 -DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \
561 -DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \
562 -DCMAKE_C_COMPILER="${CC}" \
563 -DCMAKE_CXX_COMPILER="${CXX}" \
564 -DCMAKE_C_FLAGS="${CFLAGS}" \
565 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
566 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
567 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
568 -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
569 "${TOOL_SRC_DIR}"
570 ninja
571 cp -v "${TOOL_BUILD_DIR}/lib"/* "${ABS_LLVM_BUILD_DIR}/lib/"
572 popd
453 done 573 done
454 574
455 if [[ -n "$run_tests" ]]; then 575 if [[ -n "$run_tests" ]]; then
456 # Run a few tests. 576 # Run the tests for each chrome tool.
457 for CHROME_TOOL_DIR in ${chrome_tools}; do 577 for CHROME_TOOL_DIR in ${chrome_tools}; do
458 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" 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/"))
459 if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then 581 if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then
460 "${TOOL_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" 582 "${TOOL_SRC_DIR}/tests/test.sh" "${ABS_LLVM_BUILD_DIR}/bin/clang" \
583 "${ABS_LLVM_BUILD_DIR}/lib/${LIBNAME}"
461 fi 584 fi
462 done 585 done
463 pushd "${LLVM_BUILD_DIR}" 586 # Run the LLVM and Clang tests.
464 ${MAKE} check-all 587 ninja -C "${LLVM_BUILD_DIR}" check-all
465 popd
466 fi 588 fi
467 589
468 # After everything is done, log success for this revision. 590 # After everything is done, log success for this revision.
469 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 591 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}"
OLDNEW
« no previous file with comments | « tools/clang/scripts/repackage.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698