2007-09-12 17:35:07 +00:00
|
|
|
#!/bin/bash
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
# 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,
|
2007-07-13 12:22:34 +00:00
|
|
|
--gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
|
2008-04-30 10:43:41 +00:00
|
|
|
--gmp, --mpfr
|
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==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
|
|
|
VERSION=
|
2007-04-18 17:32:55 +00:00
|
|
|
EXP=
|
2007-05-17 16:22:51 +00:00
|
|
|
OBS=
|
2007-08-11 10:55:38 +00:00
|
|
|
prompt_suffix=
|
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:
|
2008-04-17 21:04:23 +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=;;
|
|
|
|
--linux) cat=KERNEL; tool=linux; tool_prefix=kernel; tool_suffix=;;
|
|
|
|
--gdb) cat=GDB; tool=gdb; tool_prefix=debug tool_suffix=;;
|
|
|
|
--dmalloc) cat=DMALLOC; tool=dmalloc; tool_prefix=debug tool_suffix=;;
|
|
|
|
--duma) cat=DUMA; tool=duma; tool_prefix=debug tool_suffix=;;
|
|
|
|
--strace) cat=STRACE; tool=strace; tool_prefix=debug tool_suffix=;;
|
|
|
|
--ltrace) cat=LTRACE; tool=ltrace; tool_prefix=debug tool_suffix=;;
|
|
|
|
--libelf) cat=LIBELF; tool=libelf; tool_prefix=tools tool_suffix=;;
|
2008-04-30 10:43:41 +00:00
|
|
|
--gmp) cat=GMP; tool=gmp; tool_prefix=cc; tool_suffix=;;
|
|
|
|
--mpfr) cat=MPFR; tool=mpfr; tool_prefix=cc; tool_suffix=;;
|
2007-05-17 16:22:51 +00:00
|
|
|
# Tools options:
|
2007-08-11 10:55:38 +00:00
|
|
|
-x|--experimental) EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
|
|
|
|
-o|--obsolete) OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;
|
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;;
|
2008-05-20 21:32:39 +00:00
|
|
|
-*) echo "Unknown option: '${!i}' (use -h/--help for help)."; exit 1;;
|
2007-05-17 16:22:51 +00:00
|
|
|
*) 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
|
2008-02-14 22:34:19 +00:00
|
|
|
KERNEL) [ -z "${tool_suffix}" ] && { doHelp; exit 1; } ;;
|
|
|
|
*) ;;
|
2007-02-24 11:00:05 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
for ver in ${VERSION}; do
|
2008-06-09 16:14:23 +00:00
|
|
|
# Split VERSION into MAJOR MINOR PATCHLEVEL EXTRAVERSION
|
2008-06-09 16:35:21 +00:00
|
|
|
ver_M=$(echo "${ver}...." |cut -d . -f 1)
|
|
|
|
ver_m=$(echo "${ver}...." |cut -d . -f 2)
|
|
|
|
ver_P=$(echo "${ver}...." |cut -d . -f 3)
|
|
|
|
ver_E=$(echo "${ver}...." |cut -d . -f 4)
|
2008-06-09 16:14:23 +00:00
|
|
|
unset DEP L1 L2 L3 L4 L5 L6 FILE
|
2008-05-20 21:32:39 +00:00
|
|
|
v=$(echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;')
|
2007-02-24 11:00:05 +00:00
|
|
|
if [ "${cat}" = "KERNEL" ]; then
|
2008-05-20 21:32:39 +00:00
|
|
|
TOOL_SUFFIX=$(echo "${tool_suffix}" |tr [[:lower:]] [[:upper:]])
|
2007-02-24 11:00:05 +00:00
|
|
|
L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
|
|
|
|
L2=" bool\n"
|
2007-08-11 10:55:38 +00:00
|
|
|
L3=" prompt \"${ver}${prompt_suffix}\"\n"
|
2007-02-24 11:00:05 +00:00
|
|
|
# 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
|
2008-06-09 16:35:21 +00:00
|
|
|
L6=" default \"${ver}\" if ${cat}_${TOOL_SUFFIX}_V_${v}"
|
2008-04-17 21:04:23 +00:00
|
|
|
FILE="config/${tool_prefix}/${tool}_headers_${tool_suffix}.in"
|
2007-05-17 16:22:51 +00:00
|
|
|
else
|
2008-02-14 22:34:19 +00:00
|
|
|
L1="config ${cat}_V_${v}\n"
|
2007-05-17 16:22:51 +00:00
|
|
|
L2=" bool\n"
|
2007-08-11 10:55:38 +00:00
|
|
|
L3=" prompt \"${ver}${prompt_suffix}\"\n"
|
2008-06-09 16:14:23 +00:00
|
|
|
L6=" default \"${ver}\" if ${cat}_V_${v}"
|
|
|
|
case "${tool}" in
|
|
|
|
gcc)
|
2008-06-09 16:35:21 +00:00
|
|
|
if [ ${ver_M} -gt 4 -o \( ${ver_M} -eq 4 -a ${ver_m} -ge 3 \) ]; then
|
|
|
|
L5=" select CC_GCC_4_3_or_later\n"
|
2008-06-09 16:14:23 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2008-04-17 21:04:23 +00:00
|
|
|
FILE="config/${tool_prefix}/${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
|
|
|
|
"") ;;
|
2008-06-09 16:35:21 +00:00
|
|
|
*) L4=" depends on "$(echo "${DEP}" |sed -r -e 's/^ \&\& //; s/\&/\\&/g;')"\n"
|
2007-04-18 17:32:55 +00:00
|
|
|
esac
|
2008-06-09 16:14:23 +00:00
|
|
|
sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}${L5}"'\n\1/;
|
|
|
|
s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L6}"'\n\1/;' "${FILE}"
|
2007-02-24 11:00:05 +00:00
|
|
|
done
|