summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-05-19 13:59:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-04 18:04:03 +0100
commit1722c4162c6c0830fa86461dd626d5385765b02c (patch)
tree16b29c7cb548006f84cee29e2dd6d174f8d55f48
parent094349b4c429d04cbd3d11ecdcd365e9504984ed (diff)
downloadpoky-1722c4162c6c0830fa86461dd626d5385765b02c.tar.gz
ccache: enable ccache for all recipes if it is in HOSTTOOLS
At the moment we don't allow ccache for native recipes to avoid the dependency loop of native recipes needing ccache-native which then depends on itself. One way to avoid this dependency loop is to just provide a host ccache, so enable ccache globally if ccache is in HOSTTOOLS. This isn't set out of the box, but does work. (From OE-Core rev: cc91a0f6500e88dd96a56307226fcfd16c60c342) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/ccache.bbclass14
1 files changed, 10 insertions, 4 deletions
diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index 7daaa7e3aa..5ce23e50f3 100644
--- a/meta/classes/ccache.bbclass
+++ b/meta/classes/ccache.bbclass
@@ -12,17 +12,22 @@
12# 12#
13# - Disable ccache for a recipe 13# - Disable ccache for a recipe
14# Add the following line to the recipe if it can't be built with ccache: 14# Add the following line to the recipe if it can't be built with ccache:
15# CCACHE_DISABLE = '1' 15# CCACHE_DISABLE = "1"
16# 16#
17# - Share ccache files between different builds 17# - Share ccache files between different builds
18# Set CCACHE_TOP_DIR to a shared dir 18# Set CCACHE_TOP_DIR to a shared dir
19# CCACHE_TOP_DIR = /path/to/shared_ccache/ 19# CCACHE_TOP_DIR = "/path/to/shared_ccache/"
20# 20#
21# - TO debug ccahe 21# - To debug ccache
22# export CCACHE_DEBUG = "1" 22# export CCACHE_DEBUG = "1"
23# export CCACHE_LOGFILE = "${CCACHE_DIR}/logfile.log" 23# export CCACHE_LOGFILE = "${CCACHE_DIR}/logfile.log"
24# And also set PARALLEL_MAKE = "-j 1" to get make the log in order 24# And also set PARALLEL_MAKE = "-j 1" to get make the log in order
25# 25#
26# By default this class will only use ccache for target builds, and build
27# our own ccache-native. It is possible to use a host-provided ccache that
28# can then be used by native recipes too by setting:
29# ASSUME_PROVIDED += "ccache-native"
30# HOSTTOOLS += "ccache"
26 31
27# Set it to a shared location for different builds, so that cache files can 32# Set it to a shared location for different builds, so that cache files can
28# be shared between different builds. 33# be shared between different builds.
@@ -46,7 +51,8 @@ python() {
46 Enable ccache for the recipe 51 Enable ccache for the recipe
47 """ 52 """
48 pn = d.getVar('PN') 53 pn = d.getVar('PN')
49 if (pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or 54 if ("ccache" in d.getVar("HOSTTOOLS").split() or
55 pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or
50 not (bb.data.inherits_class("native", d) or 56 not (bb.data.inherits_class("native", d) or
51 bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')))): 57 bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')))):
52 d.appendVar('DEPENDS', ' ccache-native') 58 d.appendVar('DEPENDS', ' ccache-native')