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.

162 lines
5.1 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 - 2010 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=$(lib/version.sh)
  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 ./lib/sde-config/migrate.sh "$config"; then
  29. . config/$config/config
  30. else
  31. echo
  32. echo "ERROR: No configuration '$config' found!"
  33. echo
  34. echo "Please create a configuration using ./scripts/Config."
  35. echo
  36. exit 1
  37. fi
  38. if [ "${!SDEDEBUG_*}" ]; then
  39. echo "WARNING: Found SDEDEBUG_* in environment!" >&2
  40. fi
  41. . lib/output/parse-config
  42. [ "$SDECFG_CROSSBUILD" = 1 ] && crossnative=cross
  43. arch="${SDECFG_ARCH:-none}" ; target="${SDECFG_TARGET:-none}"
  44. # detect target chain
  45. targetchain="$target"; x="$target"
  46. while [ -f "target/$x/extends" ]; do
  47. x="`cat target/$x/extends`"
  48. targetchain="$targetchain $x"
  49. done
  50. if [ -f "architecture/$arch/archtest.out" ]
  51. then . "architecture/$arch/archtest.out" ; fi
  52. if [ -f "architecture/$arch/archtest.sh" ]
  53. then . "architecture/$arch/archtest.sh" ; fi
  54. base=$(pwd -P)
  55. if [ "$ROCK_THIS_IS_CHROOT" = 1 ]
  56. then
  57. toolsdir=tools.chroot
  58. else
  59. if [ $stagelevel -le 1 -a "$SDECFG_USE_CROSSCC" = 1 ]
  60. then
  61. toolsdir=tools.cross
  62. else
  63. toolsdir=tools.native
  64. fi
  65. fi
  66. new_path=
  67. for x in ${PATH//:/ }; do
  68. if [ -d "$x" -a -z "${x##/*}" -a -n "${x##$base/*}" -a \
  69. "$x" != "$CMD_WRAPPER_MYPATH" -a "$x" != "." ]; then
  70. new_path="$new_path:$x"
  71. fi
  72. done
  73. export PATH="${new_path#:}"
  74. unset new_path
  75. if [ $stagelevel -le 1 -a "$SDECFG_USE_CROSSCC" = 1 ] ; then
  76. export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/crosscc:$PATH"
  77. fi
  78. export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/bin:$PATH"
  79. export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper:$PATH"
  80. export PATH="$PATH:/usr/sbin:/sbin"
  81. export LC_ALL=C ; unset LANG ; umask 022
  82. export BUILDCC="cc" BUILD_CC="cc" HOSTCC="cc" HOST_CC="cc"
  83. export BUILDCXX="c++" BUILD_CXX="c++" HOSTCXX="c++" HOST_CXX="c++"
  84. unset CPP ARFLAGS ASFLAGS CFLAGS CXXFLAGS CPPFLAGS FFLAGS LDFLAGS
  85. unset LD_LIBRARY_PATH LD_PRELOAD FLWRAPPER C_INCLUDE_PATH CONFIG_SITE
  86. unset DISPLAY
  87. export STRIP_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
  88. export STRIP_WRAPPER_NOLOOP=0
  89. export INSTALL_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
  90. export INSTALL_WRAPPER_LOGFILE="/dev/null"
  91. export INSTALL_WRAPPER_FILTER=
  92. export INSTALL_WRAPPER_NOLOOP=0
  93. export CMD_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
  94. export CMD_WRAPPER_LOGFILE= CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0
  95. export CMD_WRAPPER_NOLOOP=0 ; unset CMD_WRAPPER_OTHERS_TMP
  96. export UNAME_WRAPPER_LOGFILE=
  97. if [ "$stagelevel" -le 1 ]; then
  98. # some tools built in stage 0 may rely on libraries built on the same stage
  99. #
  100. for x in lib/ usr/lib; do
  101. y="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/$x"
  102. [ -d "$y" ] || continue
  103. export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$y"
  104. done
  105. fi
  106. if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ]
  107. then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ; fi
  108. if [ "$stagelevel" -gt 1 -o "$SDECFG_USE_CROSSCC" = 0 ]
  109. then
  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. arch_build="$arch_target" ; archprefix=
  113. else
  114. arch_build="`/bin/uname -m | sed 's/ppc/powerpc/'`-nocross-linux-gnu"
  115. if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
  116. then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ; fi
  117. if [ $stagelevel -eq 1 ]; then
  118. archprefix="${arch_target}-"
  119. if [ ! -f "$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/`
  120. `crosscc/${archprefix}gcc" ]
  121. then archprefix="Cross_CC_not_built_so_far_" ; fi
  122. fi
  123. fi
  124. export CC="${archprefix}cc" CXX="${archprefix}c++" CPP="${archprefix}cpp"
  125. export AS="${archprefix}as" STRIP="${archprefix}strip"
  126. export LD="${archprefix}ld" GASP="${archprefix}gasp"
  127. export AR="${archprefix}ar" RANLIB="${archprefix}ranlib"
  128. export NM="${archprefix}nm" KCC="${archprefix}kcc"
  129. export F77="${archprefix}f77" MAKE="make"
  130. export AWK="gawk" SED="sed"
  131. # silently ignore tail / head and co related errors due to obsolete argument
  132. # usage (fixes a lot of stuff)
  133. export _POSIX2_VERSION=199209