summaryrefslogtreecommitdiffstats
path: root/meta/classes/ccache.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/ccache.bbclass')
-rw-r--r--meta/classes/ccache.bbclass31
1 files changed, 12 insertions, 19 deletions
diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index 262db6672c..f6bd972ff4 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.
@@ -37,31 +42,19 @@ CCACHE_NATIVE_RECIPES_ALLOWED ?= ""
37# in different builds. 42# in different builds.
38export CCACHE_BASEDIR ?= "${TMPDIR}" 43export CCACHE_BASEDIR ?= "${TMPDIR}"
39 44
40# Used for sharing cache files after compiler is rebuilt
41export CCACHE_COMPILERCHECK ?= "%compiler% -dumpspecs"
42
43export CCACHE_CONFIGPATH ?= "${COREBASE}/meta/conf/ccache.conf" 45export CCACHE_CONFIGPATH ?= "${COREBASE}/meta/conf/ccache.conf"
44 46
45export CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${MULTIMACH_TARGET_SYS}/${PN}" 47export CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${MULTIMACH_TARGET_SYS}/${PN}"
46 48
47# Fixed errors:
48# ccache: error: Failed to create directory /run/user/0/ccache-tmp: Permission denied
49export CCACHE_TEMPDIR ?= "${CCACHE_DIR}/tmp"
50
51# We need to stop ccache considering the current directory or the
52# debug-prefix-map target directory to be significant when calculating
53# its hash. Without this the cache would be invalidated every time
54# ${PV} or ${PR} change.
55export CCACHE_NOHASHDIR ?= "1"
56
57python() { 49python() {
58 """ 50 """
59 Enable ccache for the recipe 51 Enable ccache for the recipe
60 """ 52 """
61 pn = d.getVar('PN') 53 pn = d.getVar('PN')
62 if (pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or 54 if (not bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')) and
63 not (bb.data.inherits_class("native", d) or 55 ("ccache" in d.getVar("HOSTTOOLS").split() or
64 bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')))): 56 pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or
57 not bb.data.inherits_class("native", d))):
65 d.appendVar('DEPENDS', ' ccache-native') 58 d.appendVar('DEPENDS', ' ccache-native')
66 d.setVar('CCACHE', 'ccache ') 59 d.setVar('CCACHE', 'ccache ')
67} 60}