From b9d7841a4749e46634000435b20b1e0c0b9cfb79 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 4 Dec 2022 13:39:47 +0100 Subject: [PATCH 1/2] options: automatically use ccache on build host if it's available Use of ccache on build host is now controlled by the LOCAL_CCACHE_SUPPORT option. Setting it to "no" will disable use of local ccache. Signed-off-by: Matthias Reichl --- config/options | 12 ++++++++++++ distributions/LibreELEC/options | 3 +++ 2 files changed, 15 insertions(+) diff --git a/config/options b/config/options index 221463edf9..7e906188f1 100644 --- a/config/options +++ b/config/options @@ -125,6 +125,18 @@ if [ -f "${HOME}/.libreelec/options" ]; then . "${HOME}/.libreelec/options" fi +if [ "${LOCAL_CCACHE_SUPPORT}" = "yes" ] && [ -z "${CCACHE_DISABLE}" ]; then + # like LOCAL_CC check for local ccache only on the very first + # call to config/options, before toolchain has been added to the path, + # otherwise we might pick up ccache from toolchain/bin here + if [ -z "${LOCAL_CCACHE}" ] && [ "${LOCAL_CCACHE_CHECKED}" != "yes" ]; then + export LOCAL_CCACHE="$(command -v ccache)" + export LOCAL_CCACHE_CHECKED="yes" + fi +else + export LOCAL_CCACHE="" +fi + # overwrite OEM_SUPPORT via commandline if [ "${OEM}" = "yes" -o "${OEM}" = "no" ]; then OEM_SUPPORT="${OEM}" diff --git a/distributions/LibreELEC/options b/distributions/LibreELEC/options index 67402796fc..bcffbf2b04 100644 --- a/distributions/LibreELEC/options +++ b/distributions/LibreELEC/options @@ -44,6 +44,9 @@ # Default supported get handlers (archive, git, file etc.) GET_HANDLER_SUPPORT="archive" +# use local ccache on build host, if available, for early package +# builds before ccache has been built + LOCAL_CCACHE_SUPPORT="yes" ### OS CONFIGURATION ### From 6956b5f6056bc63097ce6168fc05c488e37919a0 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 4 Dec 2022 15:58:03 +0100 Subject: [PATCH 2/2] config/show_config: add local ccache info Signed-off-by: Matthias Reichl --- config/show_config | 1 + 1 file changed, 1 insertion(+) diff --git a/config/show_config b/config/show_config index 82029ff957..9ca1daec4a 100644 --- a/config/show_config +++ b/config/show_config @@ -37,6 +37,7 @@ show_config() { config_message+="\n - DEBUG:\t\t\t\t ${DEBUG:-no}" config_message+="\n - CFLAGS:\t\t\t\t ${TARGET_CFLAGS}" config_message+="\n - LDFLAGS:\t\t\t\t ${TARGET_LDFLAGS}" + config_message+="\n - Local ccache:\t\t\t ${LOCAL_CCACHE:-no}" # Misc. hardware configuration