summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-07 17:27:03 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-27 16:15:21 +0100
commit5d9453049915db48ec4b5972e12287417ebb61a2 (patch)
tree723ff1389fef55dba797a15be90a70eac47d630d /meta/classes
parentb4ec5c27b51c15e8bde7ca2597329c4f5b801240 (diff)
downloadopenembedded-core-5d9453049915db48ec4b5972e12287417ebb61a2.tar.gz
openembedded-core-5d9453049915db48ec4b5972e12287417ebb61a2.tar.bz2
openembedded-core-5d9453049915db48ec4b5972e12287417ebb61a2.zip
multilib: Add support for compiling recipes against multiple ABIs
This patch adds the core multilib class which can be used along with a parameter specifying the mutlilib to use in BBCLASSEXTEND. The MLPREFIX variable is added and can be used in cases where its too difficult to dynmaically work out where a mutltilib prefix is needed to be added to a variable. This includes: * SHLIBSDIR and PACKAGE_ARCH fixes from Lianhao Lu. * PACKAGE_DYNAMIC mapping from Yu Ke * PACKAGE_INSTALL mapping from Yu Ke * RPROVIDES mapping from Yu Ke * TARGET_VENDOR fix from Mark Hatle * Ignorning *-native-runtime dependnecies as well as *-native from Yu Ke * Map PKG and ALLOW_EMPTY from Dongxiao Xu * Ensure RCONFLICTS and PKG field dependencies are remapped (from Dongxiao Xu) * Ensure PN and MLPREFIX are set at the same time to ensure consistent BPN values (Yu Ke) Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Xu Dongxiao <dongxiao.xu@intel.com> Signed-off-by: Lianhao Lu <lianhao.lu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/autotools.bbclass2
-rw-r--r--meta/classes/cross.bbclass1
-rw-r--r--meta/classes/insane.bbclass3
-rw-r--r--meta/classes/multilib.bbclass89
-rw-r--r--meta/classes/package.bbclass11
5 files changed, 103 insertions, 3 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index ed5637ef3b..e5c13ae691 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -9,7 +9,7 @@ def autotools_dep_prepend(d):
return deps
deps += 'autoconf-native automake-native help2man-native '
- if not pn in ['libtool', 'libtool-native', 'libtool-cross']:
+ if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
deps += 'libtool-native '
if not bb.data.inherits_class('native', d) \
and not bb.data.inherits_class('cross', d) \
diff --git a/meta/classes/cross.bbclass b/meta/classes/cross.bbclass
index 050d63e412..e19614f280 100644
--- a/meta/classes/cross.bbclass
+++ b/meta/classes/cross.bbclass
@@ -54,4 +54,3 @@ do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE
do_install () {
oe_runmake 'DESTDIR=${D}' install
}
-
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index d56c9edcc2..5fb0d98baf 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -571,12 +571,13 @@ Rerun configure task after fixing this. The path was '%s'""" % root)
cnf = bb.data.getVar('EXTRA_OECONF', d, True) or ""
if "gettext" not in bb.data.getVar('P', d, True) and "gcc-runtime" not in bb.data.getVar('P', d, True) and "--disable-nls" not in cnf:
+ ml = d.getVar("MLPREFIX", True) or ""
if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('nativesdk', d):
gt = "gettext-native"
elif bb.data.inherits_class('cross-canadian', d):
gt = "gettext-nativesdk"
else:
- gt = "virtual/gettext"
+ gt = "virtual/" + ml + "gettext"
deps = bb.utils.explode_deps(bb.data.getVar('DEPENDS', d, True) or "")
if gt not in deps:
for config in configs:
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
new file mode 100644
index 0000000000..6e1669fb7f
--- /dev/null
+++ b/meta/classes/multilib.bbclass
@@ -0,0 +1,89 @@
+python multilib_virtclass_handler () {
+ if not isinstance(e, bb.event.RecipePreFinalise):
+ return
+
+ cls = e.data.getVar("BBEXTENDCURR", True)
+ variant = e.data.getVar("BBEXTENDVARIANT", True)
+ if cls != "multilib" or not variant:
+ return
+
+ override = ":virtclass-multilib-" + variant
+
+ e.data.setVar("MLPREFIX", variant + "-")
+ e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
+ e.data.setVar("SHLIBSDIR_virtclass-multilib-" + variant ,e.data.getVar("SHLIBSDIR", False) + "/" + variant)
+ e.data.setVar("TARGET_VENDOR_virtclass-multilib-" + variant, e.data.getVar("TARGET_VENDOR", False) + "ml" + variant)
+ e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
+}
+
+addhandler multilib_virtclass_handler
+
+STAGINGCC_prepend = "${BBEXTENDVARIANT}-"
+
+python __anonymous () {
+ variant = d.getVar("BBEXTENDVARIANT", True)
+
+ def extend_name(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 map_dependencies(varname, d, suffix = ""):
+ if suffix:
+ varname = varname + "_" + suffix
+ deps = d.getVar(varname, True)
+ if not deps:
+ return
+ deps = bb.utils.explode_deps(deps)
+ newdeps = []
+ for dep in deps:
+ if dep.endswith(("-native", "-native-runtime")):
+ newdeps.append(dep)
+ else:
+ newdeps.append(extend_name(dep))
+ d.setVar(varname, " ".join(newdeps))
+
+ def map_variable(varname, d):
+ var = d.getVar(varname, True)
+ if not var:
+ return
+ var = var.split()
+ newvar = []
+ for v in var:
+ newvar.append(extend_name(v))
+ d.setVar(varname, " ".join(newvar))
+
+ pkgs = []
+ pkgrename = {}
+ for pkg in (d.getVar("PACKAGES", True) or "").split():
+ if pkg.startswith(variant):
+ pkgs.append(pkg)
+ continue
+ pkgrename[pkg] = extend_name(pkg)
+ pkgs.append(pkgrename[pkg])
+
+ if pkgrename:
+ d.setVar("PACKAGES", " ".join(pkgs))
+ for pkg in pkgrename:
+ for subs in ["FILES", "RDEPENDS", "RRECOMMENDS", "SUMMARY", "DESCRIPTION", "RSUGGESTS", "RPROVIDES", "RCONFLICTS", "PKG", "ALLOW_EMPTY"]:
+ d.renameVar("%s_%s" % (subs, pkg), "%s_%s" % (subs, pkgrename[pkg]))
+
+ map_dependencies("DEPENDS", d)
+ for pkg in (d.getVar("PACKAGES", True).split() + [""]):
+ map_dependencies("RDEPENDS", d, pkg)
+ map_dependencies("RRECOMMENDS", d, pkg)
+ map_dependencies("RSUGGESTS", d, pkg)
+ map_dependencies("RPROVIDES", d, pkg)
+ map_dependencies("RREPLACES", d, pkg)
+ map_dependencies("RCONFLICTS", d, pkg)
+ map_dependencies("PKG", d, pkg)
+
+ map_variable("PROVIDES", d)
+ map_variable("PACKAGES_DYNAMIC", d)
+ map_variable("PACKAGE_INSTALL", d)
+}
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 076a532360..0caab6dcf9 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -168,6 +168,17 @@ python () {
bb.data.setVarFlag('do_package', 'deptask', " ".join(deps), d)
else:
d.setVar("PACKAGERDEPTASK", "")
+
+ multilib_archs = []
+ multilibs= d.getVar('MULTILIBS', True) or ""
+ if multilibs:
+ for ext in multilibs.split():
+ eext = ext.split(':')
+ if len(eext) > 1:
+ if eext[0] == 'multilib':
+ multilib_archs.append('ml' + eext[1])
+
+ d.setVar("MULTILIB_ARCHS", ' '.join(multilib_archs))
}
def splitfile(file, debugfile, debugsrcdir, d):