Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv3] package/ccache: do not force colored diagnostics
@ 2017-02-12 13:30 Yann E. MORIN
  2017-02-12 13:34 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yann E. MORIN @ 2017-02-12 13:30 UTC (permalink / raw)
  To: buildroot

When GCC_COLORS is set, ccache passes '-fdiagnostics-color' to GCC but
this flag requires GCC v4.9 or later. Older versions complain about the
unrecognized command line option.

We could override GCC_COLORS in the environment, but this would not be
enough since some packages may call directly $(CC) or $(HOSTCC) (like
makedevs do, as spotted by Thomas).

Since we use the same ccache build for both host and target, we disable
that behaviour when either the host or target compiler is tool old to
support this, at the cost of nol onger colorising output diagnostics for
the one that is recent enough.

Reported-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

---
Changes v2 -> v2: (Yann)
  - drop the environment variable override  (Yann)
  - directly patch ccache  (Thomas)

Changes v1->v2  (Carlos)
  Fix indentation, use positive logic and improve the commit message,
  acording to comments from Thomas Petazzoni and Yann E. MORIN.
---
 package/ccache/ccache.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/ccache/ccache.mk b/package/ccache/ccache.mk
index f174a5d..a4c2d9f 100644
--- a/package/ccache/ccache.mk
+++ b/package/ccache/ccache.mk
@@ -35,6 +35,16 @@ endef
 
 HOST_CCACHE_POST_PATCH_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION
 
+# Further patch ccache if either the host or target compilers is
+# too old to support colored output diagnostics.
+ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9)$(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),yy)
+define CCACHE_NO_GCC_COLORS
+	sed -i  '/if (getenv("GCC_COLORS")/,+3d' $(@D)/ccache.c
+endef
+
+#HOST_CCACHE_POST_PATCH_HOOKS += CCACHE_NO_GCC_COLORS
+endif
+
 define HOST_CCACHE_MAKE_CACHE_DIR
 	mkdir -p $(BR_CACHE_DIR)
 endef
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-13 16:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-12 13:30 [Buildroot] [PATCHv3] package/ccache: do not force colored diagnostics Yann E. MORIN
2017-02-12 13:34 ` Thomas Petazzoni
2017-02-12 13:37   ` Yann E. MORIN
2017-02-12 13:34 ` Baruch Siach
2017-02-12 21:39 ` Arnout Vandecappelle
2017-02-13 16:09   ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox