summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/multilib.bbclass39
-rw-r--r--meta/classes/multilib_global.bbclass39
-rw-r--r--meta/conf/multilib.conf2
3 files changed, 53 insertions, 27 deletions
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index 5d975fd33e..583d76b0f3 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -6,12 +6,17 @@ python multilib_virtclass_handler () {
6 variant = e.data.getVar("BBEXTENDVARIANT", True) 6 variant = e.data.getVar("BBEXTENDVARIANT", True)
7 if cls != "multilib" or not variant: 7 if cls != "multilib" or not variant:
8 return 8 return
9
10 # There should only be one kernel in multilib configs
11 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):
12 raise bb.parse.SkipPackage("We shouldn't have multilib variants for the kernel")
13
9 save_var_name=e.data.getVar("MULTILIB_SAVE_VARNAME", True) or "" 14 save_var_name=e.data.getVar("MULTILIB_SAVE_VARNAME", True) or ""
10 for name in save_var_name.split(): 15 for name in save_var_name.split():
11 val=e.data.getVar(name, True) 16 val=e.data.getVar(name, True)
12 if val: 17 if val:
13 e.data.setVar(name + "_MULTILIB_ORIGINAL", val) 18 e.data.setVar(name + "_MULTILIB_ORIGINAL", val)
14 19
15 override = ":virtclass-multilib-" + variant 20 override = ":virtclass-multilib-" + variant
16 21
17 e.data.setVar("MLPREFIX", variant + "-") 22 e.data.setVar("MLPREFIX", variant + "-")
@@ -28,16 +33,6 @@ STAGINGCC_prepend = "${BBEXTENDVARIANT}-"
28python __anonymous () { 33python __anonymous () {
29 variant = d.getVar("BBEXTENDVARIANT", True) 34 variant = d.getVar("BBEXTENDVARIANT", True)
30 35
31 def extend_name(name):
32 if name.startswith("virtual/"):
33 subs = name.split("/", 1)[1]
34 if not subs.startswith(variant):
35 return "virtual/" + variant + "-" + subs
36 return name
37 if not name.startswith(variant):
38 return variant + "-" + name
39 return name
40
41 def map_dependencies(varname, d, suffix = ""): 36 def map_dependencies(varname, d, suffix = ""):
42 if suffix: 37 if suffix:
43 varname = varname + "_" + suffix 38 varname = varname + "_" + suffix
@@ -50,25 +45,15 @@ python __anonymous () {
50 if dep.endswith(("-native", "-native-runtime")): 45 if dep.endswith(("-native", "-native-runtime")):
51 newdeps.append(dep) 46 newdeps.append(dep)
52 else: 47 else:
53 newdeps.append(extend_name(dep)) 48 newdeps.append(multilib_extend_name(variant, dep))
54 d.setVar(varname, " ".join(newdeps)) 49 d.setVar(varname, " ".join(newdeps))
55 50
56 def map_variable(varname, d):
57 var = d.getVar(varname, True)
58 if not var:
59 return
60 var = var.split()
61 newvar = []
62 for v in var:
63 newvar.append(extend_name(v))
64 d.setVar(varname, " ".join(newvar))
65
66 pkgs_mapping = [] 51 pkgs_mapping = []
67 for pkg in (d.getVar("PACKAGES", True) or "").split(): 52 for pkg in (d.getVar("PACKAGES", True) or "").split():
68 if pkg.startswith(variant): 53 if pkg.startswith(variant):
69 pkgs_mapping.append([pkg.split(variant + "-")[1], pkg]) 54 pkgs_mapping.append([pkg.split(variant + "-")[1], pkg])
70 continue 55 continue
71 pkgs_mapping.append([pkg, extend_name(pkg)]) 56 pkgs_mapping.append([pkg, multilib_extend_name(variant, pkg)])
72 57
73 d.setVar("PACKAGES", " ".join([row[1] for row in pkgs_mapping])) 58 d.setVar("PACKAGES", " ".join([row[1] for row in pkgs_mapping]))
74 59
@@ -87,8 +72,8 @@ python __anonymous () {
87 map_dependencies("RCONFLICTS", d, pkg) 72 map_dependencies("RCONFLICTS", d, pkg)
88 map_dependencies("PKG", d, pkg) 73 map_dependencies("PKG", d, pkg)
89 74
90 map_variable("PROVIDES", d) 75 multilib_map_variable("PROVIDES", variant, d)
91 map_variable("PACKAGES_DYNAMIC", d) 76 multilib_map_variable("PACKAGES_DYNAMIC", variant, d)
92 map_variable("PACKAGE_INSTALL", d) 77 multilib_map_variable("PACKAGE_INSTALL", variant, d)
93 map_variable("INITSCRIPT_PACKAGES", d) 78 multilib_map_variable("INITSCRIPT_PACKAGES", variant, d)
94} 79}
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 @@
1python multilib_virtclass_handler_global () {
2 if not e.data:
3 return
4
5 variant = e.data.getVar("BBEXTENDVARIANT", True)
6
7 if isinstance(e, bb.event.RecipeParsed) and not variant:
8 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):
9 origprovs = provs = e.data.getVar("PROVIDES", True)
10 variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split()
11 for variant in variants:
12 provs = provs + " " + multilib_map_variable("PROVIDES", variant, e.data)
13 e.data.setVar("PROVIDES", origprovs)
14 e.data.setVar("PROVIDES", provs)
15}
16
17addhandler multilib_virtclass_handler_global
18
19def multilib_extend_name(variant, name):
20 if name.startswith("virtual/"):
21 subs = name.split("/", 1)[1]
22 if not subs.startswith(variant):
23 return "virtual/" + variant + "-" + subs
24 return name
25 if not name.startswith(variant):
26 return variant + "-" + name
27 return name
28
29def multilib_map_variable(varname, variant, d):
30 var = d.getVar(varname, True)
31 if not var:
32 return
33 var = var.split()
34 newvar = []
35 for v in var:
36 newvar.append(multilib_extend_name(variant, v))
37 newdata = " ".join(newvar)
38 d.setVar(varname, newdata)
39 return newdata
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
index babf191669..eec1da79c9 100644
--- a/meta/conf/multilib.conf
+++ b/meta/conf/multilib.conf
@@ -9,6 +9,8 @@ MULTILIBS ??= "multilib:lib32"
9STAGING_DIR_HOST = "${STAGING_DIR}/${MLPREFIX}${MACHINE}" 9STAGING_DIR_HOST = "${STAGING_DIR}/${MLPREFIX}${MACHINE}"
10STAGING_DIR_TARGET = "${STAGING_DIR}/${MLPREFIX}${MACHINE}" 10STAGING_DIR_TARGET = "${STAGING_DIR}/${MLPREFIX}${MACHINE}"
11 11
12INHERIT += "multilib_global"
13
12BBCLASSEXTEND_append_pn-acl = " ${MULTILIBS}" 14BBCLASSEXTEND_append_pn-acl = " ${MULTILIBS}"
13BBCLASSEXTEND_append_pn-alsa-lib = " ${MULTILIBS}" 15BBCLASSEXTEND_append_pn-alsa-lib = " ${MULTILIBS}"
14BBCLASSEXTEND_append_pn-alsa-utils = " ${MULTILIBS}" 16BBCLASSEXTEND_append_pn-alsa-utils = " ${MULTILIBS}"