tools/addToolVersion.sh
changeset 96 aa1a9fbd6eb8
parent 43 f3b4bb1e501b
child 103 b6e20abe9256
     1.1 --- a/tools/addToolVersion.sh	Wed Apr 18 17:32:55 2007 +0000
     1.2 +++ b/tools/addToolVersion.sh	Thu May 17 16:22:51 2007 +0000
     1.3 @@ -7,16 +7,19 @@
     1.4      cat <<-EOF
     1.5  Usage: ${myname} <tool> [option] <version>
     1.6    'tool' in one of:
     1.7 -    --gcc, --tcc, --binutils, --glibc, --uClibc, --linux, --cygwin
     1.8 +    --gcc, --binutils, --glibc, --uClibc, --linux, --gdb
     1.9  
    1.10 -  Options:
    1.11 +  Valid options for all tools:
    1.12      --experimental, -x
    1.13        mark the version as being experimental
    1.14  
    1.15 -  Valid mandatory 'option' for tool==gcc is one of:
    1.16 +    --obsolete, -o
    1.17 +      mark the version as being obsolete
    1.18 +
    1.19 +  Valid mandatory 'option' for tool==gcc is one and only one of:
    1.20      --core, --final
    1.21  
    1.22 -  Valid mandatory 'option' for tool==linux is one of:
    1.23 +  Valid mandatory 'option' for tool==linux is one and only one of:
    1.24      --install, --sanitised, --copy
    1.25  
    1.26    'version' is a valid version for the specified tool.
    1.27 @@ -30,32 +33,38 @@
    1.28  EOF
    1.29  }
    1.30  
    1.31 +cat=
    1.32  tool=
    1.33  tool_prefix=
    1.34 +tool_suffix=
    1.35  CORE=
    1.36  FINAL=
    1.37  VERSION=
    1.38  EXP=
    1.39 +OBS=
    1.40  
    1.41  i=1
    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 -#        --tcc)              cat=CC;        tool=tcc;      tool_prefix=cc_;      tool_suffix=;;
    1.47          --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;         tool_suffix=;;
    1.48          --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc_;    tool_suffix=;;
    1.49          --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc_;    tool_suffix=;;
    1.50 -        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel_;;
    1.51 -#        --cygwin)           cat=KERNEL;    tool=cygwin;   tool_prefix=kernel_;;
    1.52 -        --core)             CORE=1;;
    1.53 -        --final)            FINAL=1;;
    1.54 +        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel_;  tool_suffix=;;
    1.55 +        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug/    tool_suffix=;;
    1.56 +        # Tools options:
    1.57 +        -x|--experimental)  EXP=1; OBS=;;
    1.58 +        -o|--obsolete)      OBS=1; EXP=;;
    1.59 +        --core)             CORE=1; FINAL=;;
    1.60 +        --final)            FINAL=1; CORE=;;
    1.61          --install)          tool_suffix=install;;
    1.62          --sanitised)        tool_suffix=sanitised;;
    1.63          --copy)             tool_suffix=copy;;
    1.64 -        -x|--experimental)  EXP=1;;
    1.65 +        # Misc:
    1.66          -h|--help)          doHelp; exit 0;;
    1.67 -        -*)             echo "Unknown option: \"${!i}\". (use -h/--help for help"; exit 1;;
    1.68 -        *)              VERSION="${VERSION} ${!i}";;
    1.69 +        -*)                 echo "Unknown option: \"${!i}\". (use -h/--help for help"; exit 1;;
    1.70 +        *)                  VERSION="${VERSION} ${!i}";;
    1.71      esac
    1.72      i=$((i+1))
    1.73  done
    1.74 @@ -63,30 +72,18 @@
    1.75  [ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
    1.76  
    1.77  case "${cat}" in
    1.78 -    CC)     [ -z "${CORE}" -a -z "${FINAL}" ] && { doHelp; exit 1; };;
    1.79 +    CC)     [    -z "${CORE}" -a -z "${FINAL}" ] && { doHelp; exit 1; };;
    1.80      KERNEL) unset FINAL CORE
    1.81              [ -z "${tool_suffix}" ] && { doHelp; exit 1; }
    1.82              ;;
    1.83 -    *)      FINAL=1; CORE=;;
    1.84 +    *)      CORE=; FINAL=;;
    1.85  esac
    1.86  
    1.87 +MIDDLE_V=; MIDDLE_F=
    1.88 +[ -n "${CORE}" ] && MIDDLE_V="_CORE" && MIDDLE_F="core_"
    1.89  for ver in ${VERSION}; do
    1.90      unset DEP L1 L2 L3 L4 L5 FILE
    1.91 -	v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
    1.92 -    if [ -n "${CORE}" ]; then
    1.93 -        L1="config ${cat}_CORE_V_${v}\n"
    1.94 -        L2="    bool\n"
    1.95 -        L3="    prompt \"${ver}\"\n"
    1.96 -        L5="    default \"${ver}\" if ${cat}_CORE_V_${v}"
    1.97 -        FILE="config/${tool_prefix}core_${tool}.in"
    1.98 -    fi
    1.99 -    if [ -n "${FINAL}" ]; then
   1.100 -        L1="config ${cat}_V_${v}\n"
   1.101 -        L2="    bool\n"
   1.102 -        L3="    prompt \"${ver}\"\n"
   1.103 -        L5="    default \"${ver}\" if ${cat}_V_${v}"
   1.104 -        FILE="config/${tool_prefix}${tool}.in"
   1.105 -    fi
   1.106 +    v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
   1.107      if [ "${cat}" = "KERNEL" ]; then
   1.108          TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`"
   1.109          L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
   1.110 @@ -99,8 +96,15 @@
   1.111          esac
   1.112          L5="    default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
   1.113          FILE="config/${tool_prefix}${tool}_headers_${tool_suffix}.in"
   1.114 +    else
   1.115 +        L1="config ${cat}${MIDDLE}_V_${v}\n"
   1.116 +        L2="    bool\n"
   1.117 +        L3="    prompt \"${ver}\"\n"
   1.118 +        L5="    default \"${ver}\" if ${cat}${MIDDLE}_V_${v}"
   1.119 +        FILE="config/${tool_prefix}${MIDDLE_F}${tool}.in"
   1.120      fi
   1.121      [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
   1.122 +    [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
   1.123      case "${DEP}" in
   1.124          "") ;;
   1.125          *)  L4="    depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n"