3 # Adds a new version to one of the toolchain component
8 Usage: ${myname} <tool> [option] <version>
10 --gcc, --binutils, --glibc, --uClibc, --linux,
11 --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
14 Valid options for all tools:
16 mark the version as being experimental
19 mark the version as being obsolete
21 Valid mandatory 'option' for tool==linux is one and only one of:
22 --install, --sanitised, --copy
24 'version' is a valid version for the specified tool.
27 add version 2.6.19.2 to linux kernel install method:
28 ${myname} --linux --install 2.6.19.2
30 add versions 2.3.5 and 2.3.6 to glibc:
31 ${myname} --glibc 2.3.5 2.3.6
45 while [ $i -le $# ]; do
48 --gcc) cat=CC; tool=gcc; tool_prefix=cc; tool_suffix=;;
49 --binutils) cat=BINUTILS; tool=binutils; tool_prefix=; tool_suffix=;;
50 --glibc) cat=LIBC; tool=glibc; tool_prefix=libc; tool_suffix=;;
51 --uClibc) cat=LIBC; tool=uClibc; tool_prefix=libc; tool_suffix=;;
52 --linux) cat=KERNEL; tool=linux; tool_prefix=kernel; tool_suffix=;;
53 --gdb) cat=GDB; tool=gdb; tool_prefix=debug tool_suffix=;;
54 --dmalloc) cat=DMALLOC; tool=dmalloc; tool_prefix=debug tool_suffix=;;
55 --duma) cat=DUMA; tool=duma; tool_prefix=debug tool_suffix=;;
56 --strace) cat=STRACE; tool=strace; tool_prefix=debug tool_suffix=;;
57 --ltrace) cat=LTRACE; tool=ltrace; tool_prefix=debug tool_suffix=;;
58 --libelf) cat=LIBELF; tool=libelf; tool_prefix=tools tool_suffix=;;
59 --gmp) cat=GMP; tool=gmp; tool_prefix=cc; tool_suffix=;;
60 --mpfr) cat=MPFR; tool=mpfr; tool_prefix=cc; tool_suffix=;;
62 -x|--experimental) EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
63 -o|--obsolete) OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
64 --install) tool_suffix=install;;
65 --sanitised) tool_suffix=sanitised;;
66 --copy) tool_suffix=copy;;
68 -h|--help) doHelp; exit 0;;
69 -*) echo "Unknown option: \"${!i}\" (use -h/--help for help)."; exit 1;;
70 *) VERSION="${VERSION} ${!i}";;
75 [ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
78 KERNEL) [ -z "${tool_suffix}" ] && { doHelp; exit 1; } ;;
82 for ver in ${VERSION}; do
83 unset DEP L1 L2 L3 L4 L5 FILE
84 v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
85 if [ "${cat}" = "KERNEL" ]; then
86 TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`"
87 L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
89 L3=" prompt \"${ver}${prompt_suffix}\"\n"
90 # Extra versions are not necessary visible:
91 case "${tool_suffix},${ver}" in
92 sanitised,*) ;; # Sanitised headers always have an extra version
93 *,*.*.*.*) DEP="${DEP} && KERNEL_VERSION_SEE_EXTRAVERSION";;
95 L5=" default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
96 FILE="config/${tool_prefix}/${tool}_headers_${tool_suffix}.in"
98 L1="config ${cat}_V_${v}\n"
100 L3=" prompt \"${ver}${prompt_suffix}\"\n"
101 L5=" default \"${ver}\" if ${cat}_V_${v}"
102 FILE="config/${tool_prefix}/${tool}.in"
104 [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
105 [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
108 *) L4=" depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n"
110 sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/;
111 s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}"