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

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

Issue 453513004: Roll Clang 214024:216630 (+216684) and switch to CMake (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up etc. Created 6 years, 4 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 | Annotate | Revision Log
« 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=215468
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_BUILD_DIR}/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)
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
(...skipping 11 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 cmake --version
223 ninja --version
224
222 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}" 225 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
223 if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \ 226 if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
224 "${LLVM_DIR}"; then 227 "${LLVM_DIR}"; then
225 echo Checkout failed, retrying 228 echo Checkout failed, retrying
226 rm -rf "${LLVM_DIR}" 229 rm -rf "${LLVM_DIR}"
227 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" 230 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}"
228 fi 231 fi
229 232
230 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" 233 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}"
231 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" 234 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 +// (PR11974) 267 +// (PR11974)
265 268
266 @import Crash; 269 @import Crash;
267 EOF 270 EOF
268 patch -p4 271 patch -p4
269 popd 272 popd
270 273
271 # Echo all commands. 274 # Echo all commands.
272 set -x 275 set -x
273 276
274 NUM_JOBS=3 277 # Set default values for CC and CXX if they're not set in the environment.
275 if [[ "${OS}" = "Linux" ]]; then 278 CC=${CC:-gcc}
Nico 2014/08/13 16:33:07 I think it's better to make this default to cc, no
hans 2014/08/13 20:31:02 Done.
276 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" 279 CXX=${CXX:-g++}
277 elif [ "${OS}" = "Darwin" -o "${OS}" = "FreeBSD" ]; then
278 NUM_JOBS="$(sysctl -n hw.ncpu)"
279 fi
280 280
281 if [[ -n "${gcc_toolchain}" ]]; then 281 if [[ -n "${gcc_toolchain}" ]]; then
282 # Use the specified gcc installation for building. 282 # Use the specified gcc installation for building.
283 export CC="$gcc_toolchain/bin/gcc" 283 CC="$gcc_toolchain/bin/gcc"
284 export CXX="$gcc_toolchain/bin/g++" 284 CXX="$gcc_toolchain/bin/g++"
285 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler, 285 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap compiler,
286 # etc.) find the .so. 286 # etc.) find the .so.
287 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))"
288 fi 288 fi
289 289
290 export CFLAGS="" 290 CFLAGS=""
291 export CXXFLAGS="" 291 CXXFLAGS=""
292 LDFLAGS=""
292 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is 293 # 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++ 294 # 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 295 # 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. 296 # OS X versions as old as 10.7.
296 # TODO(thakis): Some bots are still on 10.6, so for now bundle libc++.dylib. 297 # 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 298 # 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. 299 # change all MACOSX_DEPLOYMENT_TARGET values to 10.7.
299 if [ "${OS}" = "Darwin" ]; then 300 if [ "${OS}" = "Darwin" ]; then
300 # When building on 10.9, /usr/include usually doesn't exist, and while 301 # 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. 302 # Xcode's clang automatically sets a sysroot, self-built clangs don't.
302 export CFLAGS="-isysroot $(xcrun --show-sdk-path)" 303 CFLAGS="-isysroot $(xcrun --show-sdk-path)"
303 export CPPFLAGS="${CFLAGS}" 304 CPPFLAGS="${CFLAGS}"
304 export CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLA GS}" 305 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
305 fi 306 fi
306 307
307 # Build bootstrap clang if requested. 308 # Build bootstrap clang if requested.
308 if [[ -n "${bootstrap}" ]]; then 309 if [[ -n "${bootstrap}" ]]; then
309 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}" 310 ABS_INSTALL_DIR="${PWD}/${LLVM_BOOTSTRAP_INSTALL_DIR}"
310 echo "Building bootstrap compiler" 311 echo "Building bootstrap compiler"
311 mkdir -p "${LLVM_BOOTSTRAP_DIR}" 312 mkdir -p "${LLVM_BOOTSTRAP_DIR}"
312 pushd "${LLVM_BOOTSTRAP_DIR}" 313 pushd "${LLVM_BOOTSTRAP_DIR}"
313 if [[ ! -f ./config.status ]]; then 314
314 # The bootstrap compiler only needs to be able to build the real compiler, 315 # XXX: Want to disable libedit and pthreads.
315 # so it needs no cross-compiler output support. In general, the host 316 cmake -GNinja \
316 # compiler should be as similar to the final compiler as possible, so do 317 -DCMAKE_BUILD_TYPE=Release \
317 # keep --disable-threads & co. 318 -DLLVM_ENABLE_ASSERTIONS=ON \
318 ../llvm/configure \ 319 -DLLVM_TARGETS_TO_BUILD=host \
319 --enable-optimized \ 320 -DLLVM_ENABLE_THREADS=OFF \
320 --enable-targets=host-only \ 321 -DCMAKE_INSTALL_PREFIX="${ABS_INSTALL_DIR}" \
321 --enable-libedit=no \ 322 -DCMAKE_C_COMPILER="${CC}" \
322 --disable-threads \ 323 -DCMAKE_CXX_COMPILER="${CXX}" \
323 --disable-pthreads \ 324 -DCMAKE_C_FLAGS="${CFLAGS}" \
324 --without-llvmgcc \ 325 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
325 --without-llvmgxx \ 326 ../llvm
326 --prefix="${ABS_INSTALL_DIR}" 327
328 ninja
329 if [[ -n "${run_tests}" ]]; then
330 ninja check-all
327 fi 331 fi
328 332
329 ${MAKE} -j"${NUM_JOBS}" 333 ninja install
330 if [[ -n "${run_tests}" ]]; then
331 ${MAKE} check-all
332 fi
333
334 ${MAKE} install
335 if [[ -n "${gcc_toolchain}" ]]; then 334 if [[ -n "${gcc_toolchain}" ]]; then
336 # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap 335 # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
337 # compiler can start. 336 # compiler can start.
338 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \ 337 cp -v "$(${CXX} -print-file-name=libstdc++.so.6)" \
339 "${ABS_INSTALL_DIR}/lib/" 338 "${ABS_INSTALL_DIR}/lib/"
340 fi 339 fi
341 340
342 popd 341 popd
343 export CC="${ABS_INSTALL_DIR}/bin/clang" 342 CC="${ABS_INSTALL_DIR}/bin/clang"
344 export CXX="${ABS_INSTALL_DIR}/bin/clang++" 343 CXX="${ABS_INSTALL_DIR}/bin/clang++"
345 344
346 if [[ -n "${gcc_toolchain}" ]]; then 345 if [[ -n "${gcc_toolchain}" ]]; then
347 # Tell the bootstrap compiler to use a specific gcc prefix to search 346 # Tell the bootstrap compiler to use a specific gcc prefix to search
348 # for standard library headers and shared object file. 347 # for standard library headers and shared object file.
349 export CFLAGS="--gcc-toolchain=${gcc_toolchain}" 348 CFLAGS="--gcc-toolchain=${gcc_toolchain}"
350 export CXXFLAGS="--gcc-toolchain=${gcc_toolchain}" 349 CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
351 fi 350 fi
352 351
353 echo "Building final compiler" 352 echo "Building final compiler"
354 fi 353 fi
355 354
356 # Build clang (in a separate directory). 355 # Build clang (in a separate directory).
357 # The clang bots have this path hardcoded in built/scripts/slave/compile.py, 356 # 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. 357 # so if you change it you also need to change these links.
359 mkdir -p "${LLVM_BUILD_DIR}" 358 mkdir -p "${LLVM_BUILD_DIR}"
360 pushd "${LLVM_BUILD_DIR}" 359 pushd "${LLVM_BUILD_DIR}"
(...skipping 17 matching lines...) Expand all
378 377
379 pushd libcxxbuild 378 pushd libcxxbuild
380 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ 379 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \
381 -nodefaultlibs -current_version 1 -compatibility_version 1 \ 380 -nodefaultlibs -current_version 1 -compatibility_version 1 \
382 -lSystem -install_name @executable_path/libc++.dylib \ 381 -lSystem -install_name @executable_path/libc++.dylib \
383 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ 382 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \
384 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ 383 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \
385 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp 384 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp
386 ln -sf libc++.1.dylib libc++.dylib 385 ln -sf libc++.1.dylib libc++.dylib
387 popd 386 popd
388 export LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" 387 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
389 fi 388 fi
390 389
391 if [[ ! -f ./config.status ]]; then 390 if [[ ! -f ./CMakeCache.txt ]]; then
392 ../llvm/configure \ 391 # XXX: Disable pthreads and libedit.
393 --enable-optimized \ 392 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
394 --enable-libedit=no \ 393 -DCMAKE_BUILD_TYPE=Release \
395 --disable-threads \ 394 -DLLVM_ENABLE_ASSERTIONS=ON \
396 --disable-pthreads \ 395 -DLLVM_ENABLE_THREADS=OFF \
397 --without-llvmgcc \ 396 -DCMAKE_C_COMPILER="${CC}" \
398 --without-llvmgxx 397 -DCMAKE_CXX_COMPILER="${CXX}" \
398 -DCMAKE_C_FLAGS="${CFLAGS}" \
399 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
400 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
401 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
402 "${ABS_LLVM_DIR}"
403 env
399 fi 404 fi
400 405
401 if [[ -n "${gcc_toolchain}" ]]; then 406 if [[ -n "${gcc_toolchain}" ]]; then
402 # Copy in the right stdlibc++.so.6 so clang can start. 407 # Copy in the right stdlibc++.so.6 so clang can start.
403 mkdir -p Release+Asserts/lib 408 mkdir -p lib
404 cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" \ 409 cp -v "$(${CXX} ${CXXFLAGS} -print-file-name=libstdc++.so.6)" lib/
405 Release+Asserts/lib/
406 fi 410 fi
407 MACOSX_DEPLOYMENT_TARGET=10.5 ${MAKE} -j"${NUM_JOBS}" 411
412 ninja
Nico 2014/08/13 16:33:07 Hm, I think clang (!) reads MACOSX_DEPLOYMENT_TARG
hans 2014/08/13 20:31:02 Yes, CMake will add -mmacosx-version-min if MACOSX
413
408 STRIP_FLAGS= 414 STRIP_FLAGS=
409 if [ "${OS}" = "Darwin" ]; then 415 if [ "${OS}" = "Darwin" ]; then
410 # See http://crbug.com/256342 416 # See http://crbug.com/256342
411 STRIP_FLAGS=-x 417 STRIP_FLAGS=-x
412 418
413 cp libcxxbuild/libc++.1.dylib Release+Asserts/bin 419 cp libcxxbuild/libc++.1.dylib bin/
414 fi 420 fi
415 strip ${STRIP_FLAGS} Release+Asserts/bin/clang 421 strip ${STRIP_FLAGS} bin/clang
422 popd
423
424 # Build compiler-rt out-of-tree.
425 mkdir -p "${COMPILER_RT_BUILD_DIR}"
426 pushd "${COMPILER_RT_BUILD_DIR}"
427
428 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
429 -DCMAKE_BUILD_TYPE=Release \
430 -DLLVM_ENABLE_ASSERTIONS=ON \
431 -DLLVM_ENABLE_THREADS=OFF \
432 -DCMAKE_C_COMPILER="${CC}" \
433 -DCMAKE_CXX_COMPILER="${CXX}" \
434 -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
435 "${ABS_COMPILER_RT_DIR}"
436
437 ninja
438
439 # Copy selected output to the main tree.
440 # Darwin doesn't support cp --parents, so pipe through tar instead.
Nico 2014/08/13 16:33:07 Is this going to include .svn folders?
hans 2014/08/13 20:31:03 It would if there were any, but we never copy from
441 ABS_LLVM_CLANG_LIB_DIR=$(find ${ABS_LLVM_BUILD_DIR}/lib -path '*/clang/3.*.0')
442 tar -c *blacklist.txt | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
443 tar -c include/sanitizer | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
444 if [[ "${OS}" = "Darwin" ]]; then
445 tar -c lib/darwin | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
446 else
447 tar -c lib/linux | tar -C ${ABS_LLVM_CLANG_LIB_DIR} -xv
448 fi
Nico 2014/08/13 16:33:07 Do we want to strip compiler-rt?
hans 2014/08/13 20:31:02 We already do it for Linux in package.sh. I've add
449
416 popd 450 popd
417 451
418 if [[ -n "${with_android}" ]]; then 452 if [[ -n "${with_android}" ]]; then
419 # Make a standalone Android toolchain. 453 # Make a standalone Android toolchain.
420 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ 454 ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
421 --platform=android-14 \ 455 --platform=android-14 \
422 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \ 456 --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
423 --system=linux-x86_64 \ 457 --system=linux-x86_64 \
424 --stl=stlport 458 --stl=stlport
425 459
426 # Android NDK r9d copies a broken unwind.h into the toolchain, see 460 # Android NDK r9d copies a broken unwind.h into the toolchain, see
427 # http://crbug.com/357890 461 # http://crbug.com/357890
428 rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h 462 rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h
429 463
430 # Build ASan runtime for Android. 464 # 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 465 mkdir -p ${LLVM_BUILD_DIR}/android
432 # build the runtime, i.e. third_party/llvm/projects/compiler-rt. 466 pushd ${LLVM_BUILD_DIR}/android
433 pushd "${LLVM_BUILD_DIR}" 467 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
434 ${MAKE} -C tools/clang/runtime/ \ 468 -DCMAKE_BUILD_TYPE=Release \
435 LLVM_ANDROID_TOOLCHAIN_DIR="../../../llvm-build/android-toolchain" 469 -DLLVM_ENABLE_ASSERTIONS=ON \
470 -DLLVM_ENABLE_THREADS=OFF \
471 -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
472 -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
473 -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
474 -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../androi d-toolchain/sysroot -B${PWD}/../android-toolchain" \
475 -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../andr oid-toolchain/sysroot -B${PWD}/../android-toolchain" \
476 -DANDROID=1 \
477 "${ABS_COMPILER_RT_DIR}"
478 # XXX: Are there tests we should run for this?
479 ninja clang_rt.asan-arm-android
480
481 # And copy it into the main build tree.
482 cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/ lib/linux/"
436 popd 483 popd
437 fi 484 fi
438 485
439 # Build Chrome-specific clang tools. Paths in this list should be relative to 486 # Build Chrome-specific clang tools. Paths in this list should be relative to
440 # tools/clang. 487 # tools/clang.
441 # For each tool directory, copy it into the clang tree and use clang's build 488 # For each tool directory, copy it into the clang tree and use clang's build
442 # system to compile it. 489 # system to compile it.
443 for CHROME_TOOL_DIR in ${chrome_tools}; do 490 for CHROME_TOOL_DIR in ${chrome_tools}; do
444 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" 491 TOOL_SRC_DIR="${PWD}/${THIS_DIR}/../${CHROME_TOOL_DIR}"
445 TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" 492 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}" 493
447 rm -rf "${TOOL_DST_DIR}"
448 cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}"
449 rm -rf "${TOOL_BUILD_DIR}" 494 rm -rf "${TOOL_BUILD_DIR}"
450 mkdir -p "${TOOL_BUILD_DIR}" 495 mkdir -p "${TOOL_BUILD_DIR}"
451 cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}" 496 pushd "${TOOL_BUILD_DIR}"
452 MACOSX_DEPLOYMENT_TARGET=10.5 ${MAKE} -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}" 497 MACOSX_DEPLOYMENT_TARGET=10.6 cmake -GNinja \
498 -DLLVM_BUILD_DIR="${ABS_LLVM_BUILD_DIR}" \
499 -DLLVM_SRC_DIR="${ABS_LLVM_DIR}" \
500 -DCMAKE_C_COMPILER="${CC}" \
501 -DCMAKE_CXX_COMPILER="${CXX}" \
502 -DCMAKE_C_FLAGS="${CFLAGS}" \
503 -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
Nico 2014/08/13 16:33:07 Most of these flags are the same every time, maybe
hans 2014/08/13 20:31:02 Yeah :/ When we move this to the .py script one da
504 -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
505 -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
506 "${TOOL_SRC_DIR}"
507 ninja
508 cp -v "${TOOL_BUILD_DIR}/lib"/* "${ABS_LLVM_BUILD_DIR}/lib/"
509 popd
453 done 510 done
454 511
455 if [[ -n "$run_tests" ]]; then 512 if [[ -n "$run_tests" ]]; then
456 # Run a few tests. 513 # Run the tests for each chrome tool.
457 for CHROME_TOOL_DIR in ${chrome_tools}; do 514 for CHROME_TOOL_DIR in ${chrome_tools}; do
458 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" 515 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}"
516 TOOL_BUILD_DIR="${ABS_LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL _DIR}"
459 if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then 517 if [[ -f "${TOOL_SRC_DIR}/tests/test.sh" ]]; then
460 "${TOOL_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" 518 # XXX: The script should know the name of the plugin, not just the dir.
519 "${TOOL_SRC_DIR}/tests/test.sh" "${ABS_LLVM_BUILD_DIR}/bin/clang" "${TOOL_ BUILD_DIR}/lib"/*
461 fi 520 fi
462 done 521 done
463 pushd "${LLVM_BUILD_DIR}" 522 # Run the LLVM and Clang tests.
464 ${MAKE} check-all 523 #ninja -C "${LLVM_BUILD_DIR}" check-all
465 popd 524 #ninja -C "${COMPILER_RT_BUILD_DIR}" check
466 fi 525 fi
467 526
468 # After everything is done, log success for this revision. 527 # After everything is done, log success for this revision.
469 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" 528 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