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