From d6206d142266cadb8b01a6f504662cb5446e6c15 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 22 Jan 2007 12:00:05 +0000 Subject: [PATCH] Extract gcc common functionality to the separate file in order to avoid code duplication --- config_files/gcc-3.2.sh | 124 +------------------------------------ config_files/gcc-3.3.5.sh | 95 +--------------------------- config_files/gcc-3.4.sh | 95 +--------------------------- config_files/gcc-4.0.0.sh | 16 +++++ config_files/gcc-4.0.1.sh | 95 +--------------------------- config_files/gcc-common.sh | 115 ++++++++++++++++++++++++++++++++++ 6 files changed, 139 insertions(+), 401 deletions(-) create mode 100755 config_files/gcc-4.0.0.sh create mode 100755 config_files/gcc-common.sh diff --git a/config_files/gcc-3.2.sh b/config_files/gcc-3.2.sh index e830813..7027000 100755 --- a/config_files/gcc-3.2.sh +++ b/config_files/gcc-3.2.sh @@ -12,125 +12,5 @@ # #################################################################################### -check_version(){ -# version number is calculated as: *10000+*100+ -# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202 -gcc_ver=`gcc -dumpversion | awk -F[.-] '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` -if [ $gcc_ver -eq 30200 ] ; then - return 0 -fi -return 1 -} - -print_env(){ -cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <, and - # and numbers are checked strickly, but number can be larger than required one - # version number is calculated as: *10000+*100+ - # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202 - maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'` - min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'` - rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'` - let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver - if [ $gcc_ver -ge 30200 ] ; then - tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}"; - path=`sort_path ${tmp}` - tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; - ld_library_path=`sort_path ${tmp}` - cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <*10000+*100+ -# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 3.3.5 - 30305 -gcc_ver=`gcc -dumpversion | awk -F[.-] '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` -if [ $gcc_ver -eq 30305 ] ; then - return 0 -fi -return 1 -} - -print_env(){ -cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <, and - # and numbers are checked strickly, but number can be larger than required one - # version number is calculated as: *10000+*100+ - # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 3.3.5 - 30305 - maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'` - min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'` - rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'` - let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver - if [ $gcc_ver -ge 30305 ] ; then - tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}"; - path=`sort_path ${tmp}` - tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; - ld_library_path=`sort_path ${tmp}` - cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <*10000+*100+ -# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401 -gcc_ver=`gcc -dumpversion | awk -F[.-] '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` -if [ $gcc_ver -eq 30401 ] ; then - return 0 -fi -return 1 -} - -print_env(){ -cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <, and - # and numbers are checked strickly, but number can be larger than required one - # version number is calculated as: *10000+*100+ - # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401 - maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'` - min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'` - rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'` - let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver - if [ $gcc_ver -ge 30401 ] ; then - tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}"; - path=`sort_path ${tmp}` - tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; - ld_library_path=`sort_path ${tmp}` - cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <*10000+*100+ -# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 4.0.1 - 40001 -gcc_ver=`gcc -dumpversion | awk -F[.-] '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` -if [ $gcc_ver -eq 40001 ] ; then - return 0 -fi -return 1 -} - -print_env(){ -cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <, and - # and numbers are checked strickly, but number can be larger than required one - # version number is calculated as: *10000+*100+ - # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.4.1 - 30401, for gcc 4.0.1 - 40001 - maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'` - min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'` - rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'` - let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver - if [ $gcc_ver -ge 40001 ] ; then - tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}"; - path=`sort_path ${tmp}` - tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; - ld_library_path=`sort_path ${tmp}` - cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <0) print $1; else print 0}'` +GCC_VERSION_MIN=`echo $GCC_VERSION | awk -F[.-] '{if(NF>1) print $2; else print 0}'` +GCC_VERSION_REL=`echo $GCC_VERSION | awk -F[.-] '{if(NF>2) print $3; else print 0}'` +let GCC_VERSION_ID=$GCC_VERSION_MAJ*10000+$GCC_VERSION_MIN*100+$GCC_VERSION_REL + +check_version(){ +# version number is calculated as: *10000+*100+ +# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202 +gcc_ver=`gcc -dumpversion | awk -F[.-] '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` +if [ $gcc_ver -eq $GCC_VERSION_ID ] ; then + return 0 +fi +return 1 +} + +print_env(){ +cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <, and + # and numbers are checked strickly, but number can be larger than required one + # version number is calculated as: *10000+*100+ + # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202 + maj_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>0) print $1; else print 0}'` + min_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>1) print $2; else print 0}'` + rel_ver=`${gcc_root}/bin/gcc -dumpversion | awk -F[.-] '{if(NF>2) print $3; else print 0}'` + let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver + if [ $gcc_ver -ge $GCC_VERSION_ID ] ; then + tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}"; + path=`sort_path ${tmp}` + tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; + ld_library_path=`sort_path ${tmp}` + cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <