diff mbox

[OpenWrt-Devel] Make ccache aware of OpenWRT provided GCC patch.

Message ID 20150714093830.GB3259@gmail.com
State Changes Requested
Headers show

Commit Message

Karl Vogel July 14, 2015, 9:38 a.m. UTC
The OpenWRT GCC patch, 910-mbsd_multi.patch adds an extra option
to gcc that depends on an environment variable. Standard ccache
is unaware of this option and therefor can produce stdout from gcc
that doesn't correspond to what you would get if you actually
do a direct compilation with gcc.

This commit adds a patch to ccache to make it aware of the new
option and removes the feature from the ccache package to use the
host system's installed ccache binary.
---
 tools/ccache/Makefile                       | 24 ++++------------------
 tools/ccache/patches/100-honour-copts.patch | 31 +++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100644 tools/ccache/patches/100-honour-copts.patch

Comments

John Crispin July 14, 2015, 9:48 a.m. UTC | #1
Hi,

subject is missing the prefix and the Signed-off-by line is missing.

	John

On 14/07/2015 11:38, Karl Vogel wrote:
> The OpenWRT GCC patch, 910-mbsd_multi.patch adds an extra option
> to gcc that depends on an environment variable. Standard ccache
> is unaware of this option and therefor can produce stdout from gcc
> that doesn't correspond to what you would get if you actually
> do a direct compilation with gcc.
> 
> This commit adds a patch to ccache to make it aware of the new
> option and removes the feature from the ccache package to use the
> host system's installed ccache binary.
> ---
>  tools/ccache/Makefile                       | 24 ++++------------------
>  tools/ccache/patches/100-honour-copts.patch | 31 +++++++++++++++++++++++++++++
>  2 files changed, 35 insertions(+), 20 deletions(-)
>  create mode 100644 tools/ccache/patches/100-honour-copts.patch
> 
> diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
> index 9020c9c..75c5f8c 100644
> --- a/tools/ccache/Makefile
> +++ b/tools/ccache/Makefile
> @@ -24,29 +24,13 @@ define Host/Install/ccache
>  	$(CP) ./files/* $(STAGING_DIR_HOST)/bin/
>  endef
>  
> -ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
> -  define Host/Clean
> +define Host/Clean
>  	-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
>  	$(call Host/Clean/Default)
> -  endef
> -  define Host/Install
> +endef
> +define Host/Install
>  	$(call Host/Install/Default)
>  	$(call Host/Install/ccache)
> -  endef
> -else
> -  define Host/Prepare
> -  endef
> -  define Host/Configure
> -  endef
> -  define Host/Compile
> -  endef
> -  define Host/Install
> -	$(call Host/Install/ccache)
> -  endef
> -  define Host/Clean
> -  endef
> -  define Download
> -  endef
> -endif
> +endef
>  
>  $(eval $(call HostBuild))
> diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch
> new file mode 100644
> index 0000000..9182d33
> --- /dev/null
> +++ b/tools/ccache/patches/100-honour-copts.patch
> @@ -0,0 +1,31 @@
> +From 135d868c539f994afbcf80d313ba2e39f031d3b1 Mon Sep 17 00:00:00 2001
> +From: Karl Vogel <karl.vogel@gmail.com>
> +Date: Tue, 14 Jul 2015 11:05:33 +0200
> +Subject: [PATCH] Include environment variable GCC_HONOUR_COPTS in hash.
> +
> +The OpenWRT patch, 910-mbsd_multi.patch, to GCC adds an extra
> +compilation flag, -fhonour-copts, which is influenced by an
> +environment variable called GCC_HONOUR_COPTS.
> +
> +Include this environment var in the hash calculation as otherwise
> +the gcc stdout warning from a previous compilation might be shown
> +where, even when GCC_HONOUR_COPTS is in 's'ilent mode.
> +---
> + ccache.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/ccache.c b/ccache.c
> +index e41af13..fa67ed2 100644
> +--- a/ccache.c
> ++++ b/ccache.c
> +@@ -965,6 +965,7 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode)
> + 			"CPLUS_INCLUDE_PATH",
> + 			"OBJC_INCLUDE_PATH",
> + 			"OBJCPLUS_INCLUDE_PATH", /* clang */
> ++                        "GCC_HONOUR_COPTS",
> + 			NULL
> + 		};
> + 		for (p = envvars; *p != NULL ; ++p) {
> +-- 
> +1.9.1
> +
>
Felix Fietkau July 14, 2015, 9:58 a.m. UTC | #2
On 2015-07-14 11:38, Karl Vogel wrote:
> The OpenWRT GCC patch, 910-mbsd_multi.patch adds an extra option
> to gcc that depends on an environment variable. Standard ccache
> is unaware of this option and therefor can produce stdout from gcc
> that doesn't correspond to what you would get if you actually
> do a direct compilation with gcc.
> 
> This commit adds a patch to ccache to make it aware of the new
> option and removes the feature from the ccache package to use the
> host system's installed ccache binary.
> ---
> +--- a/ccache.c
> ++++ b/ccache.c
> +@@ -965,6 +965,7 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode)
> + 			"CPLUS_INCLUDE_PATH",
> + 			"OBJC_INCLUDE_PATH",
> + 			"OBJCPLUS_INCLUDE_PATH", /* clang */
> ++                        "GCC_HONOUR_COPTS",
Indentation is broken here (whitespaces vs tabs).

