Merge patches sent by Robert P. J. Day <rpjday@mindspring.com>.
Warning: the buildroot folks purposedly removed the skip-comment patch but didn't really said why. Keeping it for the sake of having it in svn just in case (removing it will be easier thant not having it at all).
3 # Adds a new version to one of the toolchain component
8 Usage: ${myname} <tool> [option] <version>
10 --gcc, --tcc, --binutils, --glibc, --uClibc, --linux, --cygwin
14 mark the version as being experimental
16 Valid mandatory 'option' for tool==gcc is one of:
19 Valid mandatory 'option' for tool==linux is one of:
20 --install, --sanitised, --copy
22 'version' is a valid version for the specified tool.
25 add version 2.6.19.2 to linux kernel install method:
26 ${myname} --linux --install 2.6.19.2
28 add versions 2.3.5 and 2.3.6 to glibc:
29 ${myname} --glibc 2.3.5 2.3.6
41 while [ $i -le $# ]; do
43 --gcc) cat=CC; tool=gcc; tool_prefix=cc_; tool_suffix=;;
44 # --tcc) cat=CC; tool=tcc; tool_prefix=cc_; tool_suffix=;;
45 --binutils) cat=BINUTILS; tool=binutils; tool_prefix=; tool_suffix=;;
46 --glibc) cat=LIBC; tool=glibc; tool_prefix=libc_; tool_suffix=;;
47 --uClibc) cat=LIBC; tool=uClibc; tool_prefix=libc_; tool_suffix=;;
48 --linux) cat=KERNEL; tool=linux; tool_prefix=kernel_;;
49 # --cygwin) cat=KERNEL; tool=cygwin; tool_prefix=kernel_;;
52 --install) tool_suffix=install;;
53 --sanitised) tool_suffix=sanitised;;
54 --copy) tool_suffix=copy;;
55 -x|--experimental) EXP=1;;
56 -h|--help) doHelp; exit 0;;
57 -*) echo "Unknown option: \"${!i}\". (use -h/--help for help"; exit 1;;
58 *) VERSION="${VERSION} ${!i}";;
63 [ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
66 CC) [ -z "${CORE}" -a -z "${FINAL}" ] && { doHelp; exit 1; };;
67 KERNEL) unset FINAL CORE
68 [ -z "${tool_suffix}" ] && { doHelp; exit 1; }
73 for ver in ${VERSION}; do
74 unset DEP L1 L2 L3 L4 L5 FILE
75 v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
76 if [ -n "${CORE}" ]; then
77 L1="config ${cat}_CORE_V_${v}\n"
79 L3=" prompt \"${ver}\"\n"
80 L5=" default \"${ver}\" if ${cat}_CORE_V_${v}"
81 FILE="config/${tool_prefix}core_${tool}.in"
83 if [ -n "${FINAL}" ]; then
84 L1="config ${cat}_V_${v}\n"
86 L3=" prompt \"${ver}\"\n"
87 L5=" default \"${ver}\" if ${cat}_V_${v}"
88 FILE="config/${tool_prefix}${tool}.in"
90 if [ "${cat}" = "KERNEL" ]; then
91 TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`"
92 L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
94 L3=" prompt \"${ver}\"\n"
95 # Extra versions are not necessary visible:
96 case "${tool_suffix},${ver}" in
97 sanitised,*) ;; # Sanitised headers always have an extra version
98 *,*.*.*.*) DEP="${DEP} && KERNEL_VERSION_SEE_EXTRAVERSION";;
100 L5=" default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
101 FILE="config/${tool_prefix}${tool}_headers_${tool_suffix}.in"
103 [ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
106 *) L4=" depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n"
108 sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/;
109 s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}"