tools/addToolVersion.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu May 17 16:22:51 2007 +0000 (2007-05-17)
changeset 96 aa1a9fbd6eb8
parent 43 f3b4bb1e501b
child 103 b6e20abe9256
permissions -rwxr-xr-x
Debug facilities:
- add a framework to easily add new ones
- add gdb as a first debug facility
- add patches for gdb
After the kernel checked its installed headers, clean up the mess of .checked.* files.
Reorder scripts/crosstool.sh:
- dump the configuration early
- renice early
- get info about build system early, when setting up the environment
- when in cross or native, the host tools are those of the build system, and only in this case
- elapsed time calculations moved to scripts/functions
Remove handling of the color: it's gone once and for all.
Update tools/addToolVersion.sh:
- handle debug facilities
- commonalise some code
- remove dead tools (cygwin, tcc)
Point to my address for bug reports.
     1 #!/bin/sh
     2 
     3 # Adds a new version to one of the toolchain component
     4 myname="$0"
     5 
     6 doHelp() {
     7     cat <<-EOF
     8 Usage: ${myname} <tool> [option] <version>
     9   'tool' in one of:
    10     --gcc, --binutils, --glibc, --uClibc, --linux, --gdb
    11 
    12   Valid options for all tools:
    13     --experimental, -x
    14       mark the version as being experimental
    15 
    16     --obsolete, -o
    17       mark the version as being obsolete
    18 
    19   Valid mandatory 'option' for tool==gcc is one and only one of:
    20     --core, --final
    21 
    22   Valid mandatory 'option' for tool==linux is one and only one of:
    23     --install, --sanitised, --copy
    24 
    25   'version' is a valid version for the specified tool.
    26 
    27   Examples:
    28     add version 2.6.19.2 to linux kernel install method:
    29       ${myname} --linux --install 2.6.19.2
    30 
    31     add versions 2.3.5 and 2.3.6 to glibc:
    32       ${myname} --glibc 2.3.5 2.3.6
    33 EOF
    34 }
    35 
    36 cat=
    37 tool=
    38 tool_prefix=
    39 tool_suffix=
    40 CORE=
    41 FINAL=
    42 VERSION=
    43 EXP=
    44 OBS=
    45 
    46 i=1
    47 while [ $i -le $# ]; do
    48     case "${!i}" in
    49         # Tools:
    50         --gcc)              cat=CC;        tool=gcc;      tool_prefix=cc_;      tool_suffix=;;
    51         --binutils)         cat=BINUTILS;  tool=binutils; tool_prefix=;         tool_suffix=;;
    52         --glibc)            cat=LIBC;      tool=glibc;    tool_prefix=libc_;    tool_suffix=;;
    53         --uClibc)           cat=LIBC;      tool=uClibc;   tool_prefix=libc_;    tool_suffix=;;
    54         --linux)            cat=KERNEL;    tool=linux;    tool_prefix=kernel_;  tool_suffix=;;
    55         --gdb)              cat=GDB;       tool=gdb;      tool_prefix=debug/    tool_suffix=;;
    56         # Tools options:
    57         -x|--experimental)  EXP=1; OBS=;;
    58         -o|--obsolete)      OBS=1; EXP=;;
    59         --core)             CORE=1; FINAL=;;
    60         --final)            FINAL=1; CORE=;;
    61         --install)          tool_suffix=install;;
    62         --sanitised)        tool_suffix=sanitised;;
    63         --copy)             tool_suffix=copy;;
    64         # Misc:
    65         -h|--help)          doHelp; exit 0;;
    66         -*)                 echo "Unknown option: \"${!i}\". (use -h/--help for help"; exit 1;;
    67         *)                  VERSION="${VERSION} ${!i}";;
    68     esac
    69     i=$((i+1))
    70 done
    71 
    72 [ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
    73 
    74 case "${cat}" in
    75     CC)     [    -z "${CORE}" -a -z "${FINAL}" ] && { doHelp; exit 1; };;
    76     KERNEL) unset FINAL CORE
    77             [ -z "${tool_suffix}" ] && { doHelp; exit 1; }
    78             ;;
    79     *)      CORE=; FINAL=;;
    80 esac
    81 
    82 MIDDLE_V=; MIDDLE_F=
    83 [ -n "${CORE}" ] && MIDDLE_V="_CORE" && MIDDLE_F="core_"
    84 for ver in ${VERSION}; do
    85     unset DEP L1 L2 L3 L4 L5 FILE
    86     v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
    87     if [ "${cat}" = "KERNEL" ]; then
    88         TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`"
    89         L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
    90         L2="    bool\n"
    91         L3="    prompt \"${ver}\"\n"
    92         # Extra versions are not necessary visible:
    93         case "${tool_suffix},${ver}" in
    94             sanitised,*)    ;; # Sanitised headers always have an extra version
    95             *,*.*.*.*)      DEP="${DEP} && KERNEL_VERSION_SEE_EXTRAVERSION";;
    96         esac
    97         L5="    default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
    98         FILE="config/${tool_prefix}${tool}_headers_${tool_suffix}.in"
    99     else
   100         L1="config ${cat}${MIDDLE}_V_${v}\n"
   101         L2="    bool\n"
   102         L3="    prompt \"${ver}\"\n"
   103         L5="    default \"${ver}\" if ${cat}${MIDDLE}_V_${v}"
   104         FILE="config/${tool_prefix}${MIDDLE_F}${tool}.in"
   105     fi
   106     [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
   107     [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
   108     case "${DEP}" in
   109         "") ;;
   110         *)  L4="    depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n"
   111     esac
   112     sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/;
   113                   s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}"
   114 done