Move addToolsVersion.sh from tools/ to scripts/
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Dec 11 18:12:04 2008 +0000 (2008-12-11)
changeset 1095a18b17c1ddc5
parent 1094 c6a08b4c488c
child 1096 4632c305eb73
Move addToolsVersion.sh from tools/ to scripts/

/trunk/docs/overview.txt | 2 1 1 0 +-
1 file changed, 1 insertion(+), 1 deletion(-)
docs/overview.txt
scripts/addToolVersion.sh
tools/addToolVersion.sh
     1.1 --- a/docs/overview.txt	Tue Dec 09 22:02:20 2008 +0000
     1.2 +++ b/docs/overview.txt	Thu Dec 11 18:12:04 2008 +0000
     1.3 @@ -795,7 +795,7 @@
     1.4  When a new component, such as the Linux kernel, gcc or any other is released,
     1.5  adding the new version to crosstool-NG is quite easy. There is a script that
     1.6  will do all that for you:
     1.7 -  tools/addToolVersion.sh
     1.8 +  scripts/addToolVersion.sh
     1.9  
    1.10  Run it with no option to get some help.
    1.11  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/scripts/addToolVersion.sh	Thu Dec 11 18:12:04 2008 +0000
     2.3 @@ -0,0 +1,93 @@
     2.4 +#!/bin/bash
     2.5 +
     2.6 +# Adds a new version to one of the toolchain component
     2.7 +myname="$0"
     2.8 +
     2.9 +doHelp() {
    2.10 +    cat <<-EOF
    2.11 +Usage: ${myname} <tool> [option] <version>
    2.12 +  'tool' in one of:
    2.13 +    --gcc, --binutils, --glibc, --eglibc, --uClibc, --linux,
    2.14 +    --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
    2.15 +    --gmp, --mpfr
    2.16 +
    2.17 +  Valid options for all tools:
    2.18 +    --experimental, -x
    2.19 +      mark the version as being experimental
    2.20 +
    2.21 +    --obsolete, -o
    2.22 +      mark the version as being obsolete
    2.23 +
    2.24 +  'version' is a valid version for the specified tool.
    2.25 +
    2.26 +  Examples:
    2.27 +    add version 2.6.19.2 to linux kernel:
    2.28 +      ${myname} --linux 2.6.19.2
    2.29 +
    2.30 +    add experimental versions 2.3.5 and 2.3.6 to glibc:
    2.31 +      ${myname} --glibc -x 2.3.5 2.3.6
    2.32 +EOF
    2.33 +}
    2.34 +
    2.35 +cat=
    2.36 +tool=
    2.37 +tool_prefix=
    2.38 +VERSION=
    2.39 +EXP=
    2.40 +OBS=
    2.41 +prompt_suffix=
    2.42 +
    2.43 +i=1
    2.44 +while [ $i -le $# ]; do
    2.45 +    case "${!i}" in
    2.46 +        # Tools:
    2.47 +        --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc;;
    2.48 +        --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;;
    2.49 +        --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc;;
    2.50 +        --eglibc)           cat=LIBC;      tool=eglibc;   tool_prefix=libc;;
    2.51 +        --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc;;
    2.52 +        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel;;
    2.53 +        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug;;
    2.54 +        --dmalloc)          cat=DMALLOC;   tool=dmalloc;  tool_prefix=debug;;
    2.55 +        --duma)             cat=DUMA;      tool=duma;     tool_prefix=debug;;
    2.56 +        --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug;;
    2.57 +        --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug;;
    2.58 +        --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools;;
    2.59 +        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=gmp_mpfr;;
    2.60 +        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=gmp_mpfr;;
    2.61 +        # Tools options:
    2.62 +        -x|--experimental)  EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
    2.63 +        -o|--obsolete)      OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
    2.64 +        # Misc:
    2.65 +        -h|--help)          doHelp; exit 0;;
    2.66 +        -*)                 echo "Unknown option: '${!i}' (use -h/--help for help)."; exit 1;;
    2.67 +        *)                  VERSION="${VERSION} ${!i}";;
    2.68 +    esac
    2.69 +    i=$((i+1))
    2.70 +done
    2.71 +
    2.72 +[ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
    2.73 +
    2.74 +for ver in ${VERSION}; do
    2.75 +    unset DEP L1 L2 L3 L4 L5 L6 FILE v ver_M ver_m
    2.76 +    FILE="config/${tool_prefix}/${tool}.in"
    2.77 +    v=$(echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;')
    2.78 +    L1="config ${cat}_V_${v}\n"
    2.79 +    L2="    bool\n"
    2.80 +    L3="    prompt \"${ver}${prompt_suffix}\"\n"
    2.81 +    [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
    2.82 +    [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
    2.83 +    [ -n "${DEP}" ] && L4="    depends on "$(echo "${DEP}" |sed -r -e 's/^ \&\& //; s/\&/\\&/g;')"\n"
    2.84 +    if [ "${tool}" = "gcc" ]; then
    2.85 +        # Extract 'M'ajor and 'm'inor from version string
    2.86 +        ver_M=$(echo "${ver}...." |cut -d . -f 1)
    2.87 +        ver_m=$(echo "${ver}...." |cut -d . -f 2)
    2.88 +        if [ ${ver_M} -gt 4 -o \( ${ver_M} -eq 4 -a ${ver_m} -ge 3 \) ]; then
    2.89 +            L5="    select CC_GCC_4_3_or_later\n"
    2.90 +        fi
    2.91 +    fi
    2.92 +    L6="    default \"${ver}\" if ${cat}_V_${v}"
    2.93 +    sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}${L5}"'\n\1/;'  \
    2.94 +              -e 's/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L6}"'\n\1/;'               \
    2.95 +              "${FILE}"
    2.96 +done
     3.1 --- a/tools/addToolVersion.sh	Tue Dec 09 22:02:20 2008 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,93 +0,0 @@
     3.4 -#!/bin/bash
     3.5 -
     3.6 -# Adds a new version to one of the toolchain component
     3.7 -myname="$0"
     3.8 -
     3.9 -doHelp() {
    3.10 -    cat <<-EOF
    3.11 -Usage: ${myname} <tool> [option] <version>
    3.12 -  'tool' in one of:
    3.13 -    --gcc, --binutils, --glibc, --eglibc, --uClibc, --linux,
    3.14 -    --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
    3.15 -    --gmp, --mpfr
    3.16 -
    3.17 -  Valid options for all tools:
    3.18 -    --experimental, -x
    3.19 -      mark the version as being experimental
    3.20 -
    3.21 -    --obsolete, -o
    3.22 -      mark the version as being obsolete
    3.23 -
    3.24 -  'version' is a valid version for the specified tool.
    3.25 -
    3.26 -  Examples:
    3.27 -    add version 2.6.19.2 to linux kernel:
    3.28 -      ${myname} --linux 2.6.19.2
    3.29 -
    3.30 -    add experimental versions 2.3.5 and 2.3.6 to glibc:
    3.31 -      ${myname} --glibc -x 2.3.5 2.3.6
    3.32 -EOF
    3.33 -}
    3.34 -
    3.35 -cat=
    3.36 -tool=
    3.37 -tool_prefix=
    3.38 -VERSION=
    3.39 -EXP=
    3.40 -OBS=
    3.41 -prompt_suffix=
    3.42 -
    3.43 -i=1
    3.44 -while [ $i -le $# ]; do
    3.45 -    case "${!i}" in
    3.46 -        # Tools:
    3.47 -        --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc;;
    3.48 -        --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;;
    3.49 -        --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc;;
    3.50 -        --eglibc)           cat=LIBC;      tool=eglibc;   tool_prefix=libc;;
    3.51 -        --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc;;
    3.52 -        --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel;;
    3.53 -        --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug;;
    3.54 -        --dmalloc)          cat=DMALLOC;   tool=dmalloc;  tool_prefix=debug;;
    3.55 -        --duma)             cat=DUMA;      tool=duma;     tool_prefix=debug;;
    3.56 -        --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug;;
    3.57 -        --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug;;
    3.58 -        --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools;;
    3.59 -        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=gmp_mpfr;;
    3.60 -        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=gmp_mpfr;;
    3.61 -        # Tools options:
    3.62 -        -x|--experimental)  EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
    3.63 -        -o|--obsolete)      OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
    3.64 -        # Misc:
    3.65 -        -h|--help)          doHelp; exit 0;;
    3.66 -        -*)                 echo "Unknown option: '${!i}' (use -h/--help for help)."; exit 1;;
    3.67 -        *)                  VERSION="${VERSION} ${!i}";;
    3.68 -    esac
    3.69 -    i=$((i+1))
    3.70 -done
    3.71 -
    3.72 -[ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
    3.73 -
    3.74 -for ver in ${VERSION}; do
    3.75 -    unset DEP L1 L2 L3 L4 L5 L6 FILE v ver_M ver_m
    3.76 -    FILE="config/${tool_prefix}/${tool}.in"
    3.77 -    v=$(echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;')
    3.78 -    L1="config ${cat}_V_${v}\n"
    3.79 -    L2="    bool\n"
    3.80 -    L3="    prompt \"${ver}${prompt_suffix}\"\n"
    3.81 -    [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
    3.82 -    [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
    3.83 -    [ -n "${DEP}" ] && L4="    depends on "$(echo "${DEP}" |sed -r -e 's/^ \&\& //; s/\&/\\&/g;')"\n"
    3.84 -    if [ "${tool}" = "gcc" ]; then
    3.85 -        # Extract 'M'ajor and 'm'inor from version string
    3.86 -        ver_M=$(echo "${ver}...." |cut -d . -f 1)
    3.87 -        ver_m=$(echo "${ver}...." |cut -d . -f 2)
    3.88 -        if [ ${ver_M} -gt 4 -o \( ${ver_M} -eq 4 -a ${ver_m} -ge 3 \) ]; then
    3.89 -            L5="    select CC_GCC_4_3_or_later\n"
    3.90 -        fi
    3.91 -    fi
    3.92 -    L6="    default \"${ver}\" if ${cat}_V_${v}"
    3.93 -    sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}${L5}"'\n\1/;'  \
    3.94 -              -e 's/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L6}"'\n\1/;'               \
    3.95 -              "${FILE}"
    3.96 -done