summaryrefslogtreecommitdiffstats
path: root/scripts/ccache.sh
blob: 8756bc25b1ba8969143d54d03e4fd8b4db5942ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

export LC_ALL=C

mkdir -p "$HOME/.ccache" || exit 1

grep -sq max_size "$HOME/.ccache/ccache.conf" || \
	echo "max_size = 10.0G" >> "$HOME/.ccache/ccache.conf" || exit 1

grep -sq compiler_check "$HOME/.ccache/ccache.conf" || \
	echo "compiler_check = %compiler% -dumpmachine; %compiler% -dumpversion" >> "$HOME/.ccache/ccache.conf" || exit 1

for dir in $(make --no-print-directory val.TOOLCHAIN_DIR val.STAGING_DIR val.STAGING_DIR_HOST V=s | grep staging_dir/); do
	if [ ! -L "$dir/ccache" ] || [ -L "$dir/ccache" -a ! -d "$dir/ccache" ]; then
		mkdir -vp "$dir" || exit 1
		rm -vrf "$dir/ccache" || exit 1
		ln -vs "$HOME/.ccache" "$dir/ccache" || exit 1
	fi
done

exit 0