4 gcc_ver=`gcc -dumpversion`
5 gcc_ver_number=`echo $gcc_ver | cut -d . -f 1`
6 gcc_ver_subnumber=`echo $gcc_ver | cut -d . -f 2`
7 gcc_ver=$(($gcc_ver_number*1000+$gcc_ver_subnumber))
8 #if [ `gcc --version | grep 'gcc (GCC) .*' | cut -b 11-13` == "3.2" ] ; then
9 if [ $gcc_ver -eq 3002 ] ; then
16 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
17 #$DELIM ${PRODUCT_TYPE} $DELIM
18 export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
19 export CXX=\${GCC_ROOT}/bin/g++
20 export CC=\${GCC_ROOT}/bin/gcc
21 export PATH=\${GCC_ROOT}/bin:\${PATH}
22 export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
25 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
26 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
29 # looks for the native product and collects it's environment (used by make_env())
31 gcc_root="`find_in_path gcc ${PATH}`"
32 if [ -z "${gcc_root}" ] ; then
33 gcc_root="`find_in_path gcc /usr/bin`"
35 if [ -n "${gcc_root}" ] ; then
36 gcc_root=`cd ${gcc_root}/..; pwd`
37 gcc_ver=`gcc -dumpversion`
38 gcc_ver_number=`echo $gcc_ver | cut -d . -f 1`
39 gcc_ver_subnumber=`echo $gcc_ver | cut -d . -f 2`
40 gcc_ver=$(($gcc_ver_number*1000+$gcc_ver_subnumber))
41 #if [ "`${gcc_root}/bin/gcc --version | grep 'gcc (GCC) .*' | cut -b 11-13`" = "3.2" ] ; then
42 if [ $gcc_ver -ge 3002 ] ; then
43 tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}";
44 path=`sort_path ${tmp}`
45 tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
46 ld_library_path=`sort_path ${tmp}`
47 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
48 #$DELIM ${PRODUCT_TYPE} $DELIM
49 export GCC_ROOT=${gcc_root}
50 export CXX=\${GCC_ROOT}/bin/g++
51 export CC=\${GCC_ROOT}/bin/gcc
53 export LD_LIBRARY_PATH=${ld_library_path}
56 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
57 if [ $gcc_ver -eq 3002 ] ; then
68 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
76 echo "It impossible to build gcc-3.2 on your current compiler (gcc-3.2)."
77 echo "Installation aborted."
81 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
82 source ${INSTALL_WORK}/$SHRC
84 #check if $LIBRARY_PATH and $GCC_EXEC_PREFIX are set and then remove path to current dir from them
85 if [ -n "$LIBRARY_PATH" ]; then
86 export LIBRARY_PATH=`echo $LIBRARY_PATH | sed -e's/^[:\;]*//g' -e's/[:\;]*$//g' -e's/::*/:/g' -e's/;;*/;/g' -e's/[:\;].$//g' -e's/^.[:\;]//g' -e's/[:\;].[:\;]/:/g' -e's/^.$//g'`
88 if [ -n "$GCC_EXEC_PREFIX" ]; then
89 export GCC_EXEC_PREFIX=`echo $GCC_EXEC_PREFIX | sed -e's/^[:\;]*//g' -e's/[:\;]*$//g' -e's/::*/:/g' -e's/;;*/;/g' -e's/[:\;].$//g' -e's/^.[:\;]//g' -e's/[:\;].[:\;]/:/g' -e's/^.$//g'`
92 check_jb tar xfz ${SOURCE_DIR}/gcc-3.2.tar.gz -C ${INSTALL_WORK}
94 makedir ${PRODUCT_DIR}
96 makedir ${PRODUCT_WORK}-build
97 cd ${PRODUCT_WORK}-build
99 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_WORK}/configure --prefix=${PRODUCT_DIR} --enable-static --enable-shared --enable-threads
100 check_job ${PRODUCT_DIR}/BOOTSTRAP.LOG make bootstrap
101 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
103 rm -fr ${PRODUCT_WORK} ${PRODUCT_WORK}-build
109 echo "It impossible to install gcc from binaries, try install from sources."
114 export INSTALL_WORK=$2;
115 export SOURCE_DIR=$3;
116 export INSTALL_ROOT=$4;
117 export PRODUCT_SEQUENCE=$5;
118 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
119 export PRODUCT="gcc-3.2"
120 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
121 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}