| OLD | NEW |
| 1 #!/bin/bash | 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 set -e | 7 set -e |
| 8 | 8 |
| 9 # Pull off the optional args | 9 # Pull off the optional args |
| 10 USE_BREAKPAD=0 | 10 USE_BREAKPAD=0 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 # the Info.plist has changed. So even if we updated it, it's only looking | 55 # the Info.plist has changed. So even if we updated it, it's only looking |
| 56 # at the modtime of the info.plist to see if that's changed. | 56 # at the modtime of the info.plist to see if that's changed. |
| 57 # | 57 # |
| 58 # So, we work around all of this by making a script build phase that will run | 58 # So, we work around all of this by making a script build phase that will run |
| 59 # during the app build, and simply update the info.plist in place. This way | 59 # during the app build, and simply update the info.plist in place. This way |
| 60 # by the time the app target is done, the info.plist is correct. | 60 # by the time the app target is done, the info.plist is correct. |
| 61 # | 61 # |
| 62 | 62 |
| 63 TOP="${SRCROOT}/.." | 63 TOP="${SRCROOT}/.." |
| 64 BUILD_BRANDING=$1 | 64 BUILD_BRANDING=$1 |
| 65 BRAND_SCRIPT="${TOP}/build/branding_value.sh" | |
| 66 | 65 |
| 67 set -x | 66 set -x |
| 68 | 67 |
| 69 APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME) | |
| 70 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}" | 68 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}" |
| 71 | 69 |
| 72 if [ "${USE_SVN}" = "1" ] ; then | 70 if [ "${USE_SVN}" = "1" ] ; then |
| 73 # Visible in the about:version page. | 71 # Visible in the about:version page. |
| 74 SVN_INFO=$(svn info "${TOP}" 2>/dev/null || true) | 72 SVN_INFO=$(svn info "${TOP}" 2>/dev/null || true) |
| 75 SVN_REVISION=$(echo "${SVN_INFO}" | sed -Ene 's/^Revision: (.*)$/\1/p') | 73 SVN_REVISION=$(echo "${SVN_INFO}" | sed -Ene 's/^Revision: (.*)$/\1/p') |
| 76 if [ -z "${SVN_REVISION}" ] ; then | 74 if [ -z "${SVN_REVISION}" ] ; then |
| 77 GIT_INFO=$(git log -1 --grep=git-svn-id --format=%b 2>/dev/null || true) | 75 GIT_INFO=$(git log -1 --grep=git-svn-id --format=%b 2>/dev/null || true) |
| 78 SVN_REVISION=$(echo "${GIT_INFO}" | \ | 76 SVN_REVISION=$(echo "${GIT_INFO}" | \ |
| 79 sed -Ene 's/^git-svn-id: .*@([0-9]+).*$/\1/p') | 77 sed -Ene 's/^git-svn-id: .*@([0-9]+).*$/\1/p') |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 [ "${SVN_URL:0:${#SVN_ROOT}}" = "${SVN_ROOT}" ] ; then | 94 [ "${SVN_URL:0:${#SVN_ROOT}}" = "${SVN_ROOT}" ] ; then |
| 97 SVN_PATH="${SVN_URL:${#SVN_ROOT}}" | 95 SVN_PATH="${SVN_URL:${#SVN_ROOT}}" |
| 98 fi | 96 fi |
| 99 fi | 97 fi |
| 100 fi | 98 fi |
| 101 | 99 |
| 102 # Pull in the Chrome version number. | 100 # Pull in the Chrome version number. |
| 103 . "${TOP}/chrome/VERSION" | 101 . "${TOP}/chrome/VERSION" |
| 104 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" | 102 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" |
| 105 | 103 |
| 106 # Fetch the copyright. | |
| 107 COPYRIGHT_STRING=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" COPYRIGHT) | |
| 108 # Map (c) or (C) to the copyright symbol. | |
| 109 COPYRIGHT_STRING=$(echo "${COPYRIGHT_STRING}" | sed -e $'s/([cC])/\302\251/g') | |
| 110 | |
| 111 # Build the full copyright string | |
| 112 LONG_COPYRIGHT="${APP_NAME} ${FULL_VERSION}, ${COPYRIGHT_STRING}" | |
| 113 | |
| 114 # I really hate how "defaults" doesn't take a real pathname but instead insists | 104 # I really hate how "defaults" doesn't take a real pathname but instead insists |
| 115 # on appending ".plist" to everything. | 105 # on appending ".plist" to everything. |
| 116 INFO_PLIST_PATH="Contents/Info.plist" | 106 INFO_PLIST_PATH="Contents/Info.plist" |
| 117 TMP_INFO_PLIST_DEFAULTS="${TEMP_DIR}/Info" | 107 TMP_INFO_PLIST_DEFAULTS="${TEMP_DIR}/Info" |
| 118 TMP_INFO_PLIST="${TMP_INFO_PLIST_DEFAULTS}.plist" | 108 TMP_INFO_PLIST="${TMP_INFO_PLIST_DEFAULTS}.plist" |
| 119 cp "${SRC_APP_PATH}/${INFO_PLIST_PATH}" "${TMP_INFO_PLIST}" | 109 cp "${SRC_APP_PATH}/${INFO_PLIST_PATH}" "${TMP_INFO_PLIST}" |
| 120 | 110 |
| 121 # Save off the Subversion revision number and source root path in case they're | 111 # Save off the Subversion revision number and source root path in case they're |
| 122 # needed. | 112 # needed. |
| 123 if [ ! -z "${SVN_REVISION}" ] ; then | 113 if [ ! -z "${SVN_REVISION}" ] ; then |
| 124 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 114 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
| 125 SVNRevision -string "${SVN_REVISION}" | 115 SVNRevision -string "${SVN_REVISION}" |
| 126 else | 116 else |
| 127 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" SVNRevision || true | 117 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" SVNRevision || true |
| 128 fi | 118 fi |
| 129 if [ ! -z "${SVN_PATH}" ] ; then | 119 if [ ! -z "${SVN_PATH}" ] ; then |
| 130 defaults write "${TMP_INFO_PLIST_DEFAULTS}" SVNPath -string "${SVN_PATH}" | 120 defaults write "${TMP_INFO_PLIST_DEFAULTS}" SVNPath -string "${SVN_PATH}" |
| 131 else | 121 else |
| 132 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" SVNPath || true | 122 defaults delete "${TMP_INFO_PLIST_DEFAULTS}" SVNPath || true |
| 133 fi | 123 fi |
| 134 | 124 |
| 135 # Add public version info so "Get Info" works | 125 # Add public version info so "Get Info" works |
| 136 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 126 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
| 137 CFBundleGetInfoString -string "${LONG_COPYRIGHT}" | |
| 138 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | |
| 139 CFBundleShortVersionString -string "${FULL_VERSION}" | 127 CFBundleShortVersionString -string "${FULL_VERSION}" |
| 140 # Honor the 429496.72.95 limit. The maximum comes from splitting 2^32 - 1 into | 128 # Honor the 429496.72.95 limit. The maximum comes from splitting 2^32 - 1 into |
| 141 # 6, 2, 2 digits. The limitation was present in Tiger, but it could have been | 129 # 6, 2, 2 digits. The limitation was present in Tiger, but it could have been |
| 142 # fixed in later OS release, but hasn't been tested (it's easy enough to find | 130 # fixed in later OS release, but hasn't been tested (it's easy enough to find |
| 143 # out with "lsregister -dump). | 131 # out with "lsregister -dump). |
| 144 # http://lists.apple.com/archives/carbon-dev/2006/Jun/msg00139.html | 132 # http://lists.apple.com/archives/carbon-dev/2006/Jun/msg00139.html |
| 145 # BUILD will always be an increasing value, so BUILD_PATH gives us something | 133 # BUILD will always be an increasing value, so BUILD_PATH gives us something |
| 146 # unique that meetings what LS wants. | 134 # unique that meetings what LS wants. |
| 147 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 135 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
| 148 CFBundleVersion -string "${BUILD}.${PATCH}" | 136 CFBundleVersion -string "${BUILD}.${PATCH}" |
| 149 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | |
| 150 NSHumanReadableCopyright -string "${COPYRIGHT_STRING}" | |
| 151 | 137 |
| 152 # Add or remove the Breakpad keys. | 138 # Add or remove the Breakpad keys. |
| 153 if [ "${USE_BREAKPAD}" = "1" ] ; then | 139 if [ "${USE_BREAKPAD}" = "1" ] ; then |
| 154 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 140 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
| 155 BreakpadURL "https://clients2.google.com/cr/report" | 141 BreakpadURL "https://clients2.google.com/cr/report" |
| 156 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadReportInterval "3600" | 142 defaults write "${TMP_INFO_PLIST_DEFAULTS}" BreakpadReportInterval "3600" |
| 157 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 143 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
| 158 BreakpadProduct "${BUILD_BRANDING}_Mac" | 144 BreakpadProduct "${BUILD_BRANDING}_Mac" |
| 159 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ | 145 defaults write "${TMP_INFO_PLIST_DEFAULTS}" \ |
| 160 BreakpadProductDisplay "${BUILD_BRANDING}" | 146 BreakpadProductDisplay "${BUILD_BRANDING}" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 190 fi | 176 fi |
| 191 | 177 |
| 192 # Info.plist will work perfectly well in any plist format, but traditionally | 178 # Info.plist will work perfectly well in any plist format, but traditionally |
| 193 # applications use xml1 for this, so convert it back after whatever defaults | 179 # applications use xml1 for this, so convert it back after whatever defaults |
| 194 # might have done. | 180 # might have done. |
| 195 plutil -convert xml1 "${TMP_INFO_PLIST}" | 181 plutil -convert xml1 "${TMP_INFO_PLIST}" |
| 196 cp "${TMP_INFO_PLIST}" "${SRC_APP_PATH}/${INFO_PLIST_PATH}" | 182 cp "${TMP_INFO_PLIST}" "${SRC_APP_PATH}/${INFO_PLIST_PATH}" |
| 197 | 183 |
| 198 # Clean up. | 184 # Clean up. |
| 199 rm -f "${TMP_INFO_PLIST}" | 185 rm -f "${TMP_INFO_PLIST}" |
| OLD | NEW |