| OLD | NEW | 
|---|
| 1 #!/bin/bash | 1 #!/bin/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, and then package the results up | 6 # This script will check out llvm and clang, and then package the results up | 
| 7 # to a tgz file. | 7 # to a tgz file. | 
| 8 | 8 | 
| 9 gcc_toolchain= | 9 gcc_toolchain= | 
| 10 | 10 | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 52 LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build" | 52 LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build" | 
| 53 LLVM_BIN_DIR="${LLVM_BUILD_DIR}/Release+Asserts/bin" | 53 LLVM_BIN_DIR="${LLVM_BUILD_DIR}/Release+Asserts/bin" | 
| 54 LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib" | 54 LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib" | 
| 55 | 55 | 
| 56 echo "Diff in llvm:" | tee buildlog.txt | 56 echo "Diff in llvm:" | tee buildlog.txt | 
| 57 svn stat "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt | 57 svn stat "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt | 
| 58 svn diff "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt | 58 svn diff "${LLVM_DIR}" 2>&1 | tee -a buildlog.txt | 
| 59 echo "Diff in llvm/tools/clang:" | tee -a buildlog.txt | 59 echo "Diff in llvm/tools/clang:" | tee -a buildlog.txt | 
| 60 svn stat "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt | 60 svn stat "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt | 
| 61 svn diff "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt | 61 svn diff "${LLVM_DIR}/tools/clang" 2>&1 | tee -a buildlog.txt | 
| 62 echo "Diff in llvm/compiler-rt:" | tee -a buildlog.txt | 62 echo "Diff in llvm/projects/compiler-rt:" | tee -a buildlog.txt | 
| 63 svn stat "${LLVM_DIR}/compiler-rt" 2>&1 | tee -a buildlog.txt | 63 svn stat "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt | 
| 64 svn diff "${LLVM_DIR}/compiler-rt" 2>&1 | tee -a buildlog.txt | 64 svn diff "${LLVM_DIR}/projects/compiler-rt" 2>&1 | tee -a buildlog.txt | 
| 65 echo "Diff in llvm/projects/libcxx:" | tee -a buildlog.txt |  | 
| 66 svn stat "${LLVM_DIR}/projects/libcxx" 2>&1 | tee -a buildlog.txt |  | 
| 67 svn diff "${LLVM_DIR}/projects/libcxx" 2>&1 | tee -a buildlog.txt |  | 
| 68 echo "Diff in llvm/projects/libcxxabi:" | tee -a buildlog.txt |  | 
| 69 svn stat "${LLVM_DIR}/projects/libcxxabi" 2>&1 | tee -a buildlog.txt |  | 
| 70 svn diff "${LLVM_DIR}/projects/libcxxabi" 2>&1 | tee -a buildlog.txt |  | 
| 71 |  | 
| 72 | 65 | 
| 73 echo "Starting build" | tee -a buildlog.txt | 66 echo "Starting build" | tee -a buildlog.txt | 
| 74 | 67 | 
| 75 set -exu | 68 set -exu | 
| 76 | 69 | 
| 77 # Do a clobber build. | 70 # Do a clobber build. | 
| 78 rm -rf "${LLVM_BOOTSTRAP_DIR}" | 71 rm -rf "${LLVM_BOOTSTRAP_DIR}" | 
| 79 rm -rf "${LLVM_BOOTSTRAP_INSTALL_DIR}" | 72 rm -rf "${LLVM_BOOTSTRAP_INSTALL_DIR}" | 
| 80 rm -rf "${LLVM_BUILD_DIR}" | 73 rm -rf "${LLVM_BUILD_DIR}" | 
| 81 extra_flags= | 74 extra_flags= | 
| 82 if [[ -n "${gcc_toolchain}" ]]; then | 75 if [[ -n "${gcc_toolchain}" ]]; then | 
| 83   extra_flags="--gcc-toolchain ${gcc_toolchain}" | 76   extra_flags="--gcc-toolchain ${gcc_toolchain}" | 
| 84 fi | 77 fi | 
| 85 "${THIS_DIR}"/update.sh --bootstrap --force-local-build --run-tests \ | 78 "${THIS_DIR}"/update.sh --bootstrap --force-local-build --run-tests \ | 
| 86     ${extra_flags} 2>&1 | tee -a buildlog.txt | 79     ${extra_flags} 2>&1 | tee -a buildlog.txt | 
| 87 | 80 | 
| 88 R=$("${LLVM_BIN_DIR}/clang" --version | \ | 81 R=$("${LLVM_BIN_DIR}/clang" --version | \ | 
| 89      sed -ne 's/clang version .*(\([0-9]*\))/\1/p') | 82      sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p') | 
| 90 | 83 | 
| 91 PDIR=clang-$R | 84 PDIR=clang-$R | 
| 92 rm -rf $PDIR | 85 rm -rf $PDIR | 
| 93 mkdir $PDIR | 86 mkdir $PDIR | 
| 94 mkdir $PDIR/bin | 87 mkdir $PDIR/bin | 
| 95 mkdir $PDIR/lib | 88 mkdir $PDIR/lib | 
| 96 | 89 | 
| 97 if [ "$(uname -s)" = "Darwin" ]; then | 90 if [ "$(uname -s)" = "Darwin" ]; then | 
| 98   SO_EXT="dylib" | 91   SO_EXT="dylib" | 
| 99 else | 92 else | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 116 if [ "$(uname -s)" = "Darwin" ]; then | 109 if [ "$(uname -s)" = "Darwin" ]; then | 
| 117   mkdir $PDIR/include | 110   mkdir $PDIR/include | 
| 118   cp -R "${LLVM_BOOTSTRAP_INSTALL_DIR}/include/c++" $PDIR/include | 111   cp -R "${LLVM_BOOTSTRAP_INSTALL_DIR}/include/c++" $PDIR/include | 
| 119 fi | 112 fi | 
| 120 | 113 | 
| 121 # Copy plugins. Some of the dylibs are pretty big, so copy only the ones we | 114 # Copy plugins. Some of the dylibs are pretty big, so copy only the ones we | 
| 122 # care about. | 115 # care about. | 
| 123 cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib | 116 cp "${LLVM_LIB_DIR}/libFindBadConstructs.${SO_EXT}" $PDIR/lib | 
| 124 | 117 | 
| 125 BLINKGCPLUGIN_LIBNAME=\ | 118 BLINKGCPLUGIN_LIBNAME=\ | 
| 126 $(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \ | 119 $(grep LIBRARYNAME "$THIS_DIR"/../blink_gc_plugin/Makefile \ | 
| 127     | cut -d ' ' -f 2 | tr -d ')') | 120     | cut -d ' ' -f 3) | 
| 128 cp "${LLVM_LIB_DIR}/lib${BLINKGCPLUGIN_LIBNAME}.${SO_EXT}" $PDIR/lib | 121 cp "${LLVM_LIB_DIR}/lib${BLINKGCPLUGIN_LIBNAME}.${SO_EXT}" $PDIR/lib | 
| 129 | 122 | 
| 130 if [[ -n "${gcc_toolchain}" ]]; then | 123 if [[ -n "${gcc_toolchain}" ]]; then | 
| 131   # Copy the stdlibc++.so.6 we linked Clang against so it can run. | 124   # Copy the stdlibc++.so.6 we linked Clang against so it can run. | 
| 132   cp "${LLVM_LIB_DIR}/libstdc++.so.6" $PDIR/lib | 125   cp "${LLVM_LIB_DIR}/libstdc++.so.6" $PDIR/lib | 
| 133 fi | 126 fi | 
| 134 | 127 | 
| 135 # Copy built-in headers (lib/clang/3.x.y/include). | 128 # Copy built-in headers (lib/clang/3.x.y/include). | 
| 136 # compiler-rt builds all kinds of libraries, but we want only some. | 129 # libcompiler-rt puts all kinds of libraries there too, but we want only some. | 
| 137 if [ "$(uname -s)" = "Darwin" ]; then | 130 if [ "$(uname -s)" = "Darwin" ]; then | 
| 138   # Keep only the OSX (ASan and profile) and iossim (ASan) runtime libraries: | 131   # Keep only the OSX (ASan and profile) and iossim (ASan) runtime libraries: | 
| 139   # Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_* | 132   # Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_* | 
| 140   find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/darwin*' \ | 133   find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/darwin*' \ | 
| 141        ! -name '*asan_osx*' ! -name '*asan_iossim*' ! -name '*profile_osx*' | \ | 134        ! -name '*asan_osx*' ! -name '*asan_iossim*' ! -name '*profile_osx*' | \ | 
| 142       xargs rm | 135       xargs rm | 
| 143   # Fix LC_ID_DYLIB for the ASan dynamic libraries to be relative to | 136   # Fix LC_ID_DYLIB for the ASan dynamic libraries to be relative to | 
| 144   # @executable_path. | 137   # @executable_path. | 
| 145   # TODO(glider): this is transitional. We'll need to fix the dylib name | 138   # TODO(glider): this is transitional. We'll need to fix the dylib name | 
| 146   # either in our build system, or in Clang. See also http://crbug.com/344836. | 139   # either in our build system, or in Clang. See also http://crbug.com/344836. | 
| 147   ASAN_DYLIB_NAMES="libclang_rt.asan_osx_dynamic.dylib | 140   ASAN_DYLIB_NAMES="libclang_rt.asan_osx_dynamic.dylib | 
| 148     libclang_rt.asan_iossim_dynamic.dylib" | 141     libclang_rt.asan_iossim_dynamic.dylib" | 
| 149   for ASAN_DYLIB_NAME in $ASAN_DYLIB_NAMES | 142   for ASAN_DYLIB_NAME in $ASAN_DYLIB_NAMES | 
| 150   do | 143   do | 
| 151     ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" \ | 144     ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" \ | 
| 152                       -type f -path "*${ASAN_DYLIB_NAME}") | 145                       -type f -path "*${ASAN_DYLIB_NAME}") | 
| 153     install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}" | 146     install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}" | 
| 154     strip -x "${ASAN_DYLIB}" |  | 
| 155   done | 147   done | 
| 156 else | 148 else | 
| 157   # Keep only | 149   # Keep only | 
| 158   # Release+Asserts/lib/clang/*/lib/linux/libclang_rt.{[atm]san,san,ubsan,profil
     e}-*.a | 150   # Release+Asserts/lib/clang/*/lib/linux/libclang_rt.{[atm]san,san,ubsan,profil
     e}-*.a | 
