2007-02-24 11:00:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Adds a new version to one of the toolchain component
|
|
|
|
myname="$0"
|
|
|
|
|
|
|
|
doHelp() {
|
|
|
|
cat <<-EOF
|
|
|
|
Usage: ${myname} <tool> [option] <version>
|
|
|
|
'tool' in one of:
|
2007-05-18 15:57:16 +00:00
|
|
|
--gcc, --binutils, --glibc, --uClibc, --linux,
|
|
|
|
--gdb, --dmalloc
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
Valid options for all tools:
|
2007-04-18 17:32:55 +00:00
|
|
|
--experimental, -x
|
|
|
|
mark the version as being experimental
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
--obsolete, -o
|
|
|
|
mark the version as being obsolete
|
|
|
|
|
|
|
|
Valid mandatory 'option' for tool==gcc is one and only one of:
|
2007-02-24 11:00:05 +00:00
|
|
|
--core, --final
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
Valid mandatory 'option' for tool==linux is one and only one of:
|
2007-02-24 11:00:05 +00:00
|
|
|
--install, --sanitised, --copy
|
|
|
|
|
|
|
|
'version' is a valid version for the specified tool.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
add version 2.6.19.2 to linux kernel install method:
|
|
|
|
${myname} --linux --install 2.6.19.2
|
|
|
|
|
|
|
|
add versions 2.3.5 and 2.3.6 to glibc:
|
|
|
|
${myname} --glibc 2.3.5 2.3.6
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
cat=
|
2007-02-24 11:00:05 +00:00
|
|
|
tool=
|
|
|
|
tool_prefix=
|
2007-05-17 16:22:51 +00:00
|
|
|
tool_suffix=
|
2007-02-24 11:00:05 +00:00
|
|
|
CORE=
|
|
|
|
FINAL=
|
|
|
|
VERSION=
|
2007-04-18 17:32:55 +00:00
|
|
|
EXP=
|
2007-05-17 16:22:51 +00:00
|
|
|
OBS=
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
i=1
|
|
|
|
while [ $i -le $# ]; do
|
|
|
|
case "${!i}" in
|
2007-05-17 16:22:51 +00:00
|
|
|
# Tools:
|
2007-04-18 17:32:55 +00:00
|
|
|
--gcc) cat=CC; tool=gcc; tool_prefix=cc_; tool_suffix=;;
|
|
|
|
--binutils) cat=BINUTILS; tool=binutils; tool_prefix=; tool_suffix=;;
|
|
|
|
--glibc) cat=LIBC; tool=glibc; tool_prefix=libc_; tool_suffix=;;
|
|
|
|
--uClibc) cat=LIBC; tool=uClibc; tool_prefix=libc_; tool_suffix=;;
|
2007-05-17 16:22:51 +00:00
|
|
|
--linux) cat=KERNEL; tool=linux; tool_prefix=kernel_; tool_suffix=;;
|
|
|
|
--gdb) cat=GDB; tool=gdb; tool_prefix=debug/ tool_suffix=;;
|
2007-05-18 15:57:16 +00:00
|
|
|
--dmalloc) cat=DMALLOC; tool=dmalloc; tool_prefix=debug/ tool_suffix=;;
|
2007-05-17 16:22:51 +00:00
|
|
|
# Tools options:
|
|
|
|
-x|--experimental) EXP=1; OBS=;;
|
|
|
|
-o|--obsolete) OBS=1; EXP=;;
|
|
|
|
--core) CORE=1; FINAL=;;
|
|
|
|
--final) FINAL=1; CORE=;;
|
2007-04-18 17:32:55 +00:00
|
|
|
--install) tool_suffix=install;;
|
|
|
|
--sanitised) tool_suffix=sanitised;;
|
|
|
|
--copy) tool_suffix=copy;;
|
2007-05-17 16:22:51 +00:00
|
|
|
# Misc:
|
2007-04-18 17:32:55 +00:00
|
|
|
-h|--help) doHelp; exit 0;;
|
2007-05-17 16:22:51 +00:00
|
|
|
-*) echo "Unknown option: \"${!i}\". (use -h/--help for help"; exit 1;;
|
|
|
|
*) VERSION="${VERSION} ${!i}";;
|
2007-02-24 11:00:05 +00:00
|
|
|
esac
|
|
|
|
i=$((i+1))
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -n "${tool}" -o -n "${VERSION}" ] || { doHelp; exit 1; }
|
|
|
|
|
|
|
|
case "${cat}" in
|
2007-05-17 16:22:51 +00:00
|
|
|
CC) [ -z "${CORE}" -a -z "${FINAL}" ] && { doHelp; exit 1; };;
|
2007-03-04 20:12:18 +00:00
|
|
|
KERNEL) unset FINAL CORE
|
|
|
|
[ -z "${tool_suffix}" ] && { doHelp; exit 1; }
|
|
|
|
;;
|
2007-05-17 16:22:51 +00:00
|
|
|
*) CORE=; FINAL=;;
|
2007-02-24 11:00:05 +00:00
|
|
|
esac
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
MIDDLE_V=; MIDDLE_F=
|
|
|
|
[ -n "${CORE}" ] && MIDDLE_V="_CORE" && MIDDLE_F="core_"
|
2007-02-24 11:00:05 +00:00
|
|
|
for ver in ${VERSION}; do
|
2007-04-18 17:32:55 +00:00
|
|
|
unset DEP L1 L2 L3 L4 L5 FILE
|
2007-05-17 16:22:51 +00:00
|
|
|
v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'`
|
2007-02-24 11:00:05 +00:00
|
|
|
if [ "${cat}" = "KERNEL" ]; then
|
|
|
|
TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`"
|
|
|
|
L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
|
|
|
|
L2=" bool\n"
|
|
|
|
L3=" prompt \"${ver}\"\n"
|
|
|
|
# Extra versions are not necessary visible:
|
2007-04-18 17:32:55 +00:00
|
|
|
case "${tool_suffix},${ver}" in
|
|
|
|
sanitised,*) ;; # Sanitised headers always have an extra version
|
|
|
|
*,*.*.*.*) DEP="${DEP} && KERNEL_VERSION_SEE_EXTRAVERSION";;
|
2007-02-24 11:00:05 +00:00
|
|
|
esac
|
|
|
|
L5=" default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
|
2007-04-18 17:32:55 +00:00
|
|
|
FILE="config/${tool_prefix}${tool}_headers_${tool_suffix}.in"
|
2007-05-17 16:22:51 +00:00
|
|
|
else
|
2007-05-19 22:54:20 +00:00
|
|
|
L1="config ${cat}${MIDDLE_V}_V_${v}\n"
|
2007-05-17 16:22:51 +00:00
|
|
|
L2=" bool\n"
|
|
|
|
L3=" prompt \"${ver}\"\n"
|
2007-05-19 22:54:20 +00:00
|
|
|
L5=" default \"${ver}\" if ${cat}${MIDDLE_V}_V_${v}"
|
2007-05-17 16:22:51 +00:00
|
|
|
FILE="config/${tool_prefix}${MIDDLE_F}${tool}.in"
|
2007-02-24 11:00:05 +00:00
|
|
|
fi
|
2007-04-18 17:32:55 +00:00
|
|
|
[ -n "${EXP}" ] && DEP="${DEP} && EXPERIMENTAL"
|
2007-05-17 16:22:51 +00:00
|
|
|
[ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
|
2007-04-18 17:32:55 +00:00
|
|
|
case "${DEP}" in
|
|
|
|
"") ;;
|
|
|
|
*) L4=" depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n"
|
|
|
|
esac
|
|
|
|
sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/;
|
|
|
|
s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}"
|
2007-02-24 11:00:05 +00:00
|
|
|
done
|