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