sbsv2/raptor/bin/sbs
author timothy.murphy@nokia.com
Fri, 05 Feb 2010 20:24:19 +0000
branchfix
changeset 191 3bfc260b6d61
parent 117 ecf683438dc6
child 212 18372202b584
permissions -rwxr-xr-x
fix: better error messages when an incorrect make engine is specified. Requires that all make engine variants should extend "make_engine".

#!/bin/bash
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
#
# Contributors:
#
# Description:
# raptor script
# add mingw to the PATH if we are running Cygwin on Windows
#

# If SBS_HOME is not set in the environment then work it out
# from the path to this batch file
if [ -z "$SBS_HOME" ] ; then
	temp=$0
	SBS_HOME=$(cd ${temp%/*} && echo $PWD)
	export SBS_HOME=${SBS_HOME%/bin}
fi

# Ensure that the host type is set for Raptor:
eval $($SBS_HOME/bin/gethost.sh -e)

if [ -z "$HOSTPLATFORM" ]; then
	echo "Error: HOSTPLATFORM could not be determined." 1>&2
	exit 1
fi

if [ ! -d "$SBS_HOME/$HOSTPLATFORM_DIR" ]; then
cat 1>&2 <<EOERROR
Error: sbs has not been installed with support for your platform: "${HOSTPLATFORM}".

The utilites for your platform should be in "$SBS_HOME/$HOSTPLATFORM_DIR" but sbs
cannot find them there.

sbs is supported on:
	win32
	linux i386 libc2_3 (Redhat 4)

sbs has been known to work (but is not supported) on:
	linux x86_64 libc2_5  (e.g. Centos/Redhat 5.3 64-bit)
	linux i386 libc2_8  (e.g. Fedora 9 32-bit)
	linux x86_64 libc2_10 (e.g. Fedora 11 64-bit)

Even with the appropriate utilities it may be necessary to install 32-bit
compatibility versions of some libraries (e.g. glibc) on these platforms,
particularly for 3rd party tools which are not built natively such as
compilers.

It may be possible to build and install the utilities for your platform by
entering $SBS_HOME/util and running
	make -k
A full development environment is required however.
EOERROR
	exit 1
fi

if [ "$OSTYPE" == "cygwin" ]; then

	SBS_HOME=${SBS_HOME//\\//}

	__MINGW__=${SBS_MINGW:-$SBS_HOME/$HOSTPLATFORM_DIR/mingw}
	__CYGWIN__=${SBS_CYGWIN:-$SBS_HOME/$HOSTPLATFORM_DIR/cygwin}
	__PYTHON__=${SBS_PYTHON:-$SBS_HOME/$HOSTPLATFORM_DIR/python252/python.exe}
	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python252}

    # Command for unifying path strings. For example, "c:\some\path" and
    # "/cygdrive/c/some/path" will both be converted into "c:/some/path".
	u="$__CYGWIN__/bin/cygpath.exe -m"

	__MINGW__=$($u "$__MINGW__")
	__CYGWIN__=$($u "$__MINGW__")
	__PYTHON__=$($u "$__PYTHON__")

	export SBS_HOME=$($u "$SBS_HOME")

	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH

	# Tell Cygwin not to map unix security attributes to windows to
	# prevent raptor from potentially creating read-only files:
	export CYGWIN='nontsec nosmbntsec'

else
	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python262/lib}
	PATH=$SBS_HOME/$HOSTPLATFORM_DIR/python262/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
	LD_LIBRARY_PATH=$SBS_HOME/$HOSTPLATFORM_DIR/python262/lib:$SBS_HOME/$HOSTPLATFORM_DIR/bv/lib:$LD_LIBRARY_PATH

	export PATH LD_LIBRARY_PATH
	__PYTHON__=python
fi


# call raptor_start.py with the arguments

RAPTOR_START="$SBS_HOME/python/raptor_start.py"

if [ -e "$RAPTOR_START" ]; then
	# run the source version
	${__PYTHON__} "$RAPTOR_START" "$@"
elif [ -e "$RAPTOR_START"c ]; then
	# run the compiled version
	${__PYTHON__} "$RAPTOR_START"c "$@"
else
	echo "Cannot start SBSV2 - $RAPTOR_START not found." 1>&2
	echo "Check your SBS_HOME environment variable." 1>&2
fi