tools/addToolVersion.sh
changeset 1095 a18b17c1ddc5
parent 1094 c6a08b4c488c
child 1096 4632c305eb73
     1.1 --- a/tools/addToolVersion.sh	Tue Dec 09 22:02:20 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,93 +0,0 @@
     1.4 -#!/bin/bash
     1.5 -
     1.6 -# Adds a new version to one of the toolchain component
     1.7 -myname="$0"
     1.8 -
     1.9 -doHelp() {
    1.10 -    cat <<-EOF
    1.11 -Usage: ${myname} <tool> [option] <version>
    1.12 -  'tool' in one of:
    1.13 -    --gcc, --binutils, --glibc, --eglibc, --uClibc, --linux,
    1.14 -    --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
    1.15 -    --gmp, --mpfr
    1.16 -
    1.17 -  Valid options for all tools:
    1.18 -    --experimental, -x
    1.19 -      mark the version as being experimental
    1.20 -
    1.21 -    --obsolete, -o
    1.22 -      mark the version as being obsolete
    1.23 -
    1.24 -  'version' is a valid version for the specified tool.
    1.25 -
    1.26 -  Examples:
    1.27 -    add version 2.6.19.2 to linux kernel:
    1.28 -      ${myname} --linux 2.6.19.2
    1.29 -
    1.30 -    add experimental versions 2.3.5 and 2.3.6 to glibc:
    1.31 -      ${myname} --glibc -x 2.3.5 2.3.6
    1.32 -EOF
    1.33 -}
    1.34 -
    1.35 -cat=
    1.36 -tool=
    1.37 -tool_prefix=
    1.38 -VERSION=
    1.39 -EXP=
    1.40 -OBS=
    1.41 -prompt_suffix=
    1.42 -
    1.43 -i=1
    1.44 -while [ $i -le $# ]; do
    1.45 -    case "${!i}" in
    1.46 -        # Tools:
    1.47 -        --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc;;
    1.48 -        --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;;
    1.49 -        --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc;;
    1.50 -        --eglibc)           cat=LIBC;      tool=eglibc;   tool_prefix=libc;;
    1.51 -        --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc;;
    1.52 -        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel;;
    1.53 -        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug;;
    1.54 -        --dmalloc)          cat=DMALLOC;   tool=dmalloc;  tool_prefix=debug;;
    1.55 -        --duma)             cat=DUMA;      tool=duma;     tool_prefix=debug;;
    1.56 -        --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug;;
    1.57 -        --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug;;
    1.58 -        --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools;;
    1.59 -        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=gmp_mpfr;;
    1.60 -        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=gmp_mpfr;;
    1.61 -        # Tools options:
    1.62 -        -x|--experimental)  EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
    1.63 -        -o|--obsolete)      OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
    1.64 -        # Misc:
    1.65 -        -h|--help)          doHelp; exit 0;;
    1.66 -        -*)                 echo "Unknown option: '${!i}' (use -h/--help for help)."; exit 1;;
    1.67 -        *)                  VERSION="${VERSION} ${!i}";;
    1.68 -    esac
    1.69 -    i=$((i+1))
    1.70 -done
    1.71 -
    1.72 -[ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
    1.73 -
    1.74 -for ver in ${VERSION}; do
    1.75 -    unset DEP L1 L2 L3 L4 L5 L6 FILE v ver_M ver_m
    1.76 -    FILE="config/${tool_prefix}/${tool}.in"
    1.77 -    v=$(echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;')
    1.78 -    L1="config ${cat}_V_${v}\n"
    1.79 -    L2="    bool\n"
    1.80 -    L3="    prompt \"${ver}${prompt_suffix}\"\n"
    1.81 -    [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
    1.82 -    [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
    1.83 -    [ -n "${DEP}" ] && L4="    depends on "$(echo "${DEP}" |sed -r -e 's/^ \&\& //; s/\&/\\&/g;')"\n"
    1.84 -    if [ "${tool}" = "gcc" ]; then
    1.85 -        # Extract 'M'ajor and 'm'inor from version string
    1.86 -        ver_M=$(echo "${ver}...." |cut -d . -f 1)
    1.87 -        ver_m=$(echo "${ver}...." |cut -d . -f 2)
    1.88 -        if [ ${ver_M} -gt 4 -o \( ${ver_M} -eq 4 -a ${ver_m} -ge 3 \) ]; then
    1.89 -            L5="    select CC_GCC_4_3_or_later\n"
    1.90 -        fi
    1.91 -    fi
    1.92 -    L6="    default \"${ver}\" if ${cat}_V_${v}"
    1.93 -    sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}${L5}"'\n\1/;'  \
    1.94 -              -e 's/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L6}"'\n\1/;'               \
    1.95 -              "${FILE}"
    1.96 -done