setup.sh 2.7 KB

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