sbs_env 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # Copyright (c) 2010-2011 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. # The SBS variable is used as a way to create sub-invocations of raptor.
  18. # If we're using cygwin then SBS needs, paradoxically, to refer to the
  19. # batch file rather than this shell script even though this is inconsistent.
  20. # The tools that need the SBS variable the most like parallel parsing and
  21. # FLMs tend to fail e.g. on clustered builds where the difference in cygwin
  22. # mount locations between the make and "build" machines causes
  23. # the #!/bin/sh at the top of this script to not resolve to the correct
  24. # location of "sh". Only the batch file can be used in these situations.
  25. if [ "$OSTYPE" == "cygwin" ]; then
  26. SBS=$SBS_HOME/bin/sbs.bat
  27. else
  28. SBS=$SBS_HOME/bin/sbs
  29. fi
  30. export SBS
  31. # Ensure that the host type is set for Raptor:
  32. eval $($SBS_HOME/bin/gethost.sh -e)
  33. if [ -z "$HOSTPLATFORM" ]; then
  34. echo "Error: HOSTPLATFORM could not be determined." 1>&2
  35. exit 1
  36. fi
  37. if [ ! -d "$SBS_HOME/$HOSTPLATFORM_DIR" ]; then
  38. cat 1>&2 <<EOERROR
  39. Error: sbs has not been installed with support for your platform: "${HOSTPLATFORM}".
  40. The utilites for your platform should be in "$SBS_HOME/$HOSTPLATFORM_DIR" but sbs
  41. cannot find them there.
  42. sbs is supported on:
  43. win32
  44. linux i386 libc2_3 (Redhat 4)
  45. sbs has been known to work (but is not supported) on:
  46. linux x86_64 libc2_5 (e.g. Centos/Redhat 5.3 64-bit)
  47. linux i386 libc2_8 (e.g. Fedora 9 32-bit)
  48. linux x86_64 libc2_10 (e.g. Fedora 11 64-bit)
  49. Even with the appropriate utilities it may be necessary to install 32-bit
  50. compatibility versions of some libraries (e.g. glibc) on these platforms,
  51. particularly for 3rd party tools which are not built natively such as
  52. compilers.
  53. It may be possible to build and install the utilities for your platform by
  54. entering $SBS_HOME/util and running
  55. make -k
  56. A full development environment is required however.
  57. EOERROR
  58. exit 1
  59. fi
  60. if [ "$OSTYPE" == "cygwin" ]; then
  61. # under Cygwin environment variables in "Windows form" should just be left
  62. # as they are. But, the PATH should be filled with /cygdrive/c "Unix form"
  63. # filenames, as Cygwin modifies that dynamically for each program.
  64. # Command for unixifying path strings. For example, "c:\some\path" and
  65. # "/cygdrive/c/some/path" are converted into "/cygdrive/c/some/path".
  66. u="/bin/cygpath.exe -u"
  67. __SBS__=$($u "$SBS_HOME")
  68. # use the internal MinGW unless SBS_MINGW is set
  69. __MINGW__=$($u "${SBS_MINGW:-$__SBS__/$HOSTPLATFORM_DIR/mingw}")
  70. # work out which version of Cygwin is in use.
  71. # if SBS_CYGWIN17 is set then assume 1.7, otherwise assume 1.5
  72. if [ -z "$SBS_CYGWIN17" ]; then
  73. # Tell Cygwin 1.5 not to map unix security attributes to
  74. # windows to prevent raptor from creating read-only files
  75. export CYGWIN='nontsec nosmbntsec'
  76. else
  77. # Tell Cygwin 1.7 not to complain about using DOS style
  78. # filenames instead of /cygdrive ones.
  79. # Make sure SBS_CYGWIN is the same as SBS_CYGWIN17
  80. export SBS_CYGWIN=$SBS_CYGWIN17
  81. export CYGWIN=nodosfilewarning
  82. fi
  83. export PATH=$__MINGW__/bin:/bin:$__SBS__/$HOSTPLATFORM_DIR/bin:$PATH
  84. # The python and PYTHONPATH used by Raptor are determined by, in order of precedence:
  85. # 1. the SBS_PYTHON3 environment variable (if set)
  86. # 2. the SBS_PYTHON and SBS_PYTHONPATH environment variables (if set)
  87. # 3. the python shipped locally with Raptor (if present)
  88. # 4. the python on the system PATH and PYTHONPATH/PYTHONHOME set in the system environment
  89. # Python variables need to run in Cygwin but be understandable to a
  90. # windows-centric interpreter, so we must use "mixed form" filenames.
  91. # Command for mixifying path strings. For example, "c:\some\path" and
  92. # "/cygdrive/c/some/path" are converted into "c:/some/path".
  93. m="/bin/cygpath.exe -m"
  94. __LOCAL_PYTHON__=$($m $SBS_HOME/win32/python27/python.exe)
  95. export PYTHONPATH=$SBS_HOME # location of the raptor package
  96. if [ -n "$SBS_PYTHON3" ]; then
  97. __PYTHON__=$SBS_PYTHON3
  98. elif [ -n "$SBS_PYTHON" ]; then
  99. __PYTHON__=$SBS_PYTHON
  100. elif [ -f "$__LOCAL_PYTHON__" ]; then
  101. __PYTHON__=$__LOCAL_PYTHON__
  102. export SBS_PYTHON=$__PYTHON__
  103. export PYTHONHOME=
  104. else
  105. __PYTHON__=python.exe
  106. fi
  107. export __PYTHON__=$($m "$__PYTHON__")
  108. if [ -n "$SBS_PYTHONPATH" ]; then
  109. export PYTHONPATH=$SBS_PYTHONPATH
  110. fi
  111. else
  112. if [ -n "$SBS_PYTHON3" ]; then
  113. export PYTHONPATH=${SBS_PYTHONPATH:-$PYTHONPATH}
  114. export __PYTHON__=$SBS_PYTHON3
  115. elif [ -n "$SBS_PYTHON" ]; then
  116. export PYTHONPATH=${SBS_PYTHONPATH:-$PYTHONPATH}
  117. export __PYTHON__=$SBS_PYTHON
  118. else
  119. PYDIR=python27 # not exported on purpose
  120. export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib}
  121. PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
  122. LD_LIBRARY_PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib:$SBS_HOME/$HOSTPLATFORM_DIR/bv/lib:$LD_LIBRARY_PATH
  123. export PATH LD_LIBRARY_PATH
  124. export __PYTHON__=python
  125. fi
  126. fi