2009-01-29 18:48:05 +00:00
|
|
|
#!/bin/sh
|
2009-01-29 18:53:32 +00:00
|
|
|
set -e
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
# Adds a new version to one of the toolchain component
|
|
|
|
myname="$0"
|
|
|
|
|
2009-01-29 18:53:32 +00:00
|
|
|
# Parse the tools' paths configuration
|
2009-11-12 17:42:13 +00:00
|
|
|
# It is expected that this script is only to be run from the
|
|
|
|
# source directory of crosstool-NG, so it is trivial to find
|
2012-01-16 22:36:42 +00:00
|
|
|
# paths.sh (we can't use ". paths.sh", as POSIX states that
|
2009-11-12 17:42:13 +00:00
|
|
|
# $PATH should be searched for, and $PATH most probably doe
|
|
|
|
# not include "."), hence the "./".
|
2012-01-16 22:36:42 +00:00
|
|
|
. "./paths.sh"
|
2009-01-29 18:53:32 +00:00
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
doHelp() {
|
|
|
|
cat <<-EOF
|
2015-12-08 17:09:49 +00:00
|
|
|
Usage: ${myname} <--tool> <[options] version [...]> ...
|
|
|
|
'tool' in one of:
|
2016-12-17 00:10:32 +00:00
|
|
|
gcc, binutils, glibc, uClibc, uClibc-ng, newlib, linux, gdb,
|
2015-12-08 17:09:49 +00:00
|
|
|
duma, strace, ltrace, libelf, gmp, mpfr, isl, cloog, mpc,
|
|
|
|
mingw-w64, expat, ncurses
|
|
|
|
|
|
|
|
Valid options for all tools:
|
|
|
|
--stable, -s, +x (default)
|
|
|
|
mark the version as being stable (as opposed to experimental, below)
|
|
|
|
|
|
|
|
--experimental, -x, +s
|
|
|
|
mark the version as being experimental (as opposed to stable, above)
|
|
|
|
|
|
|
|
--current, -c, +o (default)
|
|
|
|
mark the version as being cuurent (as opposed to obsolete, below)
|
|
|
|
|
|
|
|
--obsolete, -o, +c
|
|
|
|
mark the version as being obsolete (as opposed to current, above)
|
|
|
|
|
|
|
|
Note: setting a new tool resets to the defaults: 'stable' and 'current'.
|
|
|
|
|
|
|
|
'version' is a valid version for the specified tool.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
add stable current version 2.6.19.2 to linux kernel:
|
|
|
|
${myname} --linux 2.6.19.2
|
|
|
|
|
|
|
|
add experimental obsolete version 2.3.5 and stable current versions 2.6.1
|
|
|
|
and 2.6.2 to glibc, add stable obsolete version 3.3.3 to gcc:
|
|
|
|
${myname} --glibc -x -o 2.3.5 -s -c 2.6.1 2.6.2 --gcc -o 3.3.3
|
2016-05-12 18:34:34 +00:00
|
|
|
EOF
|
2007-02-24 11:00:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-31 15:20:52 +00:00
|
|
|
# Extract field $3 from version $1 with separator $2
|
|
|
|
getVersionField() {
|
|
|
|
local version="$1"
|
|
|
|
local sep="$2"
|
|
|
|
local field="$3"
|
|
|
|
|
|
|
|
echo "${version}${sep}${sep}${sep}${sep}" |cut -d ${sep} -f ${field}
|
|
|
|
}
|
|
|
|
|
2009-01-29 18:48:05 +00:00
|
|
|
# Effectively add a version to the specified tool
|
|
|
|
# $cat : tool category
|
|
|
|
# $tool : tool name
|
|
|
|
# $tool_prefix : tool directory prefix
|
|
|
|
# $EXP : set to non empty if experimental, to empty otherwise
|
2016-05-12 18:34:34 +00:00
|
|
|
# OBS : set to non empty if obsolete, to empty otherwise
|
2009-01-29 18:48:05 +00:00
|
|
|
# $1 : version string to add
|
|
|
|
addToolVersion() {
|
|
|
|
local version="$1"
|
2011-04-27 22:13:41 +00:00
|
|
|
local file="$2"
|
2009-02-02 21:56:30 +00:00
|
|
|
local config_ver_option
|
2009-01-29 18:48:05 +00:00
|
|
|
local exp_obs_prompt
|
2010-01-14 17:44:13 +00:00
|
|
|
local deps v ver_M ver_m ver_p
|
2009-01-29 18:48:05 +00:00
|
|
|
local SedExpr1 SedExpr2
|
|
|
|
|
2011-04-27 22:13:41 +00:00
|
|
|
[ -f "${file}" ] || return 0
|
|
|
|
|
2009-01-29 18:53:32 +00:00
|
|
|
v=$(echo "${version}" |"${sed}" -r -e 's/-/_/g; s/\./_/g;')
|
2009-01-29 18:48:05 +00:00
|
|
|
|
2009-02-02 21:56:30 +00:00
|
|
|
config_ver_option="${cat}_V_${v}"
|
|
|
|
|
|
|
|
# Check for existing version: it can be legitimitate for an end-user
|
|
|
|
# to try adding a new version if the one he/she wants is not listed.
|
|
|
|
# But it can be the case where the version is hidden behind either one
|
|
|
|
# of EXPERIMENTAL or OBSOLETE, so warn if the version is already listed.
|
2015-05-10 03:09:05 +00:00
|
|
|
if ${grep} -E "^config ${config_ver_option}$" "${file}" >/dev/null 2>&1; then
|
2009-02-02 21:56:30 +00:00
|
|
|
echo "'${tool}': version '${version}' already present:"
|
2015-05-10 03:09:05 +00:00
|
|
|
${grep} -A1 -B0 -n \
|
2011-04-27 22:13:41 +00:00
|
|
|
-E "^(config ${config_ver_option}| {4}prompt \"${version}\")$" \
|
|
|
|
"${file}" /dev/null
|
2009-02-02 21:56:30 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
SedExpr1="${SedExpr1}config ${config_ver_option}\n"
|
2009-01-29 18:48:05 +00:00
|
|
|
SedExpr1="${SedExpr1} bool\n"
|
|
|
|
SedExpr1="${SedExpr1} prompt \"${version}"
|
|
|
|
case "${EXP},${OBS}" in
|
|
|
|
,) ;;
|
2009-09-13 16:44:17 +00:00
|
|
|
,*) exp_obs_prompt=" (OBSOLETE)"
|
2009-09-13 16:38:06 +00:00
|
|
|
deps=" depends on OBSOLETE"
|
2009-01-29 18:48:05 +00:00
|
|
|
;;
|
2009-09-13 16:44:17 +00:00
|
|
|
*,) exp_obs_prompt=" (EXPERIMENTAL)"
|
2009-09-13 16:38:06 +00:00
|
|
|
deps=" depends on EXPERIMENTAL"
|
2009-01-29 18:48:05 +00:00
|
|
|
;;
|
2009-09-13 16:44:17 +00:00
|
|
|
*) exp_obs_prompt=" (EXPERIMENTAL, OBSOLETE)"
|
2009-09-13 16:38:06 +00:00
|
|
|
deps=" depends on EXPERIMENTAL \\&\\& OBSOLETE"
|
2009-01-29 18:48:05 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
[ -n "${exp_obs_prompt}" ] && SedExpr1="${SedExpr1}${exp_obs_prompt}"
|
2009-09-13 16:38:06 +00:00
|
|
|
SedExpr1="${SedExpr1}\""
|
|
|
|
[ -n "${deps}" ] && SedExpr1="${SedExpr1}\n${deps}"
|
2010-01-01 23:15:19 +00:00
|
|
|
case "${tool}" in
|
|
|
|
gcc)
|
|
|
|
# Extract 'M'ajor and 'm'inor from version string
|
2011-05-31 15:20:52 +00:00
|
|
|
ver_M=$(getVersionField "${version}" . 1)
|
|
|
|
ver_m=$(getVersionField "${version}" . 2)
|
2014-07-19 06:52:08 +00:00
|
|
|
if [ ${ver_M} -ge 4 ] && [ ${ver_m} -ge 2 ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select CC_GCC_${ver_M}_${ver_m}"
|
2010-01-01 23:15:19 +00:00
|
|
|
fi
|
|
|
|
;;
|
2011-05-31 18:39:42 +00:00
|
|
|
binutils)
|
2016-01-03 09:18:32 +00:00
|
|
|
# Extract 'M'ajor, 'm'inor, sometimes 'p'atch from version string
|
|
|
|
# TODO: Rework this
|
2011-05-31 18:39:42 +00:00
|
|
|
ver_M=$(getVersionField "${version}" . 1)
|
|
|
|
ver_m=$(getVersionField "${version}" . 2)
|
2016-01-03 09:18:32 +00:00
|
|
|
ver_p=$(getVersionField "${version}" . 3)
|
2016-02-05 06:55:08 +00:00
|
|
|
if [ ${ver_M} -eq 2 -a ${ver_m} -eq 26 ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select BINUTILS_2_26_or_later"
|
2016-05-12 18:34:34 +00:00
|
|
|
elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 25 -a ${ver_p} -eq 1 ]; then
|
2016-01-03 09:18:32 +00:00
|
|
|
SedExpr1="${SedExpr1}\n select BINUTILS_2_25_1_or_later"
|
|
|
|
elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 25 -a -z ${ver_p} ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select BINUTILS_2_25_or_later"
|
|
|
|
elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 24 ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select BINUTILS_2_24_or_later"
|
|
|
|
elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 23 -a ${ver_p} -eq 2 ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select BINUTILS_2_23_2_or_later"
|
2011-05-31 18:39:42 +00:00
|
|
|
fi
|
|
|
|
;;
|
2010-01-14 17:44:13 +00:00
|
|
|
uClibc)
|
2015-11-10 06:47:17 +00:00
|
|
|
# uClibc-0.9.33.2 needs some love
|
2011-05-31 15:20:52 +00:00
|
|
|
ver_M=$(getVersionField "${version}" . 1)
|
|
|
|
ver_m=$(getVersionField "${version}" . 2)
|
|
|
|
ver_p=$(getVersionField "${version}" . 3)
|
2016-05-12 18:34:34 +00:00
|
|
|
if [ ${ver_M} -eq 0 -a ${ver_m} -eq 9 -a ${ver_p} -eq 33 ]; then
|
2015-11-10 06:47:17 +00:00
|
|
|
SedExpr1="${SedExpr1}\n select LIBC_UCLIBC_0_9_33_2_or_later"
|
2010-01-14 17:44:13 +00:00
|
|
|
fi
|
|
|
|
;;
|
Give companion tools some love.
Allow selection of make/m4/... version. Support imports of new versions
via addToolVersion.sh. Import newest versions of the companion tools.
One non-trivial change is the handling of make versions. Existing code
was not handling make companion tool as described (see the previous
commit). However, since most modern systems have make 4.x, that previous
commit made crosstool-ng always build make as a companion tool.
This traces back to the commit dd15c93 from 2014. That commit's log message
says that actually it was 3.81 which broke the build for certain component
(it was originally breaking eglibc, but I noticed it was breaking current
glibc on powerpc64), and introduced an option to force using 3.81 by
"components that really need it". It looks like in 2.5 years we haven't
seen any such components that really need make 3.81, and (given that make
has already had a few releases since 3.81) we're unlikely to see them
in the future.
Hence, the configure check is changed from "exactly 3.81" to "3.81 or newer".
In its current form, configure will accept make 3.80+, and will not require
make as a companion tool for 3.81+. We might want to bump the latter check
to even newer version given the claim from dd15c93. Killed
COMP_TOOLS_make_3_81_NEEDED.
Anyway, I retained 3.81 just in case; ditto for m4 1.14.3, autoconf 2.65
and automake 1.11.1.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-21 20:09:54 +00:00
|
|
|
uClibc-ng)
|
|
|
|
# uClibc-ng-1.0.15 changed threading configuration, no longer compatible
|
|
|
|
# with the rest of uClibc gang.
|
|
|
|
ver_M=$(getVersionField "${version}" . 1)
|
|
|
|
ver_m=$(getVersionField "${version}" . 2)
|
|
|
|
ver_p=$(getVersionField "${version}" . 3)
|
|
|
|
if [ ${ver_M} -eq 0 -a ${ver_m} -eq 9 -a ${ver_p} -eq 33 ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select LIBC_UCLIBC_NG_1_0_15_or_later"
|
|
|
|
fi
|
|
|
|
;;
|
2010-03-20 17:49:15 +00:00
|
|
|
gdb)
|
|
|
|
# gdb-7.0 and above have special handling
|
2011-05-31 15:20:52 +00:00
|
|
|
ver_M=$(getVersionField "${version}" . 1)
|
2010-03-20 17:49:15 +00:00
|
|
|
if [ ${ver_M} -ge 7 ]; then
|
2014-07-19 06:52:07 +00:00
|
|
|
if [ ${ver_m} -ge 2 ]; then
|
|
|
|
SedExpr1="${SedExpr1}\n select GDB_7_2_or_later"
|
|
|
|
else
|
|
|
|
SedExpr1="${SedExpr1}\n select GDB_7_0_or_later"
|
|
|
|
fi
|
2010-03-20 17:49:15 +00:00
|
|
|
fi
|
|
|
|
;;
|
2010-01-01 23:15:19 +00:00
|
|
|
esac
|
2010-01-10 15:50:52 +00:00
|
|
|
SedExpr2=" default \"${version}\" if ${config_ver_option}"
|
2009-09-26 10:45:07 +00:00
|
|
|
"${sed}" -r -i -e 's/^(# CT_INSERT_VERSION_BELOW)$/\1\n\n'"${SedExpr1}"'/;' "${file}"
|
2009-09-13 16:38:06 +00:00
|
|
|
"${sed}" -r -i -e 's/^(# CT_INSERT_VERSION_STRING_BELOW)$/\1\n'"${SedExpr2}"'/;' "${file}"
|
2009-01-29 18:48:05 +00:00
|
|
|
}
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
cat=
|
2007-02-24 11:00:05 +00:00
|
|
|
tool=
|
|
|
|
tool_prefix=
|
|
|
|
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
|
|
|
|
2009-01-29 18:48:05 +00:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
doHelp
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
2007-05-17 16:22:51 +00:00
|
|
|
# Tools:
|
Give companion tools some love.
Allow selection of make/m4/... version. Support imports of new versions
via addToolVersion.sh. Import newest versions of the companion tools.
One non-trivial change is the handling of make versions. Existing code
was not handling make companion tool as described (see the previous
commit). However, since most modern systems have make 4.x, that previous
commit made crosstool-ng always build make as a companion tool.
This traces back to the commit dd15c93 from 2014. That commit's log message
says that actually it was 3.81 which broke the build for certain component
(it was originally breaking eglibc, but I noticed it was breaking current
glibc on powerpc64), and introduced an option to force using 3.81 by
"components that really need it". It looks like in 2.5 years we haven't
seen any such components that really need make 3.81, and (given that make
has already had a few releases since 3.81) we're unlikely to see them
in the future.
Hence, the configure check is changed from "exactly 3.81" to "3.81 or newer".
In its current form, configure will accept make 3.80+, and will not require
make as a companion tool for 3.81+. We might want to bump the latter check
to even newer version given the claim from dd15c93. Killed
COMP_TOOLS_make_3_81_NEEDED.
Anyway, I retained 3.81 just in case; ditto for m4 1.14.3, autoconf 2.65
and automake 1.11.1.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-21 20:09:54 +00:00
|
|
|
--gcc) EXP=; OBS=; cat=CC_GCC; tool=gcc; tool_prefix=cc; dot2suffix=;;
|
|
|
|
--binutils) EXP=; OBS=; cat=BINUTILS; tool=binutils; tool_prefix=binutils; dot2suffix=;;
|
|
|
|
--glibc) EXP=; OBS=; cat=LIBC_GLIBC; tool=glibc; tool_prefix=libc; dot2suffix=;;
|
|
|
|
--uClibc) EXP=; OBS=; cat=LIBC_UCLIBC; tool=uClibc; tool_prefix=libc; dot2suffix=;;
|
|
|
|
--uClibc-ng)EXP=; OBS=; cat=LIBC_UCLIBC_NG; tool=uClibc; tool_prefix=libc; dot2suffix=;;
|
|
|
|
--newlib) EXP=; OBS=; cat=LIBC_NEWLIB; tool=newlib; tool_prefix=libc; dot2suffix=;;
|
|
|
|
--mingw-w64)EXP=; OBS=; cat=WINAPI; tool=mingw; tool_prefix=libc; dot2suffix=;;
|
|
|
|
--linux) EXP=; OBS=; cat=KERNEL; tool=linux; tool_prefix=kernel; dot2suffix=;;
|
|
|
|
--gdb) EXP=; OBS=; cat=GDB; tool=gdb; tool_prefix=debug; dot2suffix=;;
|
|
|
|
--duma) EXP=; OBS=; cat=DUMA; tool=duma; tool_prefix=debug; dot2suffix=;;
|
|
|
|
--strace) EXP=; OBS=; cat=STRACE; tool=strace; tool_prefix=debug; dot2suffix=;;
|
|
|
|
--ltrace) EXP=; OBS=; cat=LTRACE; tool=ltrace; tool_prefix=debug; dot2suffix=;;
|
|
|
|
--gmp) EXP=; OBS=; cat=GMP; tool=gmp; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--mpfr) EXP=; OBS=; cat=MPFR; tool=mpfr; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--isl) EXP=; OBS=; cat=ISL; tool=isl; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--cloog) EXP=; OBS=; cat=CLOOG; tool=cloog; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--mpc) EXP=; OBS=; cat=MPC; tool=mpc; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--libelf) EXP=; OBS=; cat=LIBELF; tool=libelf; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--expat) EXP=; OBS=; cat=EXPAT; tool=expat; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--ncurses) EXP=; OBS=; cat=NCURSES; tool=ncurses; tool_prefix=companion_libs; dot2suffix=;;
|
|
|
|
--make) EXP=; OBS=; cat=MAKE; tool=make; tool_prefix=companion_tools; dot2suffix=;;
|
|
|
|
--m4) EXP=; OBS=; cat=M4; tool=m4; tool_prefix=companion_tools; dot2suffix=;;
|
|
|
|
--autoconf) EXP=; OBS=; cat=AUTOCONF; tool=autoconf; tool_prefix=companion_tools; dot2suffix=;;
|
|
|
|
--automake) EXP=; OBS=; cat=AUTOMAKE; tool=automake; tool_prefix=companion_tools; dot2suffix=;;
|
|
|
|
--libtool) EXP=; OBS=; cat=LIBTOOL; tool=libtool; tool_prefix=companion_tools; dot2suffix=;;
|
2009-01-29 18:48:05 +00:00
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
# Tools options:
|
2009-01-29 18:48:05 +00:00
|
|
|
-x|--experimental|+s) EXP=1;;
|
|
|
|
-s|--stable|+x) EXP=;;
|
|
|
|
-o|--obsolete|+c) OBS=1;;
|
|
|
|
-c|--current|+o) OBS=;;
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
# Misc:
|
2009-01-29 18:48:05 +00:00
|
|
|
-h|--help) doHelp; exit 0;;
|
|
|
|
-*) echo "Unknown option: '$1' (use -h/--help for help)."; exit 1;;
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2009-01-29 18:48:05 +00:00
|
|
|
# Version string:
|
|
|
|
*) [ -n "${tool}" ] || { doHelp; exit 1; }
|
2011-04-27 22:13:41 +00:00
|
|
|
file_base="config/${tool_prefix}/${tool}.in"
|
2012-12-27 11:45:22 +00:00
|
|
|
addToolVersion "$1" "${file_base}${dot2suffix}"
|
2009-01-29 18:48:05 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
2007-02-24 11:00:05 +00:00
|
|
|
done
|