config/functions: support using local ccache for early builds

If LOCAL_CCACHE is set to the full path of ccache on the build host
it will be used for early stage host package builds, eg make and ccache
at the moment.

By default it uses a separate cache dir (.ccache-local) so that it
doesn't interfere with our ccache (which is typically a different
version). The location can be changed by setting LOCAL_CCACHE_DIR

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl 2022-12-01 15:13:57 +01:00
parent eea2b116d5
commit 627b7c9829

View File

@ -495,6 +495,11 @@ setup_toolchain() {
if [ "$1" = "host" ] && flag_enabled "local-cc" "no"; then
export CC="${LOCAL_CC}"
export CXX="${LOCAL_CXX}"
if [ -n "${LOCAL_CCACHE}" ]; then
export CCACHE_DIR="${LOCAL_CCACHE_DIR}"
export CC="${LOCAL_CCACHE} ${CC}";
export CXX="${LOCAL_CCACHE} ${CXX}";
fi
else
export CC="$TOOLCHAIN/bin/host-gcc"
export CXX="$TOOLCHAIN/bin/host-g++"