|
#!/bin/sh
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: lib/parse-config
|
|
# Copyright (C) 2006 - 2008 The OpenSDE Project
|
|
# Copyright (C) 2004 - 2006 The T2 SDE Project
|
|
# Copyright (C) 1998 - 2003 Clifford Wolf
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
#
|
|
# This script sets environment settings and parses the
|
|
# configuration file config/$config/config
|
|
#
|
|
# [BEGIN] of version section
|
|
sdever=trunk
|
|
# [END] of version section
|
|
|
|
crossnative=native ; stagelevel=${stagelevel:-1} ; arch=any
|
|
arch_sizeof_long_long=undef ; arch_sizeof_int=undef ; export arch_machine=undef
|
|
arch_sizeof_char_p=undef ; arch_sizeof_long=undef ; arch_bigendian=undef
|
|
arch_sizeof_short=undef ; arch_target=any-unknown-linux
|
|
|
|
if [ -f config/$config/config ]
|
|
then
|
|
# NOTE: ROCKCFG -> SDECFG automatized convertion
|
|
grep -q 'ROCKCFG' ./config/$config/config &&
|
|
sed -i -e 's,ROCKCFG,SDECFG,g' ./config/$config/config
|
|
|
|
. config/$config/config
|
|
else
|
|
echo
|
|
echo "ERROR: No configuration '$config' found!"
|
|
echo
|
|
echo "Please create a configuration using ./scripts/Config."
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
if [ "${!SDEDEBUG_*}" ]; then
|
|
echo "WARNING: Found SDEDEBUG_* in environment!" >&2
|
|
fi
|
|
|
|
. lib/output/parse-config
|
|
|
|
[ "$SDECFG_CROSSBUILD" = 1 ] && crossnative=cross
|
|
arch="${SDECFG_ARCH:-none}" ; target="${SDECFG_TARGET:-none}"
|
|
|
|
# detect target chain
|
|
targetchain="$target"; x="$target"
|
|
while [ -f "target/$x/extends" ]; do
|
|
x="`cat target/$x/extends`"
|
|
targetchain="$targetchain $x"
|
|
done
|
|
|
|
if [ -f "architecture/$arch/archtest.out" ]
|
|
then . "architecture/$arch/archtest.out" ; fi
|
|
|
|
if [ -f "architecture/$arch/archtest.sh" ]
|
|
then . "architecture/$arch/archtest.sh" ; fi
|
|
|
|
base=$(pwd -P)
|
|
|
|
if [ "$ROCK_THIS_IS_CHROOT" = 1 ]
|
|
then
|
|
toolsdir=tools.chroot
|
|
else
|
|
if [ $stagelevel -le 1 -a "$SDECFG_USE_CROSSCC" = 1 ]
|
|
then
|
|
toolsdir=tools.cross
|
|
else
|
|
toolsdir=tools.native
|
|
fi
|
|
fi
|
|
|
|
new_path=
|
|
for x in ${PATH//:/ }; do
|
|
if [ -d "$x" -a -z "${x##/*}" -a -n "${x##$base/*}" -a \
|
|
"$x" != "$CMD_WRAPPER_MYPATH" -a "$x" != "." ]; then
|
|
new_path="$new_path:$x"
|
|
fi
|
|
done
|
|
export PATH="${new_path#:}"
|
|
unset new_path
|
|
|
|
if [ $stagelevel -le 1 -a "$SDECFG_USE_CROSSCC" = 1 ] ; then
|
|
export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/crosscc:$PATH"
|
|
fi
|
|
|
|
export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/bin:$PATH"
|
|
export PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper:$PATH"
|
|
export PATH="$PATH:/usr/sbin:/sbin"
|
|
export LC_ALL=C ; unset LANG ; umask 022
|
|
|
|
export BUILDCC="cc" BUILD_CC="cc" HOSTCC="cc" HOST_CC="cc"
|
|
export BUILDCXX="c++" BUILD_CXX="c++" HOSTCXX="c++" HOST_CXX="c++"
|
|
|
|
unset CPP ARFLAGS ASFLAGS CFLAGS CXXFLAGS CPPFLAGS FFLAGS LDFLAGS
|
|
unset LD_LIBRARY_PATH LD_PRELOAD FLWRAPPER C_INCLUDE_PATH CONFIG_SITE
|
|
unset DISPLAY
|
|
|
|
export STRIP_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
|
|
export STRIP_WRAPPER_NOLOOP=0
|
|
|
|
export INSTALL_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
|
|
export INSTALL_WRAPPER_LOGFILE="/dev/null"
|
|
export INSTALL_WRAPPER_FILTER=
|
|
export INSTALL_WRAPPER_NOLOOP=0
|
|
|
|
export CMD_WRAPPER_MYPATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/wrapper"
|
|
export CMD_WRAPPER_LOGFILE= CMD_WRAPPER_DEBUG=0 CMD_WRAPPER_BYPASS=0
|
|
export CMD_WRAPPER_NOLOOP=0 ; unset CMD_WRAPPER_OTHERS_TMP
|
|
|
|
export UNAME_WRAPPER_LOGFILE=
|
|
|
|
if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ]
|
|
then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/wrapper-config ; fi
|
|
|
|
if [ "$stagelevel" -gt 1 -o "$SDECFG_USE_CROSSCC" = 0 ]
|
|
then
|
|
if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
|
|
then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ; fi
|
|
|
|
arch_build="$arch_target" ; archprefix=
|
|
else
|
|
arch_build="`/bin/uname -m | sed 's/ppc/powerpc/'`-nocross-linux-gnu"
|
|
|
|
if [ -f $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ]
|
|
then . $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/lib/parse-config-fixarch ; fi
|
|
|
|
if [ $stagelevel -eq 1 ]; then
|
|
archprefix="${arch_target}-"
|
|
if [ ! -f "$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/`
|
|
`crosscc/${archprefix}gcc" ]
|
|
then archprefix="Cross_CC_not_built_so_far_" ; fi
|
|
fi
|
|
fi
|
|
|
|
export CC="${archprefix}cc" CXX="${archprefix}c++" CPP="${archprefix}cpp"
|
|
export AS="${archprefix}as" STRIP="${archprefix}strip"
|
|
export LD="${archprefix}ld" GASP="${archprefix}gasp"
|
|
export AR="${archprefix}ar" RANLIB="${archprefix}ranlib"
|
|
export NM="${archprefix}nm" KCC="${archprefix}kcc"
|
|
export F77="${archprefix}f77" MAKE="make"
|
|
export AWK="gawk" SED="sed"
|
|
|
|
# silently ignore tail / head and co related errors due to obsolete argument
|
|
# usage (fixes a lot of stuff)
|
|
export _POSIX2_VERSION=199209
|
|
|