OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # For app bundles built with ASan, copies the runtime lib | 7 # For app bundles built with ASan, copies the runtime lib |
8 # (libclang_rt.asan_osx_dynamic.dylib), on which their executables depend, from | 8 # (libclang_rt.asan_osx_dynamic.dylib), on which their executables depend, from |
9 # the compiler installation path into the bundle and fixes the dylib's install | 9 # the compiler installation path into the bundle and fixes the dylib's install |
10 # name in the binary to be relative to @executable_path. | 10 # name in the binary to be relative to @executable_path. |
(...skipping 20 matching lines...) Expand all Loading... | |
31 ASAN_DYLIB_NAME=libclang_rt.asan_osx_dynamic.dylib | 31 ASAN_DYLIB_NAME=libclang_rt.asan_osx_dynamic.dylib |
32 fi | 32 fi |
33 | 33 |
34 if [[ -z "${BUILTIN_DYLIB_PATH}" ]]; then | 34 if [[ -z "${BUILTIN_DYLIB_PATH}" ]]; then |
35 echo "${BINARY} does not depend on the ASan runtime library!" >&2 | 35 echo "${BINARY} does not depend on the ASan runtime library!" >&2 |
36 exit 1 | 36 exit 1 |
37 fi | 37 fi |
38 | 38 |
39 # TODO(glider): this doesn't work if we set CC and CXX to override the default | 39 # TODO(glider): this doesn't work if we set CC and CXX to override the default |
40 # Clang. | 40 # Clang. |
41 ASAN_DYLIB=$(find \ | 41 ASAN_DYLIB="../../third_party/llvm-build/Release+Asserts/lib/clang/$(python ../. ./tools/clang/scripts/update.py --print-clang-version)/lib/darwin/${ASAN_DYLIB_N AME}" |
Nico
2016/01/14 17:05:18
you probably want to keep ${BUILT_PRODUCTS_DIR} at
hans
2016/01/14 17:35:56
Gah, I somehow missed that one.
| |
42 "${BUILT_PRODUCTS_DIR}/../../third_party/llvm-build/Release+Asserts/lib/clan g/" \ | |
43 -type f -path "*${ASAN_DYLIB_NAME}") | |
44 | 42 |
45 DYLIB_BASENAME=$(basename "${ASAN_DYLIB}") | 43 DYLIB_BASENAME=$(basename "${ASAN_DYLIB}") |
46 if [[ "${DYLIB_BASENAME}" != "${ASAN_DYLIB_NAME}" ]]; then | 44 if [[ "${DYLIB_BASENAME}" != "${ASAN_DYLIB_NAME}" ]]; then |
47 echo "basename(${ASAN_DYLIB}) != ${ASAN_DYLIB_NAME}" >&2 | 45 echo "basename(${ASAN_DYLIB}) != ${ASAN_DYLIB_NAME}" >&2 |
48 exit 1 | 46 exit 1 |
49 fi | 47 fi |
50 | 48 |
51 # Check whether the directory containing the executable binary is named | 49 # Check whether the directory containing the executable binary is named |
52 # "MacOS". In this case we're building a full-fledged OSX app and will put | 50 # "MacOS". In this case we're building a full-fledged OSX app and will put |
53 # the runtime into appname.app/Contents/Libraries/. Otherwise this is probably | 51 # the runtime into appname.app/Contents/Libraries/. Otherwise this is probably |
(...skipping 13 matching lines...) Expand all Loading... | |
67 # Make LC_ID_DYLIB of the runtime copy point to its location. | 65 # Make LC_ID_DYLIB of the runtime copy point to its location. |
68 install_name_tool \ | 66 install_name_tool \ |
69 -id "${NEW_LC_ID_DYLIB}" \ | 67 -id "${NEW_LC_ID_DYLIB}" \ |
70 "${LIBRARIES_DIR}/${ASAN_DYLIB_NAME}" | 68 "${LIBRARIES_DIR}/${ASAN_DYLIB_NAME}" |
71 | 69 |
72 # Fix the rpath to the runtime library recorded in the binary. | 70 # Fix the rpath to the runtime library recorded in the binary. |
73 install_name_tool \ | 71 install_name_tool \ |
74 -change "${BUILTIN_DYLIB_PATH}" \ | 72 -change "${BUILTIN_DYLIB_PATH}" \ |
75 "${NEW_LC_ID_DYLIB}" \ | 73 "${NEW_LC_ID_DYLIB}" \ |
76 "${BINARY}" | 74 "${BINARY}" |
OLD | NEW |