OLD | NEW |
1 #!/bin/sh | 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 # 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 |
7 # Make sure we got the header to write into passed to us | 24 # Make sure we got the header to write into passed to us |
8 if [ $# -ne 1 ]; then | 25 if [ $# -ne 1 ]; then |
9 echo "error: missing branding as an argument" >&2 | 26 echo "error: missing branding as an argument" >&2 |
10 exit 1 | 27 exit 1 |
11 fi | 28 fi |
12 | 29 |
13 set -ex | 30 set -ex |
14 | 31 |
15 # Skip out if we're aren't in Release mode, no need for dump_syms on debug runs. | 32 # Skip out if we're aren't in Release mode, no need for dump_syms on debug runs. |
16 if [ "${CONFIGURATION}" != "Release" ] ; then | 33 if [ "${CONFIGURATION}" != "Release" ] ; then |
17 exit 0 | 34 exit 0 |
18 fi | 35 fi |
19 | 36 |
20 TOP="${SRCROOT}/.." | 37 TOP="${SRCROOT}/.." |
21 BUILD_BRANDING=$1 | 38 BUILD_BRANDING=$1 |
22 | 39 |
23 BRAND_SCRIPT="${TOP}/build/branding_value.sh" | 40 BRAND_SCRIPT="${TOP}/build/branding_value.sh" |
24 SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME) | 41 SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME) |
25 . "${TOP}/chrome/VERSION" | 42 . "${TOP}/chrome/VERSION" |
26 | 43 |
27 BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms" | 44 BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms" |
28 BREAKPAD_PRODUCT_ID="${BUILD_BRANDING}_Mac" | |
29 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" | 45 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" |
30 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.app" | 46 ARCH="i386" |
31 # Created by the build/mac/strip_from_xcode script. | |
32 UNSTRIPPED_APP="${SRC_APP_PATH}.dSYM/Contents/Resources/DWARF/${SRC_APP_NAME}" | |
33 APP_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}-${FULL_VERSION}-i386.brea
kpad" | |
34 | 47 |
35 # Only run dump_syms if the file has changed since we last did a dump. | 48 DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.dSYM.tar.bz2" |
36 if [ "${UNSTRIPPED_APP}" -nt "${APP_SYMBOL_FILE}" ] ; then | 49 |
37 "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_APP}" > "${APP_SYMBOL_FILE}" | 50 declare -a DSYMS |
| 51 |
| 52 for SRC_BUNDLE in "${SRC_APP_NAME}.app" \ |
| 53 "${SRC_APP_NAME} Framework.framework" \ |
| 54 "${SRC_APP_NAME} Helper.app" ; do |
| 55 SRC_STEM=$(echo "${SRC_BUNDLE}" | sed -Ee 's/^(.*)\..*$/\1/') |
| 56 SRC_BUNDLE_PATH="${BUILT_PRODUCTS_DIR}/${SRC_BUNDLE}" |
| 57 DSYM_NAME="${SRC_BUNDLE}.dSYM" |
| 58 DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" |
| 59 DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}" |
| 60 BPAD_SYM_NAME="${SRC_STEM}-${FULL_VERSION}-${ARCH}.breakpad" |
| 61 BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}" |
| 62 |
| 63 # Only run dump_syms if the file has changed since the last dump. |
| 64 if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then |
| 65 "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" "${DWARF_PATH}" > "${BPAD_SYM_PATH}" |
| 66 fi |
| 67 |
| 68 # Remove the .dSYM archive if the file has changed since the archive was |
| 69 # last generated. This will cause a new .dSYM archive to be created. |
| 70 if [ "${DWARF_PATH}" -nt "${DSYM_TAR_PATH}" ] ; then |
| 71 rm -f "${DSYM_TAR_PATH}" |
| 72 fi |
| 73 |
| 74 # Push the .dSYM bundle onto the DSYMS array so that it will be included in |
| 75 # the .dSYM archive if a new one is needed |
| 76 DSYMS[${#DSYMS[@]}]="${DSYM_NAME}" |
| 77 done |
| 78 |
| 79 # Create the archive of .dSYM bundles. |
| 80 if [ ! -e "${DSYM_TAR_PATH}" ] ; then |
| 81 # Change directory so that absolute paths aren't included in the archive. |
| 82 (cd "${BUILT_PRODUCTS_DIR}" && |
| 83 tar --owner 0 --group 0 -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}") |
38 fi | 84 fi |
39 APP_DSYM_NAME="${SRC_APP_NAME}.app.dSYM" | |
40 | |
41 # Do the same thing for chrome_dll. | |
42 | |
43 SRC_DYLIB_NAME="${SRC_APP_NAME} Framework" | |
44 SRC_DYLIB_PATH="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}.framework" | |
45 UNSTRIPPED_DYLIB="${SRC_DYLIB_PATH}.dSYM/Contents/Resources/DWARF/${SRC_DYLIB_NA
ME}" | |
46 DYLIB_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}-${FULL_VERSION}-i386.
breakpad" | |
47 if [ "${UNSTRIPPED_DYLIB}" -nt "${DYLIB_SYMBOL_FILE}" ] ; then | |
48 "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_DYLIB}" > "${DYLIB_SYMBOL_FILE}" | |
49 fi | |
50 DYLIB_DSYM_NAME="${SRC_DYLIB_NAME}.framework.dSYM" | |
51 | |
52 DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}.tar.bz2" | |
53 | |
54 # Make a .tar.bz2 out of the .dSYM | |
55 if [ "${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] || | |
56 [ "${BUILT_PRODUCTS_DIR}/${DYLIB_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ; then | |
57 # Change directory so when building the tar, we don't include the build dir | |
58 # in the tar paths. | |
59 (cd "${BUILT_PRODUCTS_DIR}" && | |
60 tar -jcf "${DSYM_TAR_PATH}" "${APP_DSYM_NAME}" "${DYLIB_DSYM_NAME}") | |
61 fi | |
OLD | NEW |