1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: scripts/parse-config
3 # Copyright (C) 2004 - 2022 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 # This script sets environment settings and parses the
14 # configuration file config/$config/config
16 # [BEGIN] of version section
18 # [END] of version section
20 crossnative=native ; stagelevel=${stagelevel:-1}; arch=any
21 arch_sizeof_long_long=undef ; arch_sizeof_int=undef ; export arch_machine=undef
22 arch_sizeof_char_p=undef ; arch_sizeof_long=undef ; arch_bigendian=undef
23 arch_sizeof_short=undef ; arch_target=any-unknown-linux
25 if [ -f config/$config/config ]
27 . config/$config/config
30 echo "ERROR: No configuration '$config' found!"
32 echo "Please create a configuration using scripts/Config."
37 if [ "${!SDEDEBUG_*}" ]; then
38 echo "WARNING: Found SDEDEBUG_* in environment!" >&2
41 . misc/output/parse-config
43 [ "$SDECFG_CROSSBUILD" = 1 ] && crossnative=cross
44 arch="${SDECFG_ARCH:-none}"; target="${SDECFG_TARGET:-none}"
47 targetchain="$target"; x="$target"
48 while [ -f "target/$x/extends" ]; do
49 x="$(< target/$x/extends)"
50 targetchain="$targetchain $x"
53 if [ -f "architecture/$arch/archtest.out" ]
54 then . "architecture/$arch/archtest.out"; fi
56 if [ -f "architecture/$arch/archtest.sh" ]
57 then . "architecture/$arch/archtest.sh"; fi
61 if [ "$SDE_THIS_IS_CHROOT" = 1 ]
65 if [ $stagelevel -le 2 -a "$SDECFG_USE_CROSSCC" = 1 ]
74 for x in ${PATH//:/ }; do
75 if [ -d "$x" -a -z "${x##/*}" -a -n "${x##$base/*}" -a \
76 "$x" != "$CMD_WRAPPER_MYPATH" -a "$x" != "." ]; then
77 new_path="$new_path:$x"
80 export PATH="${new_path#:}"
83 if [ $stagelevel -le 2 -a "$SDECFG_USE_CROSSCC" = 1 ]; then
84 export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/crosscc:$PATH"
87 export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/bin:$PATH"
88 export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper:$PATH"
89 export LC_ALL=C; unset LANG; umask 022
91 export BUILDCC="cc" BUILD_CC="cc" HOSTCC="cc" HOST_CC="cc"
92 export BUILDCXX="c++" BUILD_CXX="c++" HOSTCXX="c++" HOST_CXX="c++"
94 unset CPP ARFLAGS ASFLAGS CFLAGS CXXFLAGS CPPFLAGS FFLAGS LDFLAGS
95 unset LD_LIBRARY_PATH LD_PRELOAD FLWRAPPER C_INCLUDE_PATH CONFIG_SITE
100 export STRIP_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
101 export STRIP_WRAPPER_NOLOOP=0
103 export INSTALL_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
104 export INSTALL_WRAPPER_LOGFILE="/dev/null"
105 export INSTALL_WRAPPER_FILTER=""
106 export INSTALL_WRAPPER_NOLOOP=0
108 export CMD_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
109 export CMD_WRAPPER_LOGFILE="" CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0
110 export CMD_WRAPPER_NOLOOP=0; unset CMD_WRAPPER_OTHERS_TMP
112 if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ]
113 then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config; fi
115 if [ "$stagelevel" -gt 2 -o "$SDECFG_USE_CROSSCC" = 0 ]
117 if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
118 then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch; fi
120 arch_build="$arch_target"; archprefix=""
122 arch_build="`/bin/uname -m | sed 's/ppc/powerpc/'`-nocross-linux-gnu"
124 if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
125 then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch; fi
127 if [ $stagelevel -eq 1 -o $stagelevel -eq 2 ]; then
128 archprefix="${arch_target}-"
129 if [ ! -f "$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/`
130 `crosscc/${archprefix}cc" ]
131 then archprefix="Cross_CC_not_built_so_far_"; fi
135 export CC="${archprefix}cc" CXX="${archprefix}c++" CPP="${archprefix}cpp"
136 export AS="${archprefix}as" STRIP="${archprefix}strip" OBJCOPY="${archprefix}objcopy"
137 export LD="${archprefix}ld" GASP="${archprefix}gasp" OBJDUMP="${archprefix}objdump"
138 export AR="${archprefix}ar" RANLIB="${archprefix}ranlib"
139 export NM="${archprefix}nm" KCC="${archprefix}kcc"
140 export F77="${archprefix}f77" MAKE="make"
141 export AWK="gawk" SED="sed"
143 # silently ignore tail / head and co related errors due to obsolete argument
144 # usage (fixes a lot of stuff)
145 export _POSIX2_VERSION=199209