sbsv2/raptor/bin/sbs_env
author Ross Qin <ross.qin@nokia.com>
Tue, 30 Nov 2010 14:05:41 +0800
changeset 713 7b7f0409fc00
parent 674 37ee82a83d43
permissions -rw-r--r--
merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
674
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     1
# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     2
# All rights reserved.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     3
# This component and the accompanying materials are made available
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     5
# which accompanies this distribution, and is available
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     7
#
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     8
# Initial Contributors:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    10
#
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    11
# Contributors:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    12
#
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    13
# Description:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    14
# raptor script
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    15
# manages common environment settings
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    16
#
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    17
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    18
# Ensure that the host type is set for Raptor:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    19
eval $($SBS_HOME/bin/gethost.sh -e)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    20
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    21
if [ -z "$HOSTPLATFORM" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    22
	echo "Error: HOSTPLATFORM could not be determined." 1>&2
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    23
	exit 1
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    24
fi
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    25
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    26
if [ ! -d "$SBS_HOME/$HOSTPLATFORM_DIR" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    27
cat 1>&2 <<EOERROR
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    28
Error: sbs has not been installed with support for your platform: "${HOSTPLATFORM}".
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    29
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    30
The utilites for your platform should be in "$SBS_HOME/$HOSTPLATFORM_DIR" but sbs
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    31
cannot find them there.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    32
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    33
sbs is supported on:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    34
	win32
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    35
	linux i386 libc2_3 (Redhat 4)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    36
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    37
sbs has been known to work (but is not supported) on:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    38
	linux x86_64 libc2_5  (e.g. Centos/Redhat 5.3 64-bit)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    39
	linux i386 libc2_8  (e.g. Fedora 9 32-bit)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    40
	linux x86_64 libc2_10 (e.g. Fedora 11 64-bit)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    41
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    42
Even with the appropriate utilities it may be necessary to install 32-bit
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    43
compatibility versions of some libraries (e.g. glibc) on these platforms,
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    44
particularly for 3rd party tools which are not built natively such as
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    45
compilers.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    46
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    47
It may be possible to build and install the utilities for your platform by
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    48
entering $SBS_HOME/util and running
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    49
	make -k
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    50
A full development environment is required however.
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    51
EOERROR
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    52
	exit 1
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    53
fi
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    54
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    55
if [ "$OSTYPE" == "cygwin" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    56
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    57
	SBS_HOME=${SBS_HOME//\\//}
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    58
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    59
	__MINGW__=${SBS_MINGW:-$SBS_HOME/$HOSTPLATFORM_DIR/mingw}
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    60
	__PYTHON__=${SBS_PYTHON:-$SBS_HOME/$HOSTPLATFORM_DIR/python264/python.exe}
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    61
	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python264}
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    62
			
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    63
	# work out which version of Cygwin to use
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    64
	# use SBS_CYGWIN17 if set and assume 1.7,
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    65
	# otherwise use SBS_CYGWIN and assume 1.5
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    66
	# Tell Cygwin 1.5 not to map unix security attributes to windows to
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    67
	# prevent raptor from potentially creating read-only files:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    68
	if [ -z "$SBS_CYGWIN17" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    69
			__CYGWIN__=$SBS_CYGWIN
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    70
			export CYGWIN='nontsec nosmbntsec'
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    71
			
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    72
	else
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    73
			__CYGWIN__=$SBS_CYGWIN17
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    74
			export CYGWIN=nodosfilewarning
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    75
			__MOUNTOPTIONS__='-o noacl -o user'
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    76
			__UMOUNTOPTIONS__=
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    77
	fi
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    78
    # Command for unifying path strings. For example, "c:\some\path" and
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    79
    # "/cygdrive/c/some/path" will both be converted into "c:/some/path".
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    80
	u="$__CYGWIN__/bin/cygpath.exe -m"
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    81
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    82
	__MINGW__=$($u "$__MINGW__")
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    83
	
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    84
	export SBS_HOME=$($u "$SBS_HOME")
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    85
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    86
	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    87
	
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    88
	# The python and PYTHONPATH used by Raptor are determined by, in order of precedence:
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    89
	#  1. the SBS_PYTHON and SBS_PYTHONPATH environment variables (if set)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    90
	#  2. the python shipped locally with Raptor (if present)
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    91
	#  3. the python on the system PATH and the PYTHONPATH set in the system environment
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    92
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    93
	__LOCAL_PYTHON__=$SBS_HOME/win32/python264/python.exe
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    94
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    95
	if [ -n "$SBS_PYTHON" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    96
		export __PYTHON__=$SBS_PYTHON
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    97
	elif [ -f "$__LOCAL_PYTHON__" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    98
		export __PYTHON__=$__LOCAL_PYTHON__
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
    99
		export SBS_PYTHON=$__PYTHON__
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   100
		export PYTHONPATH=
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   101
	else
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   102
		export __PYTHON__=python.exe
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   103
	fi
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   104
	export __PYTHON__=$($u "$__PYTHON__")		
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   105
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   106
	if [ -n "$SBS_PYTHONPATH" ]; then
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   107
		export PYTHONPATH=$($u "$SBS_PYTHONPATH")
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   108
	fi
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   109
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   110
else	
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   111
	PYDIR=python27 # not exported on purpose
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   112
	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib}
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   113
	PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   114
	LD_LIBRARY_PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib:$SBS_HOME/$HOSTPLATFORM_DIR/bv/lib:$LD_LIBRARY_PATH
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   115
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   116
	export PATH LD_LIBRARY_PATH
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   117
	export __PYTHON__=python
37ee82a83d43 sbs version 2.15.3
Jon Chatten
parents:
diff changeset
   118
fi