diff options
-rw-r--r-- | meta/classes/ccache.bbclass | 25 | ||||
-rw-r--r-- | meta/conf/bitbake.conf | 6 | ||||
-rw-r--r-- | meta/conf/layer.conf | 1 | ||||
-rw-r--r-- | meta/lib/oe/utils.py | 3 |
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 @@ | |||
1 | CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}" | 1 | # |
2 | # Usage: | ||
3 | # - Enable ccache | ||
4 | # Add the following line to a conffile such as conf/local.conf: | ||
5 | # INHERIT += "ccache" | ||
6 | # | ||
7 | # - Disable ccache for a recipe | ||
8 | # Add the following line to the recipe if it can't be built with ccache: | ||
9 | # CCACHE_DISABLE = '1' | ||
10 | # | ||
11 | |||
2 | export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" | 12 | export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" |
3 | 13 | ||
4 | # We need to stop ccache considering the current directory or the | 14 | # We need to stop ccache considering the current directory or the |
@@ -7,5 +17,14 @@ export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" | |||
7 | # ${PV} or ${PR} change. | 17 | # ${PV} or ${PR} change. |
8 | export CCACHE_NOHASHDIR ?= "1" | 18 | export CCACHE_NOHASHDIR ?= "1" |
9 | 19 | ||
10 | DEPENDS_append_class-target = " ccache-native" | 20 | python() { |
11 | DEPENDS[vardepvalueexclude] = " ccache-native" | 21 | """ |
22 | Enable ccache for the recipe | ||
23 | """ | ||
24 | pn = d.getVar('PN') | ||
25 | # quilt-native doesn't need ccache since no c files | ||
26 | if not (pn in ('ccache-native', 'quilt-native') or | ||
27 | bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))): | ||
28 | d.appendVar('DEPENDS', ' ccache-native') | ||
29 | d.setVar('CCACHE', 'ccache ') | ||
30 | } | ||
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 += " \ | |||
492 | 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 ''}" | 492 | 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 ''}" |
493 | 493 | ||
494 | # Link to these if present | 494 | # Link to these if present |
495 | HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo" | 495 | HOSTTOOLS_NONFATAL += "aws gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo" |
496 | 496 | ||
497 | # Temporary add few more detected in bitbake world | 497 | # Temporary add few more detected in bitbake world |
498 | HOSTTOOLS_NONFATAL += "join nl size yes zcat" | 498 | HOSTTOOLS_NONFATAL += "join nl size yes zcat" |
@@ -504,10 +504,6 @@ HOSTTOOLS_NONFATAL += "bzr" | |||
504 | HOSTTOOLS_NONFATAL += "scp" | 504 | HOSTTOOLS_NONFATAL += "scp" |
505 | 505 | ||
506 | CCACHE ??= "" | 506 | CCACHE ??= "" |
507 | # ccache < 3.1.10 will create CCACHE_DIR on startup even if disabled, and | ||
508 | # autogen sets HOME=/dev/null so in certain situations builds can fail. | ||
509 | # Explicitly export CCACHE_DIR until we can assume ccache >3.1.10 on the host. | ||
510 | export CCACHE_DIR ??= "${@os.getenv('HOME')}/.ccache" | ||
511 | 507 | ||
512 | TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}" | 508 | TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}" |
513 | 509 | ||
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 += " \ | |||
49 | *->quilt-native \ | 49 | *->quilt-native \ |
50 | *->subversion-native \ | 50 | *->subversion-native \ |
51 | *->git-native \ | 51 | *->git-native \ |
52 | *->ccache-native \ | ||
53 | *->icecc-create-env-native \ | 52 | *->icecc-create-env-native \ |
54 | gcc-cross-${TARGET_ARCH}->linux-libc-headers \ | 53 | gcc-cross-${TARGET_ARCH}->linux-libc-headers \ |
55 | ppp-dialin->ppp \ | 54 | 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): | |||
363 | return | 363 | return |
364 | 364 | ||
365 | compiler = d.getVar("BUILD_CC") | 365 | compiler = d.getVar("BUILD_CC") |
366 | # Get rid of ccache since it is not present when parsing. | ||
367 | if compiler.startswith('ccache '): | ||
368 | compiler = compiler[7:] | ||
366 | try: | 369 | try: |
367 | env = os.environ.copy() | 370 | env = os.environ.copy() |
368 | env["PATH"] = d.getVar("PATH") | 371 | env["PATH"] = d.getVar("PATH") |