diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-07-09 16:38:57 +0300 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-07-09 16:42:57 +0300 |
commit | 081e495715a06ad0074ea00c1e24b828a394c70d (patch) | |
tree | 27690f5eba57cbbd8a23983a60c34b1f933257e3 | |
parent | 49d39d48a6a25571e7ec3d6ff04579b3bf1d720a (diff) |
functions.sh: improve ccache utilization
Use a global ccache directory, share objects across buildroots and identify
compilers by supported machine and version.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rwxr-xr-x | shared/functions.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/shared/functions.sh b/shared/functions.sh index ba3015e..3cf79be 100755 --- a/shared/functions.sh +++ b/shared/functions.sh @@ -128,6 +128,10 @@ prepare_sdk() { rm -rf "$CACHE_DIR/sdk/$target/feeds" ln -sf "$CACHE_DIR/feeds" "$CACHE_DIR/sdk/$target/feeds" + mkdir -p "$CACHE_DIR/ccache" + rm -rf "$CACHE_DIR/sdk/$target/staging_dir/target-"*"/ccache" + ln -sf "$CACHE_DIR/ccache" "$CACHE_DIR/sdk/$target/staging_dir/target-"* + ( cd "$CACHE_DIR/sdk/$target" git init . @@ -228,7 +232,7 @@ compile_sdk_packages() { flock -x 9 cd "$CACHE_DIR/sdk/$target" - if ! make "package/$pkg/download" >/dev/null 2>/dev/null; then + if ! make "package/$pkg/download" BUILD_LOG=1 >/dev/null 2>/dev/null; then echo " * [$slot:$target] make package/$pkg/download - FAILED!" fi ) 9>"$CACHE_DIR/download.lock" 2>/dev/null @@ -236,7 +240,11 @@ compile_sdk_packages() { echo " * [$slot:$target] make package/$pkg/compile" ( cd "$CACHE_DIR/sdk/$target" - if ! make "package/$pkg/compile" IGNORE_ERRORS=y >/dev/null 2>/dev/null; then + if ! make "package/$pkg/compile" \ + BUILD_LOG=1 IGNORE_ERRORS=y \ + CCACHE_COMPILERCHECK="%compiler% -dumpmachine; %compiler% -dumpversion" \ + >/dev/null 2>/dev/null; + then echo " * [$slot:$target] make package/$pkg/compile - FAILED!" fi ) |