OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 |
| 3 # Copyright (c) 2008 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # This is a handy wrapper script that figures out how to call the strip |
| 8 # utility (strip_save_dsym in this case), if it even needs to be called at all, |
| 9 # and then does it. This script should be called by a post-link phase in |
| 10 # targets that might generate Mach-O executables, dynamic libraries, or |
| 11 # loadable bundles. |
| 12 # |
| 13 # An example "Strip If Needed" build phase placed after "Link Binary With |
| 14 # Libraries" would do: |
| 15 # exec "${XCODEPROJ_DEPTH}/build/mac/strip_from_xcode" |
| 16 |
| 17 if [ "${CONFIGURATION}" != "Release" ] ; then |
| 18 # Only strip in release mode. |
| 19 exit 0 |
| 20 fi |
| 21 |
| 22 # MACH_O_TYPE is not set for a command-line tool, so check PRODUCT_TYPE too. |
| 23 # Weird. |
| 24 if [ "${MACH_O_TYPE}" = "mh_execute" ] || \ |
| 25 [ "${PRODUCT_TYPE}" = "com.apple.product-type.tool" ] ; then |
| 26 # Strip everything |
| 27 STRIPFLAGS= |
| 28 elif [ "${MACH_O_TYPE}" = "mh_dylib" ] || \ |
| 29 "${MACH_O_TYPE}" = "mh_bundle" ]; then |
| 30 # Strip debugging symbols and local symbols |
| 31 STRIPFLAGS="-S -x" |
| 32 elif [ "${MACH_O_TYPE}" = "staticlib" ] ; then |
| 33 # Don't strip static libraries. |
| 34 exit 0 |
| 35 else |
| 36 # Warn, but don't treat this as an error. |
| 37 echo $0: warning: unrecognized MACH_O_TYPE ${MACH_O_TYPE} |
| 38 exit 0 |
| 39 fi |
| 40 |
| 41 exec "$(dirname ${0})/strip_save_dsym" ${STRIPFLAGS} \ |
| 42 "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" |
OLD | NEW |