path: root/Makefile
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2018-10-23 11:08:40 +0200
committerGravatar Peter Korsgaard <peter@korsgaard.com>2018-10-24 17:55:31 +0200
commit336befc8e4e2c01f51fe1b205d4d3699a0ad8c6c (patch)
treea306d05df37726a705d7f774595995f85a52659f /Makefile
parent1a8801a2a85140f2bf9529ec4bf0597454f744a2 (diff)
core: support host gcc of the future
When we do a release, we know only of a set of gcc versions that the host may have. But in the future, distributions with newer gcc versions may show up. Currently, we do not recognise those versions, and thus we do as if they were older than the oldest we know of. This means that a set of packages become unselectable, when they should be. We fix that by capping the detected version to the highest we know of. Reported-by: gargar_ on IRC Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com> (cherry picked from commit 3950e69dad925b684aaf7462713e50aab882de28) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'Makefile')
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 83f64f491d..a3db8987eb 100644
--- a/Makefile
+++ b/Makefile
@@ -360,8 +360,14 @@ export HOSTARCH := $(shell LC_ALL=C $(HOSTCC_NOCCACHE) -v 2>&1 | \
-e 's/macppc/powerpc/' \
-e 's/sh.*/sh/' )
-HOSTCC_VERSION := $(shell $(HOSTCC_NOCCACHE) --version | \
- sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1 \2/p')
+# When adding a new host gcc version in Config.in,
+# update the HOSTCC_MAX_VERSION variable:
+HOSTCC_VERSION := $(shell V=$$($(HOSTCC_NOCCACHE) --version | \
+ sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1 \2/p'); \
+ [ "$${V%% *}" -le $(HOSTCC_MAX_VERSION) ] || V=$(HOSTCC_MAX_VERSION); \
+ printf "%s" "$${V}")
# For gcc >= 5.x, we only need the major version.
ifneq ($(firstword $(HOSTCC_VERSION)),4)