PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/BuildScripts/BuildAllSDKs.sh

http://macfuse.googlecode.com/
Shell | 110 lines | 70 code | 8 blank | 32 comment | 15 complexity | 0e8719ce357a8b494aa033381d2e772a MD5 | raw file
  1#!/bin/sh
  2# BuildAllSDKs.sh
  3#
  4# This script builds the Tiger, Leopard, and SnowLeopard versions of the
  5# requested target in the current basic config (debug, release, debug-gcov).
  6#
  7# Copyright 2006-2011 Google Inc.
  8#
  9# Licensed under the Apache License, Version 2.0 (the "License"); you may not
 10# use this file except in compliance with the License.  You may obtain a copy
 11# of the License at
 12#
 13# http://www.apache.org/licenses/LICENSE-2.0
 14#
 15# Unless required by applicable law or agreed to in writing, software
 16# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 17# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 18# License for the specific language governing permissions and limitations under
 19# the License.
 20
 21# This scrit runs as the build script, it actually exits having really done no
 22# build.  Instead it creates and launches and AppleScript that then drives
 23# Xcode to do the real builds cycling through configurations/projects to get
 24# everything done.
 25
 26GTM_PROJECT_TARGET="$1"
 27STARTING_TARGET="${TARGET_NAME}"
 28SCRIPT_APP="${TMPDIR}DoBuild.app"
 29
 30REQUESTED_BUILD_STYLE=$(echo "${BUILD_STYLE}" | sed -E "s/(.*OrLater)-(.*)/\2/")
 31# See if we were told to clean instead of build.
 32PROJECT_ACTION="build"
 33if [ "${ACTION}" == "clean" ]; then
 34  PROJECT_ACTION="clean"
 35fi
 36
 37# get available SDKs and PLATFORMS
 38AVAILABLE_MACOS_SDKS=`eval ls ${DEVELOPER_SDK_DIR}`
 39AVAILABLE_PLATFORMS=`eval ls ${DEVELOPER_DIR}/Platforms`
 40
 41GTM_OPEN_EXTRAS=""
 42GTM_BUILD_EXTRAS=""
 43
 44# build up our GTM parts
 45if [ "${GTM_PROJECT_TARGET}" != "" ]; then
 46  GTM_OPEN_EXTRAS="
 47    if \"${AVAILABLE_PLATFORMS}\" contains \"MacOSX.platform\" then
 48      open posix file \"${SRCROOT}/GTM.xcodeproj\"
 49    end if"
 50  GTM_BUILD_EXTRAS="
 51    if \"${AVAILABLE_PLATFORMS}\" contains \"MacOSX.platform\" then
 52      tell project \"GTM\"
 53        -- wait for stub build to finish before kicking off the real builds.
 54        set x to 0
 55        repeat while currently building
 56          delay 0.5
 57          set x to x + 1
 58          if x > 6 then
 59            display alert \"GTM is still building, can't start.\"
 60            return
 61          end if
 62        end repeat
 63        -- do the GTM builds
 64        with timeout of 9999 seconds
 65          if \"{$AVAILABLE_MACOS_SDKS}\" contains \"MacOSX10.4u.sdk\" then
 66            set active target to target \"${GTM_PROJECT_TARGET}\"
 67            set buildResult to ${PROJECT_ACTION} using build configuration \"TigerOrLater-${REQUESTED_BUILD_STYLE}\"
 68            set active target to target \"${STARTING_TARGET}\"
 69            if buildResult is not equal to \"Build succeeded\" then
 70              return
 71            end if
 72          end if
 73          if \"{$AVAILABLE_MACOS_SDKS}\" contains \"MacOSX10.5.sdk\" then
 74            set active target to target \"${GTM_PROJECT_TARGET}\"
 75            set buildResult to ${PROJECT_ACTION} using build configuration \"LeopardOrLater-${REQUESTED_BUILD_STYLE}\"
 76            set active target to target \"${STARTING_TARGET}\"
 77            if buildResult is not equal to \"Build succeeded\" then
 78              return
 79            end if
 80          end if
 81          if \"{$AVAILABLE_MACOS_SDKS}\" contains \"MacOSX10.6.sdk\" then
 82            set active target to target \"${GTM_PROJECT_TARGET}\"
 83            set buildResult to ${PROJECT_ACTION} using build configuration \"SnowLeopardOrLater-${REQUESTED_BUILD_STYLE}\"
 84            set active target to target \"${STARTING_TARGET}\"
 85            if buildResult is not equal to \"Build succeeded\" then
 86              return
 87            end if
 88          end if
 89        end timeout
 90      end tell
 91    end if"
 92fi
 93
 94# build up our GTM AppleScript
 95OUR_BUILD_SCRIPT="on run
 96  tell application \"Xcode\"
 97    activate
 98    ${GTM_OPEN_EXTRAS}
 99    ${GTM_BUILD_EXTRAS}
100  end tell
101end run"
102
103# Xcode won't actually let us spawn this and run it w/ osascript because it
104# watches and waits for everything we have spawned to exit before the build is
105# considered done, so instead we compile this to a script app, and then use
106# open to invoke it, there by escaping our little sandbox.
107#   xcode defeats this: ( echo "${OUR_BUILD_SCRIPT}" | osascript - & )
108rm -rf "${SCRIPT_APP}"
109echo "${OUR_BUILD_SCRIPT}" | osacompile -o "${SCRIPT_APP}" -x
110open "${SCRIPT_APP}"