tools/addToolVersion.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Apr 30 10:43:41 2008 +0000 (2008-04-30)
changeset 466 7f9bbf94b0bb
parent 448 08da017ba46b
child 473 731718e6ffdc
permissions -rwxr-xr-x
Merge the fortran stuff to trunk now it works!
Fortran is not supported for all targets, though. ARM at least does not work.

/trunk/scripts/build/binutils.sh | 8 8 0 0 ++++++++
/trunk/scripts/build/cc_gcc.sh | 11 6 5 0 ++++++-----
/trunk/scripts/crosstool.sh | 10 9 1 0 +++++++++-
/trunk/tools/addToolVersion.sh | 3 3 0 0 +++
/trunk/steps.mk | 2 2 0 0 ++
/trunk/config/cc/gcc.in | 16 16 0 0 ++++++++++++++++
6 files changed, 44 insertions(+), 6 deletions(-)
yann@375
     1
#!/bin/bash
yann@1
     2
yann@1
     3
# Adds a new version to one of the toolchain component
yann@1
     4
myname="$0"
yann@1
     5
yann@1
     6
doHelp() {
yann@1
     7
    cat <<-EOF
yann@1
     8
Usage: ${myname} <tool> [option] <version>
yann@1
     9
  'tool' in one of:
yann@103
    10
    --gcc, --binutils, --glibc, --uClibc, --linux,
yann@245
    11
    --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
yann@466
    12
    --gmp, --mpfr
yann@1
    13
yann@96
    14
  Valid options for all tools:
yann@43
    15
    --experimental, -x
yann@43
    16
      mark the version as being experimental
yann@43
    17
yann@96
    18
    --obsolete, -o
yann@96
    19
      mark the version as being obsolete
yann@96
    20
yann@96
    21
  Valid mandatory 'option' for tool==linux is one and only one of:
yann@1
    22
    --install, --sanitised, --copy
yann@1
    23
yann@1
    24
  'version' is a valid version for the specified tool.
yann@1
    25
yann@1
    26
  Examples:
yann@1
    27
    add version 2.6.19.2 to linux kernel install method:
yann@1
    28
      ${myname} --linux --install 2.6.19.2
yann@1
    29
yann@1
    30
    add versions 2.3.5 and 2.3.6 to glibc:
yann@1
    31
      ${myname} --glibc 2.3.5 2.3.6
yann@1
    32
EOF
yann@1
    33
}
yann@1
    34
yann@96
    35
cat=
yann@1
    36
tool=
yann@1
    37
tool_prefix=
yann@96
    38
tool_suffix=
yann@1
    39
VERSION=
yann@43
    40
EXP=
yann@96
    41
OBS=
yann@322
    42
prompt_suffix=
yann@1
    43
yann@1
    44
i=1
yann@1
    45
while [ $i -le $# ]; do
yann@1
    46
    case "${!i}" in
yann@96
    47
        # Tools:
yann@448
    48
        --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc;      tool_suffix=;;
yann@448
    49
        --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;        tool_suffix=;;
yann@448
    50
        --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc;    tool_suffix=;;
yann@448
    51
        --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc;    tool_suffix=;;
yann@448
    52
        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel;  tool_suffix=;;
yann@448
    53
        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug    tool_suffix=;;
yann@448
    54
        --dmalloc)          cat=DMALLOC;   tool=dmalloc;  tool_prefix=debug    tool_suffix=;;
yann@448
    55
        --duma)             cat=DUMA;      tool=duma;     tool_prefix=debug    tool_suffix=;;
yann@448
    56
        --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug    tool_suffix=;;
yann@448
    57
        --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug    tool_suffix=;;
yann@448
    58
        --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools    tool_suffix=;;
yann@466
    59
        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=cc;      tool_suffix=;;
yann@466
    60
        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=cc;      tool_suffix=;;
yann@96
    61
        # Tools options:
yann@322
    62
        -x|--experimental)  EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
yann@322
    63
        -o|--obsolete)      OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
yann@43
    64
        --install)          tool_suffix=install;;
yann@43
    65
        --sanitised)        tool_suffix=sanitised;;
yann@43
    66
        --copy)             tool_suffix=copy;;
yann@96
    67
        # Misc:
yann@43
    68
        -h|--help)          doHelp; exit 0;;
yann@96
    69
        -*)                 echo "Unknown option: \"${!i}\". (use -h/--help for help"; exit 1;;
yann@96
    70
        *)                  VERSION="${VERSION} ${!i}";;
yann@1
    71
    esac
yann@1
    72
    i=$((i+1))
yann@1
    73
done
yann@1
    74
yann@1
    75
[ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
yann@1
    76
yann@1
    77
case "${cat}" in
yann@422
    78
    KERNEL) [ -z "${tool_suffix}" ] && { doHelp; exit 1; } ;;
yann@422
    79
    *)      ;;
yann@1
    80
esac
yann@1
    81
yann@1
    82
for ver in ${VERSION}; do
yann@43
    83
    unset DEP L1 L2 L3 L4 L5 FILE
yann@96
    84
    v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
yann@1
    85
    if [ "${cat}" = "KERNEL" ]; then
yann@1
    86
        TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`"
yann@1
    87
        L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
yann@1
    88
        L2="    bool\n"
yann@322
    89
        L3="    prompt \"${ver}${prompt_suffix}\"\n"
yann@1
    90
        # Extra versions are not necessary visible:
yann@43
    91
        case "${tool_suffix},${ver}" in
yann@43
    92
            sanitised,*)    ;; # Sanitised headers always have an extra version
yann@43
    93
            *,*.*.*.*)      DEP="${DEP} && KERNEL_VERSION_SEE_EXTRAVERSION";;
yann@1
    94
        esac
yann@1
    95
        L5="    default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
yann@448
    96
        FILE="config/${tool_prefix}/${tool}_headers_${tool_suffix}.in"
yann@96
    97
    else
yann@422
    98
        L1="config ${cat}_V_${v}\n"
yann@96
    99
        L2="    bool\n"
yann@322
   100
        L3="    prompt \"${ver}${prompt_suffix}\"\n"
yann@422
   101
        L5="    default \"${ver}\" if ${cat}_V_${v}"
yann@448
   102
        FILE="config/${tool_prefix}/${tool}.in"
yann@1
   103
    fi
yann@43
   104
    [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
yann@96
   105
    [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
yann@43
   106
    case "${DEP}" in
yann@43
   107
        "") ;;
yann@43
   108
        *)  L4="    depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n"
yann@43
   109
    esac
yann@43
   110
    sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/;
yann@43
   111
                  s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}"
yann@1
   112
done