mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-05 14:09:53 +03:00
ccache: support changing the output directory
When building in a different output directory than the original build, there will currently be a lot of ccache misses because in many cases there is some -I/... absolute path in the compilation. Ccache has an option CCACHE_BASEDIR to substitute absolute paths with relative paths, so they wil be the same in the hash (and in the output). Since there are some disadvantages to this path rewriting, it is made optional as BR2_CCACHE_USE_BASEDIR. It defaults to y because the usefulness of ccache is severely reduced without this option. In addition to CCACHE_BASEDIR, we also substitute away the occurences of $(HOST_DIR) in the calculation of the compiler hash. This is done regardless of the setting of BR2_CCACHE_USE_BASEDIR because it's quite harmless. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
f4682cf933
commit
1e97b27873
@@ -267,6 +267,10 @@ int main(int argc, char **argv)
|
||||
#ifdef BR_CCACHE_HASH
|
||||
fprintf(stderr, "%sCCACHE_COMPILERCHECK='string:" BR_CCACHE_HASH "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
#endif
|
||||
#ifdef BR_CCACHE_BASEDIR
|
||||
fprintf(stderr, "%sCCACHE_BASEDIR='" BR_CCACHE_BASEDIR "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
#endif
|
||||
for (i = 0; exec_args[i]; i++)
|
||||
fprintf(stderr, "%s'%s'",
|
||||
@@ -282,6 +286,13 @@ int main(int argc, char **argv)
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
#ifdef BR_CCACHE_BASEDIR
|
||||
/* Allow compilercheck to be overridden through the environment */
|
||||
if (setenv("CCACHE_BASEDIR", BR_CCACHE_BASEDIR, 0)) {
|
||||
perror(__FILE__ ": Failed to set CCACHE_BASEDIR");
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (execv(exec_args[0], exec_args))
|
||||
perror(path);
|
||||
|
||||
Reference in New Issue
Block a user