summaryrefslogtreecommitdiff
path: root/meta/classes/multilib_global.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/multilib_global.bbclass')
-rw-r--r--meta/classes/multilib_global.bbclass39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/classes/multilib_global.bbclass b/meta/classes/multilib_global.bbclass
new file mode 100644
index 0000000000..217349b2d4
--- /dev/null
+++ b/meta/classes/multilib_global.bbclass
@@ -0,0 +1,39 @@
+python multilib_virtclass_handler_global () {
+ if not e.data:
+ return
+
+ variant = e.data.getVar("BBEXTENDVARIANT", True)
+
+ if isinstance(e, bb.event.RecipeParsed) and not variant:
+ if bb.data.inherits_class('kernel', e.data) or bb.data.inherits_class('module-base', e.data) or bb.data.inherits_class('allarch', e.data):
+ origprovs = provs = e.data.getVar("PROVIDES", True)
+ variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split()
+ for variant in variants:
+ provs = provs + " " + multilib_map_variable("PROVIDES", variant, e.data)
+ e.data.setVar("PROVIDES", origprovs)
+ e.data.setVar("PROVIDES", provs)
+}
+
+addhandler multilib_virtclass_handler_global
+
+def multilib_extend_name(variant, name):
+ if name.startswith("virtual/"):
+ subs = name.split("/", 1)[1]
+ if not subs.startswith(variant):
+ return "virtual/" + variant + "-" + subs
+ return name
+ if not name.startswith(variant):
+ return variant + "-" + name
+ return name
+
+def multilib_map_variable(varname, variant, d):
+ var = d.getVar(varname, True)
+ if not var:
+ return
+ var = var.split()
+ newvar = []
+ for v in var:
+ newvar.append(multilib_extend_name(variant, v))
+ newdata = " ".join(newvar)
+ d.setVar(varname, newdata)
+ return newdata