aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/ccache.bbclass25
-rw-r--r--meta/conf/bitbake.conf6
-rw-r--r--meta/conf/layer.conf1
-rw-r--r--meta/lib/oe/utils.py3
4 files changed, 26 insertions, 9 deletions
diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index 960902065c..59e1022678 100644
--- a/meta/classes/ccache.bbclass
+++ b/meta/classes/ccache.bbclass
@@ -1,4 +1,14 @@
-CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"
+#
+# Usage:
+# - Enable ccache
+# Add the following line to a conffile such as conf/local.conf:
+# INHERIT += "ccache"
+#
+# - Disable ccache for a recipe
+# Add the following line to the recipe if it can't be built with ccache:
+# CCACHE_DISABLE = '1'
+#
+
export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}"
# We need to stop ccache considering the current directory or the
@@ -7,5 +17,14 @@ export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}"
# ${PV} or ${PR} change.
export CCACHE_NOHASHDIR ?= "1"
-DEPENDS_append_class-target = " ccache-native"
-DEPENDS[vardepvalueexclude] = " ccache-native"
+python() {
+ """
+ Enable ccache for the recipe
+ """
+ pn = d.getVar('PN')
+ # quilt-native doesn't need ccache since no c files
+ if not (pn in ('ccache-native', 'quilt-native') or
+ bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))):
+ d.appendVar('DEPENDS', ' ccache-native')
+ d.setVar('CCACHE', 'ccache ')
+}
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 68700e9e7c..30bb35c2af 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -492,7 +492,7 @@ HOSTTOOLS += " \
HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}"
# Link to these if present
-HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo"
+HOSTTOOLS_NONFATAL += "aws gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo"
# Temporary add few more detected in bitbake world
HOSTTOOLS_NONFATAL += "join nl size yes zcat"
@@ -504,10 +504,6 @@ HOSTTOOLS_NONFATAL += "bzr"
HOSTTOOLS_NONFATAL += "scp"
CCACHE ??= ""
-# ccache < 3.1.10 will create CCACHE_DIR on startup even if disabled, and
-# autogen sets HOME=/dev/null so in certain situations builds can fail.
-# Explicitly export CCACHE_DIR until we can assume ccache >3.1.10 on the host.
-export CCACHE_DIR ??= "${@os.getenv('HOME')}/.ccache"
TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
index 7afccdf335..12e3956651 100644
--- a/meta/conf/layer.conf
+++ b/meta/conf/layer.conf
@@ -49,7 +49,6 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \
*->quilt-native \
*->subversion-native \
*->git-native \
- *->ccache-native \
*->icecc-create-env-native \
gcc-cross-${TARGET_ARCH}->linux-libc-headers \
ppp-dialin->ppp \
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 29b41151d4..ee6f0e6647 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -363,6 +363,9 @@ def host_gcc_version(d, taskcontextonly=False):
return
compiler = d.getVar("BUILD_CC")
+ # Get rid of ccache since it is not present when parsing.
+ if compiler.startswith('ccache '):
+ compiler = compiler[7:]
try:
env = os.environ.copy()
env["PATH"] = d.getVar("PATH")