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
4 # found in the LICENSE file.
6 # This script will check out llvm and clang, and then package the results up
9 THIS_DIR
="$(dirname "${0}")"
10 LLVM_DIR
="${THIS_DIR}/../../../third_party/llvm"
11 LLVM_BOOTSTRAP_DIR
="${THIS_DIR}/../../../third_party/llvm-bootstrap"
12 LLVM_BUILD_DIR
="${THIS_DIR}/../../../third_party/llvm-build"
13 LLVM_BIN_DIR
="${LLVM_BUILD_DIR}/Release+Asserts/bin"
14 LLVM_LIB_DIR
="${LLVM_BUILD_DIR}/Release+Asserts/lib"
16 echo "Diff in llvm:" |
tee buildlog.txt
17 svn stat
"${LLVM_DIR}" 2>&1 |
tee -a buildlog.txt
18 svn
diff "${LLVM_DIR}" 2>&1 |
tee -a buildlog.txt
19 echo "Diff in llvm/tools/clang:" |
tee -a buildlog.txt
20 svn stat
"${LLVM_DIR}/tools/clang" 2>&1 |
tee -a buildlog.txt
21 svn
diff "${LLVM_DIR}/tools/clang" 2>&1 |
tee -a buildlog.txt
22 echo "Diff in llvm/projects/compiler-rt:" |
tee -a buildlog.txt
23 svn stat
"${LLVM_DIR}/projects/compiler-rt" 2>&1 |
tee -a buildlog.txt
24 svn
diff "${LLVM_DIR}/projects/compiler-rt" 2>&1 |
tee -a buildlog.txt
26 echo "Starting build" |
tee -a buildlog.txt
31 rm -rf "${LLVM_BOOTSTRAP_DIR}"
32 rm -rf "${LLVM_BUILD_DIR}"
33 "${THIS_DIR}"/update.sh
--run-tests --bootstrap --force-local-build 2>&1 | \
36 R
=$
("${LLVM_BIN_DIR}/clang" --version | \
37 sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
45 if [ "$(uname -s)" = "Darwin" ]; then
52 cp buildlog.txt
$PDIR/
54 # Copy clang into pdir, symlink clang++ to it.
55 cp "${LLVM_BIN_DIR}/clang" $PDIR/bin
/
56 (cd $PDIR/bin
&& ln -sf clang clang
++ && cd -)
57 cp "${LLVM_BIN_DIR}/llvm-symbolizer" $PDIR/bin
/
59 # Copy plugins. Some of the dylibs are pretty big, so copy only the ones we
61 cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib
62 cp "${LLVM_LIB_DIR}/libprofile_rt.${SO_EXT}" $PDIR/lib
64 # Copy built-in headers (lib/clang/3.2/include).
65 # libcompiler-rt puts all kinds of libraries there too, but we want only ASan.
66 if [ "$(uname -s)" = "Darwin" ]; then
67 # Keep only Release+Asserts/lib/clang/3.2/lib/darwin/libclang_rt.asan_osx.a
68 find "${LLVM_LIB_DIR}/clang" -type f
-path '*lib/darwin*' |
grep -v asan | \
70 # Fix LC_ID_DYLIB for the ASan dynamic library to be relative to
72 # TODO(glider): this is transitional. We'll need to fix the dylib name
73 # either in our build system, or in Clang. See also http://crbug.com/170629.
74 ASAN_DYLIB_NAME
=libclang_rt.asan_osx_dynamic.dylib
75 ASAN_DYLIB
=$
(find "${LLVM_LIB_DIR}/clang" -type f
-path "*${ASAN_DYLIB_NAME}")
76 install_name_tool
-id @executable_path
/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}"
79 # Release+Asserts/lib/clang/3.2/lib/linux/libclang_rt.{a,t,m}san-x86_64.a
80 # TODO(thakis): Make sure the 32bit version of ASan runtime is kept too once
81 # that's built. TSan and MSan runtimes exist only for 64 bits.
82 find "${LLVM_LIB_DIR}/clang" -type f
-path '*lib/linux*' | \
83 grep -v "asan\|tsan\|msan" |
xargs rm
86 cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib
88 tar zcf
$PDIR.tgz
-C $PDIR bin lib buildlog.txt
90 if [ "$(uname -s)" = "Darwin" ]; then
97 echo gsutil
cp -a public-read
$PDIR.tgz \
98 gs
://chromium-browser-clang
/$PLATFORM/$PDIR.tgz