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= |
| 10 |
9 # Parse command line options. | 11 # Parse command line options. |
10 while [[ $# > 0 ]]; do | 12 while [[ $# > 0 ]]; do |
11 case $1 in | 13 case $1 in |
12 --gcc-toolchain) | 14 --gcc-toolchain) |
13 shift | 15 shift |
14 if [[ $# == 0 ]]; then | 16 if [[ $# == 0 ]]; then |
15 echo "--gcc-toolchain requires an argument." | 17 echo "--gcc-toolchain requires an argument." |
16 exit 1 | 18 exit 1 |
17 fi | 19 fi |
18 if [[ -x "$1/bin/gcc" ]]; then | 20 if [[ -x "$1/bin/gcc" ]]; then |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 cp "${LLVM_LIB_DIR}/libBlinkGCPlugin.${SO_EXT}" $PDIR/lib | 105 cp "${LLVM_LIB_DIR}/libBlinkGCPlugin.${SO_EXT}" $PDIR/lib |
104 | 106 |
105 if [[ -n "${gcc_toolchain}" ]]; then | 107 if [[ -n "${gcc_toolchain}" ]]; then |
106 # Copy the stdlibc++.so.6 we linked Clang against so it can run. | 108 # Copy the stdlibc++.so.6 we linked Clang against so it can run. |
107 cp "${LLVM_LIB_DIR}/libstdc++.so.6" $PDIR/lib | 109 cp "${LLVM_LIB_DIR}/libstdc++.so.6" $PDIR/lib |
108 fi | 110 fi |
109 | 111 |
110 # Copy built-in headers (lib/clang/3.2/include). | 112 # Copy built-in headers (lib/clang/3.2/include). |
111 # libcompiler-rt puts all kinds of libraries there too, but we want only some. | 113 # libcompiler-rt puts all kinds of libraries there too, but we want only some. |
112 if [ "$(uname -s)" = "Darwin" ]; then | 114 if [ "$(uname -s)" = "Darwin" ]; then |
113 # Keep only | 115 # Keep only the OSX (ASan and profile) and iossim (ASan) runtime libraries: |
114 # Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_osx* | 116 # Release+Asserts/lib/clang/*/lib/darwin/libclang_rt.{asan,profile}_* |
115 find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/darwin*' \ | 117 find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/darwin*' \ |
116 ! -name '*asan_osx*' ! -name '*profile_osx*' | xargs rm | 118 ! -name '*asan_osx*' ! -name '*asan_iossim*' ! -name '*profile_osx*' | \ |
117 # Fix LC_ID_DYLIB for the ASan dynamic library to be relative to | 119 xargs rm |
| 120 # Fix LC_ID_DYLIB for the ASan dynamic libraries to be relative to |
118 # @executable_path. | 121 # @executable_path. |
119 # TODO(glider): this is transitional. We'll need to fix the dylib name | 122 # TODO(glider): this is transitional. We'll need to fix the dylib name |
120 # either in our build system, or in Clang. See also http://crbug.com/170629. | 123 # either in our build system, or in Clang. See also http://crbug.com/344836. |
121 ASAN_DYLIB_NAME=libclang_rt.asan_osx_dynamic.dylib | 124 ASAN_DYLIB_NAMES="libclang_rt.asan_osx_dynamic.dylib |
122 ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" -type f -path "*${ASAN_DYLIB_NAME}") | 125 libclang_rt.asan_iossim_dynamic.dylib" |
123 install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}" | 126 for ASAN_DYLIB_NAME in $ASAN_DYLIB_NAMES |
| 127 do |
| 128 ASAN_DYLIB=$(find "${LLVM_LIB_DIR}/clang" \ |
| 129 -type f -path "*${ASAN_DYLIB_NAME}") |
| 130 install_name_tool -id @executable_path/${ASAN_DYLIB_NAME} "${ASAN_DYLIB}" |
| 131 done |
124 else | 132 else |
125 # Keep only | 133 # Keep only |
126 # Release+Asserts/lib/clang/*/lib/linux/libclang_rt.{[atm]san,profile,ubsan}-*
.a | 134 # Release+Asserts/lib/clang/*/lib/linux/libclang_rt.{[atm]san,profile,ubsan}-*
.a |
127 find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \ | 135 find "${LLVM_LIB_DIR}/clang" -type f -path '*lib/linux*' \ |
128 ! -name '*[atm]san*' ! -name '*profile*' ! -name '*ubsan*' | xargs rm | 136 ! -name '*[atm]san*' ! -name '*profile*' ! -name '*ubsan*' | xargs rm |
129 fi | 137 fi |
130 | 138 |
131 cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib | 139 cp -R "${LLVM_LIB_DIR}/clang" $PDIR/lib |
132 | 140 |
133 tar zcf $PDIR.tgz -C $PDIR bin lib buildlog.txt | 141 tar zcf $PDIR.tgz -C $PDIR bin lib buildlog.txt |
134 | 142 |
135 if [ "$(uname -s)" = "Darwin" ]; then | 143 if [ "$(uname -s)" = "Darwin" ]; then |
136 PLATFORM=Mac | 144 PLATFORM=Mac |
137 else | 145 else |
138 PLATFORM=Linux_x64 | 146 PLATFORM=Linux_x64 |
139 fi | 147 fi |
140 | 148 |
141 echo To upload, run: | 149 echo To upload, run: |
142 echo gsutil cp -a public-read $PDIR.tgz \ | 150 echo gsutil cp -a public-read $PDIR.tgz \ |
143 gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz | 151 gs://chromium-browser-clang/$PLATFORM/$PDIR.tgz |
OLD | NEW |