From 627b7c9829de9a22bace0ab20a16409d761a9661 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 1 Dec 2022 15:13:57 +0100 Subject: [PATCH] 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 --- config/functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/functions b/config/functions index cc287404eb..a03dbb490b 100644 --- a/config/functions +++ b/config/functions @@ -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++"