phase1, phase2: add unified ccache handling
[buildbot.git] / phase1 / ccache.sh
1 #!/usr/bin/env bash
2
3 export LC_ALL=C
4
5 mkdir -p "$HOME/.ccache"
6
7 grep -sq max_size "$HOME/.ccache/ccache.conf" || \
8 echo "max_size = 10.0G" >> "$HOME/.ccache/ccache.conf"
9
10 grep -sq compiler_check "$HOME/.ccache/ccache.conf" || \
11 echo "compiler_check = %compiler% -dumpmachine; %compiler% -dumpversion" >> "$HOME/.ccache/ccache.conf"
12
13 for dir in $(make --no-print-directory val.TOOLCHAIN_DIR val.STAGING_DIR val.STAGING_DIR_HOST V=s | grep staging_dir/); do
14 mkdir -p "$dir"
15 test -L "$dir/ccache" || rm -rf "$dir/ccache"
16 ln -s "$HOME/.ccache" "$dir/ccache"
17 done
18
19 ./staging_dir/host/bin/ccache -s 2>/dev/null
20
21 exit 0