| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 | |
| 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 | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # This script expects the following environment variables to be set. Xcode | |
| 8 # normally sets them: | |
| 9 # | |
| 10 # CONFIGURATION - Release or Debug; this script only operates when Release. | |
| 11 # SRCROOT - /path/to/chrome/src/chrome | |
| 12 # BUILT_PRODUTS_DIR - /path/to/chrome/src/xcodebuild/Release | |
| 13 # | |
| 14 # The script also takes a single argument defining the branding type. | |
| 15 # | |
| 16 # To test this script without running an entire build: | |
| 17 # | |
| 18 # cd /path/to/chrome/src/chrome | |
| 19 # CONFIGURATION=Release \ | |
| 20 # SRCROOT=$(pwd) \ | |
| 21 # BUILT_PRODUCTS_DIR=$(pwd)/../xcodebuild/Release \ | |
| 22 # ../build/mac/dump_app_syms Chromium | |
| 23 | |
| 24 # Make sure we got the header to write into passed to us | |
| 25 if [ $# -ne 1 ]; then | |
| 26 echo "error: missing branding as an argument" >&2 | |
| 27 exit 1 | |
| 28 fi | |
| 29 | |
| 30 set -ex | |
| 31 | |
| 32 # Skip out if we're aren't in Release mode, no need for dump_syms on debug runs. | |
| 33 if [ "${CONFIGURATION}" != "Release" ] ; then | |
| 34 exit 0 | |
| 35 fi | |
| 36 | |
| 37 TOP="${SRCROOT}/.." | |
| 38 BUILD_BRANDING=$1 | |
| 39 | |
| 40 BRAND_SCRIPT="${TOP}/build/branding_value.sh" | |
| 41 SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME) | |
| 42 . "${TOP}/chrome/VERSION" | |
| 43 | |
| 44 BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms" | |
| 45 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" | |
| 46 ARCH="i386" | |
| 47 | |
| 48 DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.dSYM.tar.bz2" | |
| 49 | |
| 50 declare -a DSYMS | |
| 51 | |
| 52 for SRC_NAME in "${SRC_APP_NAME}.app" \ | |
| 53 "${SRC_APP_NAME} Framework.framework" \ | |
| 54 "${SRC_APP_NAME} Helper.app" \ | |
| 55 "plugin_carbon_interpose.dylib" ; do | |
| 56 # SRC_STEM is the name of the file within the DWARF directory of the .dSYM | |
| 57 # bundle, which comes from the on-disk name of an executable or dylib within | |
| 58 # its enclosing .app or .framework bundle. This is the bundle name without | |
| 59 # .app or .framework appended. For non-bundled types, the stem is just the | |
| 60 # name of the singular file on disk. | |
| 61 SRC_STEM=$(echo "${SRC_NAME}" | sed -Ee 's/^(.*)\.(app|framework)$/\1/') | |
| 62 DSYM_NAME="${SRC_NAME}.dSYM" | |
| 63 DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" | |
| 64 DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}" | |
| 65 BPAD_SYM_NAME="${SRC_NAME}-${FULL_VERSION}-${ARCH}.breakpad" | |
| 66 BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}" | |
| 67 | |
| 68 # Only run dump_syms if the file has changed since the last dump. | |
| 69 if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then | |
| 70 "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" "${DWARF_PATH}" > "${BPAD_SYM_PATH}" | |
| 71 fi | |
| 72 | |
| 73 # Remove the .dSYM archive if the file has changed since the archive was | |
| 74 # last generated. This will cause a new .dSYM archive to be created. | |
| 75 if [ "${DWARF_PATH}" -nt "${DSYM_TAR_PATH}" ] ; then | |
| 76 rm -f "${DSYM_TAR_PATH}" | |
| 77 fi | |
| 78 | |
| 79 # Push the .dSYM bundle onto the DSYMS array so that it will be included in | |
| 80 # the .dSYM archive if a new one is needed | |
| 81 DSYMS[${#DSYMS[@]}]="${DSYM_NAME}" | |
| 82 done | |
| 83 | |
| 84 # Create the archive of .dSYM bundles. | |
| 85 if [ ! -e "${DSYM_TAR_PATH}" ] ; then | |
| 86 # Change directory so that absolute paths aren't included in the archive. | |
| 87 (cd "${BUILT_PRODUCTS_DIR}" && | |
| 88 tar -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}") | |
| 89 fi | |
| OLD | NEW |