* added python-wheel (0.42.0) - The official binary distribution format for Python
[t2sde.git] / scripts / parse-config
blobbf59035edf52855d329012ee1a60f54c5e5638ad
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: scripts/parse-config
3 # Copyright (C) 2004 - 2024 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
5
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
8
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
17 sdever=24-svn
18 # [END] of version section
20 crossnative=native arch=any stagelevel=${stagelevel:-1} arch_target=any-unknown-linux
21 arch_sizeof_long_long=undef arch_sizeof_int=undef   arch_sizeof_short=undef
22 arch_sizeof_char_p=undef    arch_sizeof_long=undef  arch_bigendian=undef
23 export arch_machine=undef
25 if [ -f config/$config/config ]
26 then
27         . config/$config/config
28 else
29         echo
30         echo "ERROR: No configuration '$config' found!"
31         echo
32         echo "Please create a configuration using scripts/Config."
33         echo
34         exit 1
37 if [ "${!SDEDEBUG_*}" ]; then
38         echo "WARNING: Found SDEDEBUG_* in environment!" >&2
41 . misc/output/parse-config
43 # enable bash getconf plugin, if possible, in case system does not have a getconf
44 enable getconf 2>/dev/null
46 [ "$SDECFG_PARALLEL_MAX" = "auto" ] &&
47         SDECFG_PARALLEL_MAX="$(getconf _NPROCESSORS_ONLN)"
49 [ "$SDECFG_CROSSBUILD" = 1 ] && crossnative=cross
50 arch="${SDECFG_ARCH:-none}" target="${SDECFG_TARGET:-none}"
52 # detect target chain
53 targetchain="$target" x="$target"
54 while [ -f "target/$x/extends" ]; do
55         x="$(< target/$x/extends)"
56         targetchain="$targetchain $x"
57 done
59 if [ -f "architecture/$arch/archtest.out" ]
60         then . "architecture/$arch/archtest.out"; fi
62 if [ -f "architecture/$arch/archtest.sh" ]
63         then . "architecture/$arch/archtest.sh"; fi
65 base=$(pwd -P)
67 if [ "$SDE_THIS_IS_CHROOT" = 1 ]
68 then
69         toolsdir=tools.chroot
70 else
71         if [ $stagelevel -le 2 -a "$SDECFG_USE_CROSSCC" = 1 ]
72         then
73                 toolsdir=cross
74         else
75                 toolsdir=native
76         fi
79 new_path=""
80 for x in ${PATH//:/ }; do
81         if [ -d "$x" -a -z "${x##/*}" -a -n "${x##$base/*}" -a \
82              "$x" != "$CMD_WRAPPER_MYPATH" -a "$x" != "." ]; then
83                 new_path="$new_path:$x"
84         fi
85 done
86 export PATH="${new_path#:}"
87 unset new_path
89 export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/bin:$PATH"
90 export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper:$PATH"
91 export LC_ALL=C; unset LANG; umask 022
93 export BUILDCC="cc"   BUILD_CC="cc"   HOSTCC="cc"   HOST_CC="cc"
94 export BUILDCXX="c++" BUILD_CXX="c++" HOSTCXX="c++" HOST_CXX="c++"
96 unset CPP ARFLAGS ASFLAGS CFLAGS CXXFLAGS CPPFLAGS FFLAGS LDFLAGS
97 unset LD_LIBRARY_PATH LD_PRELOAD FLWRAPPER C_INCLUDE_PATH CONFIG_SITE
98 unset DESTDIR DISPLAY
100 export HOME='/root'
102 export STRIP_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
103 export STRIP_WRAPPER_NOLOOP=0
105 export INSTALL_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
106 export INSTALL_WRAPPER_LOGFILE="/dev/null"
107 export INSTALL_WRAPPER_FILTER=""
108 export INSTALL_WRAPPER_NOLOOP=0
110 export CMD_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
111 export CMD_WRAPPER_LOGFILE="" CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0
112 export CMD_WRAPPER_NOLOOP=0; unset CMD_WRAPPER_OTHERS_TMP
114 export LDCONFIG=$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper/ldconfig
116 if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ]
117 then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config; fi
119 if [ "$stagelevel" -gt 2 -o "$SDECFG_USE_CROSSCC" = 0 ]
120 then
121         if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
122         then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch; fi
124         arch_build="$arch_target" archprefix=""
125 else
126         # remove wrapper path to run system uname
127         arch_build="`PATH="${PATH/$CMD_WRAPPER_MYPATH:/}" uname -m |
128                 sed 's/ppc/powerpc/'`-nocross-linux-gnu"
130         if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
131         then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch; fi
133         if [ $stagelevel -eq 1 -o $stagelevel -eq 2 ]; then
134                 archprefix="${arch_target}-"
135                 if [ ! -f "$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/bin/${archprefix}cc" ]
136                 then archprefix="Cross_CC_not_built_so_far_"; fi
137         fi
140 export CC="${archprefix}cc"     CXX="${archprefix}c++"          CPP="${archprefix}cpp"
141 export AS="${archprefix}as"     STRIP="${archprefix}strip"      OBJCOPY="${archprefix}objcopy"
142 export LD="${archprefix}ld"     GASP="${archprefix}gasp"        OBJDUMP="${archprefix}objdump"
143 export AR="${archprefix}ar"     RANLIB="${archprefix}ranlib"
144 export NM="${archprefix}nm"     KCC="${archprefix}kcc"
145 export F77="${archprefix}f77"   MAKE="make"
146 export AWK="gawk"               SED="sed"
148 # silently ignore tail / head and co related errors due to obsolete argument
149 # usage (fixes a lot of stuff)
150 export _POSIX2_VERSION=199209