setup.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/usr/bin/env sh
  2. # generated from catkin/cmake/template/setup.sh.in
  3. # Sets various environment variables and sources additional environment hooks.
  4. # It tries it's best to undo changes from a previously sourced setup file before.
  5. # Supported command line options:
  6. # --extend: skips the undoing of changes from a previously sourced setup file
  7. # (in plain sh shell which does't support arguments for sourced scripts you
  8. # can set the environment variable `CATKIN_SETUP_UTIL_ARGS=--extend` instead)
  9. # since this file is sourced either use the provided _CATKIN_SETUP_DIR
  10. # or fall back to the destination set at configure time
  11. : ${_CATKIN_SETUP_DIR:=/home/corvin/project/face_tracker/ros_code/devel}
  12. _SETUP_UTIL="$_CATKIN_SETUP_DIR/_setup_util.py"
  13. unset _CATKIN_SETUP_DIR
  14. if [ ! -f "$_SETUP_UTIL" ]; then
  15. echo "Missing Python script: $_SETUP_UTIL"
  16. return 22
  17. fi
  18. # detect if running on Darwin platform
  19. _UNAME=`uname -s`
  20. _IS_DARWIN=0
  21. if [ "$_UNAME" = "Darwin" ]; then
  22. _IS_DARWIN=1
  23. fi
  24. unset _UNAME
  25. # make sure to export all environment variables
  26. export CMAKE_PREFIX_PATH
  27. if [ $_IS_DARWIN -eq 0 ]; then
  28. export LD_LIBRARY_PATH
  29. else
  30. export DYLD_LIBRARY_PATH
  31. fi
  32. unset _IS_DARWIN
  33. export PATH
  34. export PKG_CONFIG_PATH
  35. export PYTHONPATH
  36. # remember type of shell if not already set
  37. if [ -z "$CATKIN_SHELL" ]; then
  38. CATKIN_SHELL=sh
  39. fi
  40. # invoke Python script to generate necessary exports of environment variables
  41. # use TMPDIR if it exists, otherwise fall back to /tmp
  42. if [ -d "${TMPDIR:-}" ]; then
  43. _TMPDIR="${TMPDIR}"
  44. else
  45. _TMPDIR=/tmp
  46. fi
  47. _SETUP_TMP=`mktemp "${_TMPDIR}/setup.sh.XXXXXXXXXX"`
  48. unset _TMPDIR
  49. if [ $? -ne 0 -o ! -f "$_SETUP_TMP" ]; then
  50. echo "Could not create temporary file: $_SETUP_TMP"
  51. return 1
  52. fi
  53. CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" $@ ${CATKIN_SETUP_UTIL_ARGS:-} >> "$_SETUP_TMP"
  54. _RC=$?
  55. if [ $_RC -ne 0 ]; then
  56. if [ $_RC -eq 2 ]; then
  57. echo "Could not write the output of '$_SETUP_UTIL' to temporary file '$_SETUP_TMP': may be the disk if full?"
  58. else
  59. echo "Failed to run '\"$_SETUP_UTIL\" $@': return code $_RC"
  60. fi
  61. unset _RC
  62. unset _SETUP_UTIL
  63. rm -f "$_SETUP_TMP"
  64. unset _SETUP_TMP
  65. return 1
  66. fi
  67. unset _RC
  68. unset _SETUP_UTIL
  69. . "$_SETUP_TMP"
  70. rm -f "$_SETUP_TMP"
  71. unset _SETUP_TMP
  72. # source all environment hooks
  73. _i=0
  74. while [ $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT ]; do
  75. eval _envfile=\$_CATKIN_ENVIRONMENT_HOOKS_$_i
  76. unset _CATKIN_ENVIRONMENT_HOOKS_$_i
  77. eval _envfile_workspace=\$_CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE
  78. unset _CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE
  79. # set workspace for environment hook
  80. CATKIN_ENV_HOOK_WORKSPACE=$_envfile_workspace
  81. . "$_envfile"
  82. unset CATKIN_ENV_HOOK_WORKSPACE
  83. _i=$((_i + 1))
  84. done
  85. unset _i
  86. unset _CATKIN_ENVIRONMENT_HOOKS_COUNT