1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/build/mac/strip_from_xcode Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +#!/bin/bash 1.5 + 1.6 +# Copyright (c) 2008 The Chromium Authors. All rights reserved. 1.7 +# Use of this source code is governed by a BSD-style license that can be 1.8 +# found in the LICENSE file. 1.9 + 1.10 +# This is a handy wrapper script that figures out how to call the strip 1.11 +# utility (strip_save_dsym in this case), if it even needs to be called at all, 1.12 +# and then does it. This script should be called by a post-link phase in 1.13 +# targets that might generate Mach-O executables, dynamic libraries, or 1.14 +# loadable bundles. 1.15 +# 1.16 +# An example "Strip If Needed" build phase placed after "Link Binary With 1.17 +# Libraries" would do: 1.18 +# exec "${XCODEPROJ_DEPTH}/build/mac/strip_from_xcode" 1.19 + 1.20 +if [ "${CONFIGURATION}" != "Release" ] ; then 1.21 + # Only strip in release mode. 1.22 + exit 0 1.23 +fi 1.24 + 1.25 +declare -a FLAGS 1.26 + 1.27 +# MACH_O_TYPE is not set for a command-line tool, so check PRODUCT_TYPE too. 1.28 +# Weird. 1.29 +if [ "${MACH_O_TYPE}" = "mh_execute" ] || \ 1.30 + [ "${PRODUCT_TYPE}" = "com.apple.product-type.tool" ] ; then 1.31 + # Strip everything (no special flags). No-op. 1.32 + true 1.33 +elif [ "${MACH_O_TYPE}" = "mh_dylib" ] || \ 1.34 + [ "${MACH_O_TYPE}" = "mh_bundle" ]; then 1.35 + # Strip debugging symbols and local symbols 1.36 + FLAGS[${#FLAGS[@]}]=-S 1.37 + FLAGS[${#FLAGS[@]}]=-x 1.38 +elif [ "${MACH_O_TYPE}" = "staticlib" ] ; then 1.39 + # Don't strip static libraries. 1.40 + exit 0 1.41 +else 1.42 + # Warn, but don't treat this as an error. 1.43 + echo $0: warning: unrecognized MACH_O_TYPE ${MACH_O_TYPE} 1.44 + exit 0 1.45 +fi 1.46 + 1.47 +if [ -n "${STRIPFLAGS}" ] ; then 1.48 + # Pick up the standard STRIPFLAGS Xcode setting, used for "Additional Strip 1.49 + # Flags". 1.50 + for stripflag in "${STRIPFLAGS}" ; do 1.51 + FLAGS[${#FLAGS[@]}]="${stripflag}" 1.52 + done 1.53 +fi 1.54 + 1.55 +if [ -n "${CHROMIUM_STRIP_SAVE_FILE}" ] ; then 1.56 + # An Xcode project can communicate a file listing symbols to saved in this 1.57 + # environment variable by setting it as a build setting. This isn't a 1.58 + # standard Xcode setting. It's used in preference to STRIPFLAGS to 1.59 + # eliminate quoting ambiguity concerns. 1.60 + FLAGS[${#FLAGS[@]}]=-s 1.61 + FLAGS[${#FLAGS[@]}]="${CHROMIUM_STRIP_SAVE_FILE}" 1.62 +fi 1.63 + 1.64 +exec "$(dirname ${0})/strip_save_dsym" "${FLAGS[@]}" \ 1.65 + "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"