OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
4.9 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: lib/parse-config
  6. # Copyright (C) 2006 - 2007 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. #
  18. # This script sets environment settings and parses the
  19. # configuration file config/$config/config
  20. #
  21. # [BEGIN] of version section
  22. sdever=trunk
  23. # [END] of version section
  24. crossnative=native ; stagelevel=${stagelevel:-1} ; arch=any
  25. arch_sizeof_long_long=undef ; arch_sizeof_int=undef ; export arch_machine=undef
  26. arch_sizeof_char_p=undef ; arch_sizeof_long=undef ; arch_bigendian=undef
  27. arch_sizeof_short=undef ; arch_target=any-unknown-linux
  28. if [ -f config/$config/config ]
  29. then
  30. # NOTE: ROCKCFG -> SDECFG automatized convertion
  31. grep -q 'ROCKCFG' ./config/$config/config &&
  32. sed -i -e 's,ROCKCFG,SDECFG,g' ./config/$config/config
  33. . config/$config/config
  34. else
  35. echo
  36. echo "ERROR: No configuration '$config' found!"
  37. echo
  38. echo "Please create a configuration using ./scripts/Config."
  39. echo
  40. exit 1
  41. fi
  42. if [ "${!SDEDEBUG_*}" ]; then
  43. echo "WARNING: Found SDEDEBUG_* in environment!" >&2
  44. fi
  45. . lib/output/parse-config
  46. [ "$SDECFG_CROSSBUILD" = 1 ] && crossnative=cross
  47. arch="${SDECFG_ARCH:-none}" ; target="${SDECFG_TARGET:-none}"
  48. # detect target chain
  49. targetchain="$target"; x="$target"
  50. while [ -f "target/$x/extends" ]; do
  51. x="`cat target/$x/extends`"
  52. targetchain="$targetchain $x"
  53. done
  54. if [ -f "architecture/$arch/archtest.out" ]
  55. then . "architecture/$arch/archtest.out" ; fi
  56. if [ -f "architecture/$arch/archtest.sh" ]
  57. then . "architecture/$arch/archtest.sh" ; fi
  58. base=$(pwd -P)
  59. if [ "$ROCK_THIS_IS_CHROOT" = 1 ]
  60. then
  61. toolsdir=tools.chroot
  62. else
  63. if [ $stagelevel -le 1 -a "$SDECFG_USE_CROSSCC" = 1 ]
  64. then
  65. toolsdir=tools.cross
  66. else
  67. toolsdir=tools.native
  68. fi
  69. fi
  70. new_path=""
  71. for x in ${PATH//:/ }; do
  72. if [ -d "$x" -a -z "${x##/*}" -a -n "${x##$base/*}" -a \
  73. "$x" != "$CMD_WRAPPER_MYPATH" -a "$x" != "." ]; then
  74. new_path="$new_path:$x"
  75. fi
  76. done
  77. export PATH="${new_path#:}"
  78. unset new_path
  79. if [ $stagelevel -le 1 -a "$SDECFG_USE_CROSSCC" = 1 ] ; then
  80. export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/crosscc:$PATH"
  81. fi
  82. export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/bin:$PATH"
  83. export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper:$PATH"
  84. export PATH="$PATH:/usr/sbin:/sbin"
  85. export LC_ALL=C ; unset LANG ; umask 022
  86. export BUILDCC="cc" BUILD_CC="cc" HOSTCC="cc" HOST_CC="cc"
  87. export BUILDCXX="c++" BUILD_CXX="c++" HOSTCXX="c++" HOST_CXX="c++"
  88. unset CPP ARFLAGS ASFLAGS CFLAGS CXXFLAGS CPPFLAGS FFLAGS LDFLAGS
  89. unset LD_LIBRARY_PATH LD_PRELOAD FLWRAPPER C_INCLUDE_PATH CONFIG_SITE
  90. unset DISPLAY
  91. export STRIP_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
  92. export STRIP_WRAPPER_NOLOOP=0
  93. export INSTALL_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
  94. export INSTALL_WRAPPER_LOGFILE="/dev/null"
  95. export INSTALL_WRAPPER_FILTER=""
  96. export INSTALL_WRAPPER_NOLOOP=0
  97. export CMD_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
  98. export CMD_WRAPPER_LOGFILE="" CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0
  99. export CMD_WRAPPER_NOLOOP=0 ; unset CMD_WRAPPER_OTHERS_TMP
  100. export UNAME_WRAPPER_LOGFILE=""
  101. if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ]
  102. then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ; fi
  103. if [ "$stagelevel" -gt 1 -o "$SDECFG_USE_CROSSCC" = 0 ]
  104. then
  105. if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
  106. then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ; fi
  107. arch_build="$arch_target" ; archprefix=""
  108. else
  109. arch_build="`/bin/uname -m | sed 's/ppc/powerpc/'`-nocross-linux-gnu"
  110. if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
  111. then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ; fi
  112. if [ $stagelevel -eq 1 ]; then
  113. archprefix="${arch_target}-"
  114. if [ ! -f "$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/`
  115. `crosscc/${archprefix}gcc" ]
  116. then archprefix="Cross_CC_not_built_so_far_" ; fi
  117. fi
  118. fi
  119. export CC="${archprefix}cc" CXX="${archprefix}c++" CPP="${archprefix}cpp"
  120. export AS="${archprefix}as" STRIP="${archprefix}strip"
  121. export LD="${archprefix}ld" GASP="${archprefix}gasp"
  122. export AR="${archprefix}ar" RANLIB="${archprefix}ranlib"
  123. export NM="${archprefix}nm" KCC="${archprefix}kcc"
  124. export F77="${archprefix}f77" MAKE="make"
  125. export AWK="gawk" SED="sed"
  126. # silently ignore tail / head and co related errors due to obsolete argument
  127. # usage (fixes a lot of stuff)
  128. export _POSIX2_VERSION=199209