tools/addToolVersion.sh
changeset 1001 c8ac48ba1411
parent 548 3cd87bbfdf5a
     1.1 --- a/tools/addToolVersion.sh	Mon Jun 09 16:36:40 2008 +0000
     1.2 +++ b/tools/addToolVersion.sh	Mon Oct 27 18:42:26 2008 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4      cat <<-EOF
     1.5  Usage: ${myname} <tool> [option] <version>
     1.6    'tool' in one of:
     1.7 -    --gcc, --binutils, --glibc, --uClibc, --linux,
     1.8 +    --gcc, --binutils, --glibc, --eglibc, --uClibc, --linux,
     1.9      --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
    1.10      --gmp, --mpfr
    1.11  
    1.12 @@ -18,24 +18,20 @@
    1.13      --obsolete, -o
    1.14        mark the version as being obsolete
    1.15  
    1.16 -  Valid mandatory 'option' for tool==linux is one and only one of:
    1.17 -    --install, --sanitised, --copy
    1.18 -
    1.19    'version' is a valid version for the specified tool.
    1.20  
    1.21    Examples:
    1.22 -    add version 2.6.19.2 to linux kernel install method:
    1.23 -      ${myname} --linux --install 2.6.19.2
    1.24 +    add version 2.6.19.2 to linux kernel:
    1.25 +      ${myname} --linux 2.6.19.2
    1.26  
    1.27 -    add versions 2.3.5 and 2.3.6 to glibc:
    1.28 -      ${myname} --glibc 2.3.5 2.3.6
    1.29 +    add experimental versions 2.3.5 and 2.3.6 to glibc:
    1.30 +      ${myname} --glibc -x 2.3.5 2.3.6
    1.31  EOF
    1.32  }
    1.33  
    1.34  cat=
    1.35  tool=
    1.36  tool_prefix=
    1.37 -tool_suffix=
    1.38  VERSION=
    1.39  EXP=
    1.40  OBS=
    1.41 @@ -45,25 +41,23 @@
    1.42  while [ $i -le $# ]; do
    1.43      case "${!i}" in
    1.44          # Tools:
    1.45 -        --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc;      tool_suffix=;;
    1.46 -        --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;        tool_suffix=;;
    1.47 -        --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc;    tool_suffix=;;
    1.48 -        --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc;    tool_suffix=;;
    1.49 -        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel;  tool_suffix=;;
    1.50 -        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug    tool_suffix=;;
    1.51 -        --dmalloc)          cat=DMALLOC;   tool=dmalloc;  tool_prefix=debug    tool_suffix=;;
    1.52 -        --duma)             cat=DUMA;      tool=duma;     tool_prefix=debug    tool_suffix=;;
    1.53 -        --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug    tool_suffix=;;
    1.54 -        --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug    tool_suffix=;;
    1.55 -        --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools    tool_suffix=;;
    1.56 -        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=cc;      tool_suffix=;;
    1.57 -        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=cc;      tool_suffix=;;
    1.58 +        --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc;;
    1.59 +        --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;;
    1.60 +        --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc;;
    1.61 +        --eglibc)           cat=LIBC;      tool=eglibc;   tool_prefix=libc;;
    1.62 +        --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc;;
    1.63 +        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel;;
    1.64 +        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug;;
    1.65 +        --dmalloc)          cat=DMALLOC;   tool=dmalloc;  tool_prefix=debug;;
    1.66 +        --duma)             cat=DUMA;      tool=duma;     tool_prefix=debug;;
    1.67 +        --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug;;
    1.68 +        --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug;;
    1.69 +        --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools;;
    1.70 +        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=gmp_mpfr;;
    1.71 +        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=gmp_mpfr;;
    1.72          # Tools options:
    1.73          -x|--experimental)  EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
    1.74          -o|--obsolete)      OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
    1.75 -        --install)          tool_suffix=install;;
    1.76 -        --sanitised)        tool_suffix=sanitised;;
    1.77 -        --copy)             tool_suffix=copy;;
    1.78          # Misc:
    1.79          -h|--help)          doHelp; exit 0;;
    1.80          -*)                 echo "Unknown option: '${!i}' (use -h/--help for help)."; exit 1;;
    1.81 @@ -74,51 +68,26 @@
    1.82  
    1.83  [ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
    1.84  
    1.85 -case "${cat}" in
    1.86 -    KERNEL) [ -z "${tool_suffix}" ] && { doHelp; exit 1; } ;;
    1.87 -    *)      ;;
    1.88 -esac
    1.89 -
    1.90  for ver in ${VERSION}; do
    1.91 -    # Split VERSION into MAJOR MINOR PATCHLEVEL EXTRAVERSION 
    1.92 -    ver_M=$(echo "${ver}...." |cut -d . -f 1)
    1.93 -    ver_m=$(echo "${ver}...." |cut -d . -f 2)
    1.94 -    ver_P=$(echo "${ver}...." |cut -d . -f 3)
    1.95 -    ver_E=$(echo "${ver}...." |cut -d . -f 4)
    1.96 -    unset DEP L1 L2 L3 L4 L5 L6 FILE
    1.97 +    unset DEP L1 L2 L3 L4 L5 L6 FILE v ver_M ver_m
    1.98 +    FILE="config/${tool_prefix}/${tool}.in"
    1.99      v=$(echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;')
   1.100 -    if [ "${cat}" = "KERNEL" ]; then
   1.101 -        TOOL_SUFFIX=$(echo "${tool_suffix}" |tr [[:lower:]] [[:upper:]])
   1.102 -        L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
   1.103 -        L2="    bool\n"
   1.104 -        L3="    prompt \"${ver}${prompt_suffix}\"\n"
   1.105 -        # Extra versions are not necessary visible:
   1.106 -        case "${tool_suffix},${ver}" in
   1.107 -            sanitised,*)    ;; # Sanitised headers always have an extra version
   1.108 -            *,*.*.*.*)      DEP="${DEP} && KERNEL_VERSION_SEE_EXTRAVERSION";;
   1.109 -        esac
   1.110 -        L6="    default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
   1.111 -        FILE="config/${tool_prefix}/${tool}_headers_${tool_suffix}.in"
   1.112 -    else
   1.113 -        L1="config ${cat}_V_${v}\n"
   1.114 -        L2="    bool\n"
   1.115 -        L3="    prompt \"${ver}${prompt_suffix}\"\n"
   1.116 -        L6="    default \"${ver}\" if ${cat}_V_${v}"
   1.117 -        case "${tool}" in
   1.118 -            gcc)
   1.119 -                if [ ${ver_M} -gt 4 -o \( ${ver_M} -eq 4 -a ${ver_m} -ge 3 \) ]; then
   1.120 -                    L5="    select CC_GCC_4_3_or_later\n"
   1.121 -                fi
   1.122 -                ;;
   1.123 -        esac
   1.124 -        FILE="config/${tool_prefix}/${tool}.in"
   1.125 -    fi
   1.126 +    L1="config ${cat}_V_${v}\n"
   1.127 +    L2="    bool\n"
   1.128 +    L3="    prompt \"${ver}${prompt_suffix}\"\n"
   1.129      [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
   1.130      [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
   1.131 -    case "${DEP}" in
   1.132 -        "") ;;
   1.133 -        *)  L4="    depends on "$(echo "${DEP}" |sed -r -e 's/^ \&\& //; s/\&/\\&/g;')"\n"
   1.134 -    esac
   1.135 -    sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}${L5}"'\n\1/;
   1.136 -                  s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L6}"'\n\1/;' "${FILE}"
   1.137 +    [ -n "${DEP}" ] && L4="    depends on "$(echo "${DEP}" |sed -r -e 's/^ \&\& //; s/\&/\\&/g;')"\n"
   1.138 +    if [ "${tool}" = "gcc" ]; then
   1.139 +        # Extract 'M'ajor and 'm'inor from version string
   1.140 +        ver_M=$(echo "${ver}...." |cut -d . -f 1)
   1.141 +        ver_m=$(echo "${ver}...." |cut -d . -f 2)
   1.142 +        if [ ${ver_M} -gt 4 -o \( ${ver_M} -eq 4 -a ${ver_m} -ge 3 \) ]; then
   1.143 +            L5="    select CC_GCC_4_3_or_later\n"
   1.144 +        fi
   1.145 +    fi
   1.146 +    L6="    default \"${ver}\" if ${cat}_V_${v}"
   1.147 +    sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}${L5}"'\n\1/;'  \
   1.148 +              -e 's/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L6}"'\n\1/;'               \
   1.149 +              "${FILE}"
   1.150  done