diff options
-rwxr-xr-x | build/mac/dump_app_syms | 37 | ||||
-rwxr-xr-x | build/mac/tweak_app_infoplist | 56 | ||||
-rw-r--r-- | chrome/chrome.gyp | 47 |
3 files changed, 131 insertions, 9 deletions
diff --git a/build/mac/dump_app_syms b/build/mac/dump_app_syms new file mode 100755 index 0000000..a1e497c --- /dev/null +++ b/build/mac/dump_app_syms @@ -0,0 +1,37 @@ +#!/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 + +. "${TOP}/chrome/VERSION" + +SRC_APP_NAME="${BUILD_BRANDING}" +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}" +SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${BUILD_BRANDING}-${FULL_VERSION} i386.breakpad" + +# Only run dump_syms if the file has changed since we last did a dump. +if [ "${UNSTRIPPED_APP}" -nt "${SYMBOL_FILE}" ] ; then + "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_APP}" > "${SYMBOL_FILE}" +fi diff --git a/build/mac/tweak_app_infoplist b/build/mac/tweak_app_infoplist index 4040fa0..f8a062d 100755 --- a/build/mac/tweak_app_infoplist +++ b/build/mac/tweak_app_infoplist @@ -4,6 +4,32 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +set -e + +# Pull off the optional args +INCLUDE_BREAKPAD=0 +OPTERR=0 +while getopts ":b:" an_opt ; do + case $an_opt in + b) + INCLUDE_BREAKPAD=$OPTARG + ;; + \?) + echo "Unknown option $OPTARG" + exit 1 + ;; + :) + echo "Option $OPTARG missing it's value" + exit 1 + ;; + *) + echo "Not recognized argument $an_opt" + exit 1 + ;; + esac +done +shift $(($OPTIND - 1)) + # Make sure we got the header to write into passed to us if [ $# -ne 1 ]; then echo "error: missing branding as an argument" >&2 @@ -26,12 +52,12 @@ fi # by the time the app target is done, the info.plist is correct. # -set -ex - TOP="${SRCROOT}/.." BUILD_BRANDING=$1 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${BUILD_BRANDING}.app" +set -x + # Figure out what version this build corresponds to. Just use the svn revision # for now. Warning: my svnversion returns 10495:10552M. But that's ok since # it is just for reference. @@ -89,6 +115,32 @@ defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ NSHumanReadableCopyright -string "${COPYRIGHT_STRING}" +# Add/Remove the breakpad keys +if [ "${INCLUDE_BREAKPAD}" == "1" ] ; then + defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ + BreakpadURL "https://clients2.google.com/cr/report" + defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadReportInterval "3600" + defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ + BreakpadProduct "${BUILD_BRANDING}_Mac" + defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ + BreakpadProductDisplay "${BUILD_BRANDING}" + defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ + BreakpadVersion -string "${FULL_VERSION}" + defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSendAndExit "YES" + # TODO: remove/update this when we have first launch + defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm "YES" +else + # Make sure the keys aren't there, || true to avoid errors if they aren't. + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadURL || true + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadReportInterval || true + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProduct || true + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadProductDisplay || true + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadVersion || true + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSendAndExit || true + # TODO: remove/update this when we have first launch + defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm || true +fi + # Info.plist will work perfectly well in any plist format, but traditionally # applications use xml1 for this, so convert it back after whatever defaults # might have done. diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 28845f6..3c8c0e7 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -5,6 +5,9 @@ { 'variables': { 'chromium_code': 1, + # Mac NOTE: at the start of the conditions block we default some vars + # that control features based on the branding, this way each place that + # needs to know about the feature isn't hard coded to the branding type. }, 'includes': [ '../build/common.gypi', @@ -1975,22 +1978,40 @@ 'variables': { 'bundle_id': 'com.google.Chrome', }, + }, { # else: 'branding!="Chrome" + 'mac_bundle_resources': ['app/theme/chromium/app.icns'], + 'variables': { + 'bundle_id': 'org.chromium.Chromium', + }, + }], + ['mac_breakpad==1', { # Only include breakpad in official builds. 'dependencies': [ '../breakpad/breakpad.gyp:breakpad', + '../breakpad/breakpad.gyp:dump_syms', ], 'copies': [ { 'destination': '<(PRODUCT_DIR)/<(branding).app/Contents/Resources/', 'files': ['<(PRODUCT_DIR)/crash_inspector', '<(PRODUCT_DIR)/crash_report_sender.app'], }, - ] - }, { # else: branding!="Chrome" - 'mac_bundle_resources': ['app/theme/chromium/app.icns'], - 'variables': { - 'bundle_id': 'org.chromium.Chromium', - }, - }], + ], + 'target_conditions': [ + # We use target_conditions here that is always true to force + # this post build to run last. This lets the strip from + # common.gypi go ahead of it, so we can always hit the + # upstripped app within the fake dSYM. + ['1', { + 'postbuilds': [ + { + 'postbuild_name': 'Dump Symbols', + 'action': ['<(DEPTH)/build/mac/dump_app_syms', + '<(branding)'], + }, + ], + }], + ], + }], # mac_breakpad ], 'xcode_settings': { # chrome/app/app-Info.plist has a CFBundleIdentifier of @@ -2027,6 +2048,7 @@ 'inputs': [], 'outputs': [], 'action': ['<(DEPTH)/build/mac/tweak_app_infoplist', + '-b', '<(mac_breakpad)', '<(branding)'], }, ], @@ -2970,6 +2992,17 @@ }, ], 'conditions': [ + # We set a few feature variables so the different parts that need to check + # for the mac build, check that flag instead of coding it based on branding. + ['OS=="mac" and branding=="Chrome"', { + 'variables': { + 'mac_breakpad%': 1 + } + }, { + 'variables': { + 'mac_breakpad%': 0 + } + }], ['OS=="linux"', { 'targets': [ { |