| 159   # , but not dfsan. | 151   # , but not dfsan. | 
| 160   find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \ | 152   find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \ | 
| 161        ! -name '*[atm]san*' ! -name '*ubsan*' ! -name '*libclang_rt.san*' \ | 153        ! -name '*[atm]san*' ! -name '*ubsan*' ! -name '*libclang_rt.san*' \ | 
| 162        ! -name '*profile*' | xargs rm -v | 154        ! -name '*profile*' | xargs rm | 
| 163   # Strip the debug info from the runtime libraries. | 155   # Strip the debug info from the runtime libraries. | 
| 164   find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' ! -name '*.syms' | xa
     rgs strip -g | 156   find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' | xargs strip -g | 
| 165 fi | 157 fi | 
| 166 | 158 | 
| 167 cp -vR "${LLVM_LIB_DIR}/clang" $PDIR/lib | 159 cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib | 
| 168 | 160 | 
| 169 if [ "$(uname -s)" = "Darwin" ]; then | 161 if [ "$(uname -s)" = "Darwin" ]; then | 
| 170   tar zcf $PDIR.tgz -C $PDIR bin include lib buildlog.txt | 162   tar zcf $PDIR.tgz -C $PDIR bin include lib buildlog.txt | 
| 171 else | 163 else | 
| 172   tar zcf $PDIR.tgz -C $PDIR bin lib buildlog.txt | 164   tar zcf $PDIR.tgz -C $PDIR bin lib buildlog.txt | 
| 173 fi | 165 fi | 
| 174 | 166 | 
| 175 if [ "$(uname -s)" = "Darwin" ]; then | 167 if [ "$(uname -s)" = "Darwin" ]; then | 
| 176   PLATFORM=Mac | 168   PLATFORM=Mac | 
| 177 else | 169 else | 
| 178   PLATFORM=Linux_x64 | 170   PLATFORM=Linux_x64 | 
| 179 fi | 171 fi | 
| 180 | 172 | 
| 181 echo To upload, run: | 173 echo To upload, run: | 
| 182 echo gsutil cp -a public-read $PDIR.tgz \ | 174 echo gsutil cp -a public-read $PDIR.tgz \ | 
| 183      gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz | 175      gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz | 
| OLD | NEW | 
|---|