From: Angelo Ribeiro <angelo.ribe...@criticaltechworks.com>

Native recipes are not able to use ccache currently, due to a circular
dependency between ccache-native and cmake-native.
This affects also other native recipes, but not all, imposing a
limitation in build time optimizations.

The introduction of CCACHE_NATIVE_RECIPES_ALLOWED allows the user to specify
which native recipes should use ccache, keeping it disable by default for all
native recipes.

Signed-off-by: Angelo Ribeiro <angelo.ribe...@criticaltechworks.com>
---
 meta/classes/ccache.bbclass  | 11 ++++++++---
 meta/conf/documentation.conf |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index 4532894c57..15eab11a0f 100644
--- a/meta/classes/ccache.bbclass
+++ b/meta/classes/ccache.bbclass
@@ -22,6 +22,11 @@
 # be shared between different builds.
 CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"

+# ccache-native and cmake-native have a circular dependency
+# that affects other native recipes, but not all.
+# Allows to use ccache in specified native recipes.
+CCACHE_NATIVE_RECIPES_ALLOWED ?= ""
+
 # ccahe removes CCACHE_BASEDIR from file path, so that hashes will be the same
 # in different builds.
 export CCACHE_BASEDIR ?= "${TMPDIR}"
@@ -48,9 +53,9 @@ python() {
     Enable ccache for the recipe
     """
     pn = d.getVar('PN')
-    # quilt-native doesn't need ccache since no c files
-    if not (bb.data.inherits_class("native", d) or
-            bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))):
+    if (pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or
+        not (bb.data.inherits_class("native", d) or
+        bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')))):
         d.appendVar('DEPENDS', ' ccache-native')
         d.setVar('CCACHE', 'ccache ')
 }
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index ab2addb321..362635fc9e 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -106,6 +106,7 @@ BUSYBOX_SPLIT_SUID[doc] = "For the BusyBox recipe, 
specifies whether to split th
 #C

 CACHE[doc]  = "The directory holding the cache of the metadata."
+CCACHE_NATIVE_RECIPES_ALLOWED[doc] = "A list of native recipes to use Ccache, 
this variable is useful to bypass a circular dependency between ccache-native 
and cmake-native that inhibits to use Ccache in other native recipes."
 CFLAGS[doc] = "Flags passed to the C compiler for the target system. This 
variable evaluates to the same as TARGET_CFLAGS."
 CLASSOVERRIDE[doc] = "An internal variable specifying the special class 
override that should currently apply (e.g. "class-target", "class-native", and 
so forth)."
 CLEANBROKEN[doc] = "Specifies if 'make clean' does not work for a recipe (and 
therefore the build system should not try to use it during do_configure)"
--
2.34.1

The information in this communication may contain confidential or legally 
privileged information. It is intended solely for the use of the individual or 
entity it addresses and others authorized to receive it. If you are not an 
intended recipient, you are hereby notified that any disclosure, copying, 
distribution or action in reliance on the contents of this information is 
strictly prohibited and may be unlawful. If you have received this 
communication by error, please notify us immediately by responding to this 
e-mail and then delete it from your system. Critical TechWorks is not liable 
for the proper and complete transmission of the information in this 
communication nor for any delay in its receipt

This e-mail is environmentally friendly, just like Critical TechWorks, which 
lives in a paper-free atmosphere. Therefore, please consider the environment 
before printing it!
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#186438): 
https://lists.openembedded.org/g/openembedded-core/message/186438
Mute This Topic: https://lists.openembedded.org/mt/100871881/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to