diff options
Diffstat (limited to 'meta/classes/ccache.bbclass')
-rw-r--r-- | meta/classes/ccache.bbclass | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass index 4532894c57..f6bd972ff4 100644 --- a/meta/classes/ccache.bbclass +++ b/meta/classes/ccache.bbclass | |||
@@ -1,4 +1,10 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | # | ||
2 | # Usage: | 8 | # Usage: |
3 | # - Enable ccache | 9 | # - Enable ccache |
4 | # Add the following line to a conffile such as conf/local.conf: | 10 | # Add the following line to a conffile such as conf/local.conf: |
@@ -6,51 +12,49 @@ | |||
6 | # | 12 | # |
7 | # - Disable ccache for a recipe | 13 | # - Disable ccache for a recipe |
8 | # 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: |
9 | # CCACHE_DISABLE = '1' | 15 | # CCACHE_DISABLE = "1" |
10 | # | 16 | # |
11 | # - Share ccache files between different builds | 17 | # - Share ccache files between different builds |
12 | # Set CCACHE_TOP_DIR to a shared dir | 18 | # Set CCACHE_TOP_DIR to a shared dir |
13 | # CCACHE_TOP_DIR = /path/to/shared_ccache/ | 19 | # CCACHE_TOP_DIR = "/path/to/shared_ccache/" |
14 | # | 20 | # |
15 | # - TO debug ccahe | 21 | # - To debug ccache |
16 | # export CCACHE_DEBUG = "1" | 22 | # export CCACHE_DEBUG = "1" |
17 | # export CCACHE_LOGFILE = "${CCACHE_DIR}/logfile.log" | 23 | # export CCACHE_LOGFILE = "${CCACHE_DIR}/logfile.log" |
18 | # 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 |
19 | # | 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" | ||
20 | 31 | ||
21 | # 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 |
22 | # be shared between different builds. | 33 | # be shared between different builds. |
23 | CCACHE_TOP_DIR ?= "${TMPDIR}/ccache" | 34 | CCACHE_TOP_DIR ?= "${TMPDIR}/ccache" |
24 | 35 | ||
36 | # ccache-native and cmake-native have a circular dependency | ||
37 | # that affects other native recipes, but not all. | ||
38 | # Allows to use ccache in specified native recipes. | ||
39 | CCACHE_NATIVE_RECIPES_ALLOWED ?= "" | ||
40 | |||
25 | # ccahe removes CCACHE_BASEDIR from file path, so that hashes will be the same | 41 | # ccahe removes CCACHE_BASEDIR from file path, so that hashes will be the same |
26 | # in different builds. | 42 | # in different builds. |
27 | export CCACHE_BASEDIR ?= "${TMPDIR}" | 43 | export CCACHE_BASEDIR ?= "${TMPDIR}" |
28 | 44 | ||
29 | # Used for sharing cache files after compiler is rebuilt | ||
30 | export CCACHE_COMPILERCHECK ?= "%compiler% -dumpspecs" | ||
31 | |||
32 | export CCACHE_CONFIGPATH ?= "${COREBASE}/meta/conf/ccache.conf" | 45 | export CCACHE_CONFIGPATH ?= "${COREBASE}/meta/conf/ccache.conf" |
33 | 46 | ||
34 | export CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${MULTIMACH_TARGET_SYS}/${PN}" | 47 | export CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${MULTIMACH_TARGET_SYS}/${PN}" |
35 | 48 | ||
36 | # Fixed errors: | ||
37 | # ccache: error: Failed to create directory /run/user/0/ccache-tmp: Permission denied | ||
38 | export CCACHE_TEMPDIR ?= "${CCACHE_DIR}/tmp" | ||
39 | |||
40 | # We need to stop ccache considering the current directory or the | ||
41 | # debug-prefix-map target directory to be significant when calculating | ||
42 | # its hash. Without this the cache would be invalidated every time | ||
43 | # ${PV} or ${PR} change. | ||
44 | export CCACHE_NOHASHDIR ?= "1" | ||
45 | |||
46 | python() { | 49 | python() { |
47 | """ | 50 | """ |
48 | Enable ccache for the recipe | 51 | Enable ccache for the recipe |
49 | """ | 52 | """ |
50 | pn = d.getVar('PN') | 53 | pn = d.getVar('PN') |
51 | # quilt-native doesn't need ccache since no c files | 54 | if (not bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')) and |
52 | if not (bb.data.inherits_class("native", d) or | 55 | ("ccache" in d.getVar("HOSTTOOLS").split() or |
53 | 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))): | ||
54 | d.appendVar('DEPENDS', ' ccache-native') | 58 | d.appendVar('DEPENDS', ' ccache-native') |
55 | d.setVar('CCACHE', 'ccache ') | 59 | d.setVar('CCACHE', 'ccache ') |
56 | } | 60 | } |