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

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

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