OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # Copies a framework to its new home, "unversioning" it. | 7 # Copies a framework to its new home, "unversioning" it. |
8 # | 8 # |
9 # Normally, frameworks are versioned bundles. The contents of a framework are | 9 # Normally, frameworks are versioned bundles. The contents of a framework are |
10 # stored in a versioned directory within the bundle, and symbolic links | 10 # stored in a versioned directory within the bundle, and symbolic links |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 fi | 72 fi |
73 | 73 |
74 DESTINATION="${DESTINATION_DIR}/${FRAMEWORK_NAME}" | 74 DESTINATION="${DESTINATION_DIR}/${FRAMEWORK_NAME}" |
75 | 75 |
76 # Copy the versioned directory within the versioned framework to its | 76 # Copy the versioned directory within the versioned framework to its |
77 # destination location. | 77 # destination location. |
78 mkdir -p "${DESTINATION_DIR}" | 78 mkdir -p "${DESTINATION_DIR}" |
79 rsync -acC --delete --exclude Headers --exclude PrivateHeaders \ | 79 rsync -acC --delete --exclude Headers --exclude PrivateHeaders \ |
80 "${CURRENT_VERSION}/" "${DESTINATION}" | 80 "${CURRENT_VERSION}/" "${DESTINATION}" |
81 | 81 |
82 # The --exclude will prevent Headers and PrivateHeaders from showing up in | |
83 # ${DESTINATION} in clobber builds, but if they are already present in older | |
84 # builds, they will not be removed. Remove them manually. | |
85 # TODO(mark): Remove this after October 28, 2009, allowing two weeks for the | |
86 # transition. | |
87 rm -rf -- "${DESTINATION}/Headers" "${DESTINATION}/PrivateHeaders" | |
88 | |
89 # Adjust the Mach-O LC_ID_DYLIB load command in the framework. This does not | 82 # Adjust the Mach-O LC_ID_DYLIB load command in the framework. This does not |
90 # change the LC_LOAD_DYLIB load commands in anything that may have already | 83 # change the LC_LOAD_DYLIB load commands in anything that may have already |
91 # linked against the framework. Not all frameworks will actually need this | 84 # linked against the framework. Not all frameworks will actually need this |
92 # to be changed. Some frameworks may already be built with the proper | 85 # to be changed. Some frameworks may already be built with the proper |
93 # LC_ID_DYLIB for use as an unversioned framework. Xcode users can do this | 86 # LC_ID_DYLIB for use as an unversioned framework. Xcode users can do this |
94 # by setting LD_DYLIB_INSTALL_NAME to | 87 # by setting LD_DYLIB_INSTALL_NAME to |
95 # $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(WRAPPER_NAME)/$(PRODUCT_NAME) | 88 # $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(WRAPPER_NAME)/$(PRODUCT_NAME) |
96 # If invoking ld via gcc or g++, pass the desired path to -Wl,-install_name | 89 # If invoking ld via gcc or g++, pass the desired path to -Wl,-install_name |
97 # at link time. | 90 # at link time. |
98 FRAMEWORK_DYLIB="${DESTINATION}/${FRAMEWORK_NAME_NOEXT}" | 91 FRAMEWORK_DYLIB="${DESTINATION}/${FRAMEWORK_NAME_NOEXT}" |
99 LC_ID_DYLIB_OLD="$(otool -l "${FRAMEWORK_DYLIB}" | | 92 LC_ID_DYLIB_OLD="$(otool -l "${FRAMEWORK_DYLIB}" | |
100 grep -A10 "^ *cmd LC_ID_DYLIB$" | | 93 grep -A10 "^ *cmd LC_ID_DYLIB$" | |
101 grep -m1 "^ *name" | | 94 grep -m1 "^ *name" | |
102 sed -Ee 's/^ *name (.*) \(offset [0-9]+\)$/\1/')" | 95 sed -Ee 's/^ *name (.*) \(offset [0-9]+\)$/\1/')" |
103 VERSION_PATH="/Versions/${CURRENT_VERSION_ID}/${FRAMEWORK_NAME_NOEXT}" | 96 VERSION_PATH="/Versions/${CURRENT_VERSION_ID}/${FRAMEWORK_NAME_NOEXT}" |
104 LC_ID_DYLIB_NEW="$(echo "${LC_ID_DYLIB_OLD}" | | 97 LC_ID_DYLIB_NEW="$(echo "${LC_ID_DYLIB_OLD}" | |
105 sed -Ee "s%${VERSION_PATH}$%/${FRAMEWORK_NAME_NOEXT}%")" | 98 sed -Ee "s%${VERSION_PATH}$%/${FRAMEWORK_NAME_NOEXT}%")" |
106 | 99 |
107 if [ "${LC_ID_DYLIB_NEW}" != "${LC_ID_DYLIB_OLD}" ] ; then | 100 if [ "${LC_ID_DYLIB_NEW}" != "${LC_ID_DYLIB_OLD}" ] ; then |
108 install_name_tool -id "${LC_ID_DYLIB_NEW}" "${FRAMEWORK_DYLIB}" | 101 install_name_tool -id "${LC_ID_DYLIB_NEW}" "${FRAMEWORK_DYLIB}" |
109 fi | 102 fi |
OLD | NEW |