- Felix
diff mbox

Patch

diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
index 9020c9c..75c5f8c 100644
--- a/tools/ccache/Makefile
+++ b/tools/ccache/Makefile
@@ -24,29 +24,13 @@  define Host/Install/ccache
 	$(CP) ./files/* $(STAGING_DIR_HOST)/bin/
 endef
 
-ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
-  define Host/Clean
+define Host/Clean
 	-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
 	$(call Host/Clean/Default)
-  endef
-  define Host/Install
+endef
+define Host/Install
 	$(call Host/Install/Default)
 	$(call Host/Install/ccache)
-  endef
-else
-  define Host/Prepare
-  endef
-  define Host/Configure
-  endef
-  define Host/Compile
-  endef
-  define Host/Install
-	$(call Host/Install/ccache)
-  endef
-  define Host/Clean
-  endef
-  define Download
-  endef
-endif
+endef
 
 $(eval $(call HostBuild))
diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch
new file mode 100644
index 0000000..9182d33
--- /dev/null
+++ b/tools/ccache/patches/100-honour-copts.patch
@@ -0,0 +1,31 @@ 
+From 135d868c539f994afbcf80d313ba2e39f031d3b1 Mon Sep 17 00:00:00 2001
+From: Karl Vogel <karl.vogel@gmail.com>
+Date: Tue, 14 Jul 2015 11:05:33 +0200
+Subject: [PATCH] Include environment variable GCC_HONOUR_COPTS in hash.
+
+The OpenWRT patch, 910-mbsd_multi.patch, to GCC adds an extra
+compilation flag, -fhonour-copts, which is influenced by an
+environment variable called GCC_HONOUR_COPTS.
+
+Include this environment var in the hash calculation as otherwise
+the gcc stdout warning from a previous compilation might be shown
+where, even when GCC_HONOUR_COPTS is in 's'ilent mode.
+---
+ ccache.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/ccache.c b/ccache.c
+index e41af13..fa67ed2 100644
+--- a/ccache.c
++++ b/ccache.c
+@@ -965,6 +965,7 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode)
+ 			"CPLUS_INCLUDE_PATH",
+ 			"OBJC_INCLUDE_PATH",
+ 			"OBJCPLUS_INCLUDE_PATH", /* clang */
++                        "GCC_HONOUR_COPTS",
+ 			NULL
+ 		};
+ 		for (p = envvars; *p != NULL ; ++p) {
+-- 
+1.9.1
+