OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Make sure we got the header to write into passed to us |
| 8 if [ $# -ne 1 ]; then |
| 9 echo "error: missing branding as an argument" >&2 |
| 10 exit 1 |
| 11 fi |
| 12 |
| 13 # |
| 14 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work |
| 15 # because: |
| 16 # |
| 17 # 1. Xcode wants to do the Info.plist work before it runs any build phases, |
| 18 # this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER |
| 19 # we'd have to put it in another target so it runs in time. |
| 20 # 2. Xcode also doesn't check to see if the header being used as a prefix for |
| 21 # the Info.plist has changed. So even if we updated it, it's only looking |
| 22 # at the modtime of the info.plist to see if that's changed. |
| 23 # |
| 24 # So, we work around all of this by making a script build phase that will run |
| 25 # during the app build, and simply update the info.plist in place. This way |
| 26 # by the time the app target is done, the info.plist is correct. |
| 27 # |
| 28 |
| 29 set -ex |
| 30 |
| 31 TOP="${SRCROOT}/.." |
| 32 BUILD_BRANDING=$1 |
| 33 SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${BUILD_BRANDING}.app" |
| 34 |
| 35 # Figure out what version this build corresponds to. Just use the svn revision |
| 36 # for now. Warning: my svnversion returns 10495:10552M. But that's ok since |
| 37 # it is just for reference. |
| 38 SVN_REVISION=$(svnversion "${SRCROOT}") |
| 39 if [ -z "${SVN_REVISION}" ] ; then |
| 40 echo "warning: could not determine svn revision" >&2 |
| 41 fi |
| 42 |
| 43 # Pull in the chrome version number |
| 44 . "${TOP}/chrome/VERSION" |
| 45 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" |
| 46 SHORT_VERSION="${MAJOR}.${MINOR}.${BUILD}" |
| 47 |
| 48 # Collect the year |
| 49 YEAR=$(date +%Y) |
| 50 |
| 51 # Copyright is based on branding |
| 52 if [ "${BUILD_BRANDING}" == "Chromium" ]; then |
| 53 LONG_COPYRIGHT="${BUILD_BRANDING} ${FULL_VERSION}, Copyright ${YEAR} The Chrom
ium Authors." |
| 54 elif [ "${BUILD_BRANDING}" == "Chrome" ]; then |
| 55 LONG_COPYRIGHT="${BUILD_BRANDING} ${FULL_VERSION}, Copyright ${YEAR} Google In
c." |
| 56 else |
| 57 echo "error: unknown branding: ${BUILD_BRANDING}" >&2 |
| 58 exit 1 |
| 59 fi |
| 60 |
| 61 # I really hate how "defaults" doesn't take a real pathname but instead insists |
| 62 # on appending ".plist" to everything. |
| 63 INFO_PLIST_PATH="Contents/Info.plist" |
| 64 TMP_INFO_PLIST_DEFAULTS="${TEMP_DIR}/Info" |
| 65 TMP_INFO_PLIST="${TMP_INFO_PLIST_DEFAULTS}.plist" |
| 66 cp "${SRC_APP_PATH}/${INFO_PLIST_PATH}" "${TMP_INFO_PLIST}" |
| 67 |
| 68 # Save off the svn version number in case we need it |
| 69 defaults write "${TMP_INFO_PLIST_DEFAULTS}" SVNRevision -string "${SVN_REVISION}
" |
| 70 |
| 71 # Add public version info so "Get Info" works |
| 72 defaults write "${TMP_INFO_PLIST_DEFAULTS}" CFBundleGetInfoString -string "${LON
G_COPYRIGHT}" |
| 73 defaults write "${TMP_INFO_PLIST_DEFAULTS}" CFBundleShortVersionString -string "
${SHORT_VERSION}" |
| 74 # Honor the 429496.72.95 limit. The maximum comes from splitting 2^32 - 1 into |
| 75 # 6, 2, 2 digits. The limitation was present in Tiger, but it could have been |
| 76 # fixed in later OS release, but hasn't been tested (it's easy enough to find |
| 77 # out with "lsregister -dump). |
| 78 # http://lists.apple.com/archives/carbon-dev/2006/Jun/msg00139.html |
| 79 # BUILD will always be an increasing value, so BUILD_PATH gives us something |
| 80 # unique that meetings what LS wants. |
| 81 defaults write "${TMP_INFO_PLIST_DEFAULTS}" CFBundleVersion -string "${BUILD}.${
PATCH}" |
| 82 defaults write "${TMP_INFO_PLIST_DEFAULTS}" NSHumanReadableCopyright -string "${
LONG_COPYRIGHT}" |
| 83 |
| 84 # Info.plist will work perfectly well in any plist format, but traditionally |
| 85 # applications use xml1 for this, so convert it back after whatever defaults |
| 86 # might have done. |
| 87 plutil -convert xml1 "${TMP_INFO_PLIST}" |
| 88 cp "${TMP_INFO_PLIST}" "${SRC_APP_PATH}/${INFO_PLIST_PATH}" |
OLD | NEW |