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