summaryrefslogtreecommitdiffstats
path: root/build/mac/dump_app_syms
blob: cd6e6268d7e9d8f985c204b60302777b821a81a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh

# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Make sure we got the header to write into passed to us
if [ $# -ne 1 ]; then
  echo "error: missing branding as an argument" >&2
  exit 1
fi

set -ex

# Skip out if we're aren't in Release mode, no need for dump_syms on debug runs.
if [ "${CONFIGURATION}" != "Release" ] ; then
  exit 0
fi

TOP="${SRCROOT}/.."
BUILD_BRANDING=$1

BRAND_SCRIPT="${TOP}/build/branding_value.sh"
SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME)
. "${TOP}/chrome/VERSION"

BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms"
BREAKPAD_PRODUCT_ID="${BUILD_BRANDING}_Mac"
FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}"
SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.app"
# Created by the build/mac/strip_from_xcode script.
UNSTRIPPED_APP="${SRC_APP_PATH}.dSYM/Contents/Resources/DWARF/${SRC_APP_NAME}"
APP_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}-${FULL_VERSION}-i386.breakpad"

# Only run dump_syms if the file has changed since we last did a dump.
if [ "${UNSTRIPPED_APP}" -nt "${APP_SYMBOL_FILE}" ] ; then
  "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_APP}" > "${APP_SYMBOL_FILE}"
fi
APP_DSYM_NAME="${SRC_APP_NAME}.app.dSYM"

# Do the same thing for chrome_dll.

SRC_DYLIB_NAME="${SRC_APP_NAME} Framework"
SRC_DYLIB_PATH="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}.framework"
UNSTRIPPED_DYLIB="${SRC_DYLIB_PATH}.dSYM/Contents/Resources/DWARF/${SRC_DYLIB_NAME}"
DYLIB_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}-${FULL_VERSION}-i386.breakpad"
if [ "${UNSTRIPPED_DYLIB}" -nt "${DYLIB_SYMBOL_FILE}" ] ; then
  "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_DYLIB}" > "${DYLIB_SYMBOL_FILE}"
fi
DYLIB_DSYM_NAME="${SRC_DYLIB_NAME}.framework.dSYM"

DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}.tar.bz2"

# Make a .tar.bz2 out of the .dSYM
if [ "${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ||
   [ "${BUILT_PRODUCTS_DIR}/${DYLIB_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ; then
  # Change directory so when building the tar, we don't include the build dir
  # in the tar paths.
  (cd "${BUILT_PRODUCTS_DIR}" &&
   tar -jcf "${DSYM_TAR_PATH}" "${APP_DSYM_NAME}" "${DYLIB_DSYM_NAME}")
fi