Commit 792f1278 authored by Arnout Vandecappelle's avatar Arnout Vandecappelle Committed by Peter Korsgaard
Browse files

toolchain-wrapper: support change of BR2_CCACHE



By moving the ccache call to the toolchain wrapper, the following
scenario no longer works:

make foo-dirclean all BR2_CCACHE=

That's a sometimes useful call to check if some failure is perhaps
caused by ccache.

We can enable this scenario again by exporting BR_NO_CCACHE when
BR2_CCACHE is not set, and by handling this in the toolchain wrapper.

Signed-off-by: default avatarArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: default avatarRomain Naour <romain.naour@openwide.fr>
Reviewed-by: default avatarRomain Naour <romain.naour@openwide.fr>
Signed-off-by: default avatarPeter Korsgaard <peter@korsgaard.com>
parent 2b356105
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -375,6 +375,8 @@ BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
export BR_CACHE_DIR
HOSTCC := $(CCACHE) $(HOSTCC)
HOSTCXX := $(CCACHE) $(HOSTCXX)
else
export BR_NO_CCACHE
endif

# Scripts in support/ or post-build scripts may need to reference
+11 −4
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static void check_unsafe_path(const char *path, int paranoid)

int main(int argc, char **argv)
{
	char **args, **cur;
	char **args, **cur, **exec_args;
	char *relbasedir, *absbasedir;
	char *progpath = argv[0];
	char *basename;
@@ -247,6 +247,13 @@ int main(int argc, char **argv)
	/* finish with NULL termination */
	*cur = NULL;

	exec_args = args;
#ifdef BR_CCACHE
	if (getenv("BR_NO_CCACHE"))
		/* Skip the ccache call */
		exec_args++;
#endif

	/* Debug the wrapper to see actual arguments passed to
	 * the compiler:
	 * unset, empty, or 0: do not trace
@@ -257,14 +264,14 @@ int main(int argc, char **argv)
		debug = atoi(env_debug);
		if (debug > 0) {
			fprintf(stderr, "Toolchain wrapper executing:");
			for (i = 0; args[i]; i++)
			for (i = 0; exec_args[i]; i++)
				fprintf(stderr, "%s'%s'",
					(debug == 2) ? "\n    " : " ", args[i]);
					(debug == 2) ? "\n    " : " ", exec_args[i]);
			fprintf(stderr, "\n");
		}
	}

	if (execv(args[0], args))
	if (execv(exec_args[0], exec_args))
		perror(path);

	free(args);