diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2015-08-04 20:00:35 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2015-08-05 12:11:20 +0200 |
commit | bd760c3f5146c75e05ede023f8ef0afd8bce5d74 (patch) | |
tree | 988657c6169d062bada66f773b91c7c1c7424e34 /toolchain/helpers.mk | |
parent | c67540ef9b98139c00409b44a1bfbaff3189b8e9 (diff) |
toolchain-external: add support for gcc version dependency
This commit wires up the gcc version dependency mechanism in the
external toolchain backend. To do so, it:
* Changes the definition of all pre-defined external toolchain
profiles to select the appropriate BR2_TOOLCHAIN_GCC_AT_LEAST_*
option.
* For custom external toolchains, provides a visible Config.in
"choice" to select the gcc version used in the external toolchain.
* Adds a new check_gcc_version function, that verifies that the real
gcc version found in the external toolchain matches the one
declared in the Buildroot configuration.
[Thomas: use better sed expression proposed by Yann E. Morin, which
works with more cases.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'toolchain/helpers.mk')
-rw-r--r-- | toolchain/helpers.mk | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 895f3f146..018f3edb9 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -175,6 +175,36 @@ check_kernel_headers_version = \ fi # +# Check the specific gcc version actually matches the version in the +# toolchain +# +# $1: path to gcc +# $2: expected gcc version +# +# Some details about the sed expression: +# - 1!d +# - delete if not line 1 +# +# - s/^[^)]+\) ([^[:space:]]+).*/\1/ +# - eat all until the first ')' character followed by a space +# - match as many non-space chars as possible +# - eat all the remaining chars on the line +# - replace by the matched expression +# +# - s/\.[[:digit:]]+$// +# - eat a dot followed by as many digits as possible up to the end +# of line +# - replace with nothing +# +check_gcc_version = \ + expected_version="$(strip $2)" ; \ + real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/; s/\.[[:digit:]]+$$//;'` ; \ + if [ "$${real_version}" != "$${expected_version}" ] ; then \ + echo "Incorrect selection of gcc version: expected $${expected_version}, got $${real_version}" ; \ + exit 1 ; \ + fi + +# # Check the availability of a particular glibc feature. This function # is used to check toolchain options that are always supported by # glibc, so we simply check that the corresponding option is properly |