]> code.ossystems Code Review - openembedded-core.git/commitdiff
multilib: Add support for compiling recipes against multiple ABIs
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 7 Jun 2011 09:27:03 +0000 (17:27 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 27 Jul 2011 15:15:21 +0000 (16:15 +0100)
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>
meta/classes/autotools.bbclass
meta/classes/cross.bbclass
meta/classes/insane.bbclass
meta/classes/multilib.bbclass [new file with mode: 0644]
meta/classes/package.bbclass
meta/conf/bitbake.conf
meta/conf/local.conf.sample
meta/conf/multilib.conf [new file with mode: 0644]
meta/recipes-core/dbus/dbus.inc
meta/recipes-devtools/gcc/libgcc_4.6.bb

index ed5637ef3b9007e891982fa1d0a60a8742882de5..e5c13ae691cc0be9cefc98778b33e0156efe3733 100644 (file)
@@ -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) \
index 050d63e41229c7610ca3e32d67a4764ea21ed76b..e19614f2808d11c8451de5d19759d718dc143c7b 100644 (file)
@@ -54,4 +54,3 @@ do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE
 do_install () {
        oe_runmake 'DESTDIR=${D}' install
 }
-
index d56c9edcc250e54f9ffe8950739b8fa6fbc05605..5fb0d98bafdf55e3b28ac0316743d25c58fca82b 100644 (file)
@@ -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 (file)
index 0000000..6e1669f
--- /dev/null
@@ -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)
+}
index 076a53236000c1f58eb4b54c33da7351f06d0e72..0caab6dcf9082efae43d158899c2eb3d29359a78 100644 (file)
@@ -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):
index 46a9a821988c80e403e5ff6b2cb2cc015b6cdfb9..6e109ecd1e75d7511a6883d942505e7ede2356d2 100644 (file)
@@ -735,3 +735,4 @@ BB_SIGNATURE_HANDLER ?= "basic"
 BB_HASHTASK_WHITELIST ?= "(.*-cross$|.*-native$|.*-cross-initial$|.*-cross-intermediate$|^virtual:native:.*|^virtual:nativesdk:.*)"
 BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM USER FILESPATH USERNAME STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE"
 
+MLPREFIX ??= ""
index c378fb7bd34b5323092e585f9db0520a27a034e7..97789ad1ff82970a27f6d4b67836cfc57d0cabf0 100644 (file)
@@ -193,3 +193,8 @@ NO32LIBS = "1"
 
 # Uncomment this if your host distribution provides the help2man tool.
 #ASSUME_PROVIDED += "help2man-native"
+
+# Uncomment the following lines to enable multilib builds
+#require conf/multilib.conf
+#MULTILIBS = "multilib:lib32"
+#TUNENAME_virtclass-multilib-lib32 = "x86"
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
new file mode 100644 (file)
index 0000000..894b7a5
--- /dev/null
@@ -0,0 +1,24 @@
+
+baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) or 'INVALID'), True) or 'lib'}"
+
+MULTILIBS ??= "multilib:lib32"
+BBCLASSEXTEND_append_pn-linux-libc-headers = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-eglibc-initial = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-eglibc = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-libgcc = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-gcc-runtime = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-libtool-cross = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-zlib = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-binutils-cross = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-gcc-cross-initial = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-gcc-cross-intermediate = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-gcc-cross = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-busybox = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-update-rc.d = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-util-linux = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-gettext = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-bash = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-ncurses = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-expat = " ${MULTILIBS}"
+BBCLASSEXTEND_append_pn-eglibc-locale = " ${MULTILIBS}"
+
index 5f9a8a30818c82f6c647b7b29d43658f0e3530a5..6b76cba959cf9ab159b7aab7defa486ef1b060bc 100644 (file)
@@ -5,11 +5,9 @@ SECTION = "base"
 LICENSE = "AFL-2 | GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
                     file://dbus/dbus.h;firstline=6;endline=20;md5=6eea2e0c7750dd8e620dcb1437312fa5"
-x11deps = "virtual/libx11 libsm"
-basedeps = "expat virtual/libintl"
-DEPENDS = "${basedeps} ${x11deps}"
-DEPENDS_virtclass-native = "${basedeps}"
-DEPENDS_virtclass-nativesdk = "${basedeps} virtual/libx11"
+DEPENDS = "expat virtual/libintl virtual/libx11 libsm"
+DEPENDS_virtclass-native = "expat-native virtual/libintl-native"
+DEPENDS_virtclass-nativesdk = "expat-nativesdk virtual/libintl-nativesdk virtual/libx11"
 
 SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
            file://tmpdir.patch; \
index 6a77ce465355375791da68ed0502cde32c8c2289..a6e1146be9d9213056ac607f3808bf6251234adf 100644 (file)
@@ -41,9 +41,9 @@ do_install () {
        chmod +x ${D}${base_libdir}/libgcc_s.so.*
 }
 
-do_package_write_ipk[depends] += "virtual/libc:do_package"
-do_package_write_deb[depends] += "virtual/libc:do_package"
-do_package_write_rpm[depends] += "virtual/libc:do_package"
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_package"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_package"
 
 BBCLASSEXTEND = "nativesdk"