new file mode 100644
@@ -0,0 +1,74 @@
+DESCRIPTION = "Fetch 32bit x86 buildtools-tarball from x86 multiconfig build, \
+extract and install toolchain libraries and include files into 64bit nativesdk sysroot.\
+Or fetch 64bit x86_64 buildtools-tarball from x86_64 multiconfig build, \
+extract and install toolchain libraries and include files into 32bit nativesdk sysroot.\
+"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
+
+inherit nativesdk
+
+MCSDK_ARCH:virtclass-mcextend-x86 = "i686"
+MCSDK_ARCH:virtclass-mcextend-x86_64 = "x86_64"
+
+FROM_MULTICONFIG:virtclass-mcextend-x86_64 = "x86"
+FROM_MULTICONFIG:virtclass-mcextend-x86 = "x86_64"
+
+TO_MULTICONFIG = "${MCNAME}"
+
+MC_SDK_DEPLOY = "${TOPDIR}/tmp-mc-${MCNAME}/deploy/sdk"
+MC_TOOLCHAIN_OUTPUTNAME = "${MCSDK_ARCH}-buildtools-nativesdk-standalone-${DISTRO_VERSION}"
+
+# 64bit x86_64 platform requires 32bit x86 buildtools-tarball
+# Or
+# 32bit x86 platform requires 64bit buildtools-tarball
+do_install[mcdepends] += "mc:${FROM_MULTICONFIG}:${TO_MULTICONFIG}:buildtools-tarball:do_build"
+do_install () {
+ install -d ${D}${localstatedir}/machines/${MCNAME}
+ install ${MC_SDK_DEPLOY}/${MC_TOOLCHAIN_OUTPUTNAME}.sh ${D}${localstatedir}/machines/${MCNAME}/buildtools-tarball.sh
+}
+
+MC_BASELIB:virtclass-mcextend-x86 = "lib"
+MC_BASELIB:virtclass-mcextend-x86_64 = "lib64"
+
+INSTALL_FILES ?= " \
+ /usr/include \
+ /usr/${MC_BASELIB} \
+ /${MC_BASELIB} \
+"
+do_install[vardeps] += "INSTALL_FILES MC_SDK_DEPLOY MC_TOOLCHAIN_OUTPUTNAME"
+
+# Extract and install toolchain libraries and include files into nativesdk sysroot
+pkg_postinst:${PN} () {
+ set -x
+ $D${localstatedir}/machines/${MCNAME}/buildtools-tarball.sh -y -d $D/sdk-${MCNAME}
+ src_prefix="$D/sdk-${MCNAME}/sysroots/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}"
+ for install_file in ${INSTALL_FILES}; do
+ if [ ! -e ${src_prefix}${install_file} ]; then
+ echo "${src_prefix}${install_file} does not exist"
+ exit 1
+ elif [ -d ${src_prefix}${install_file} ]; then
+ install -d $D${SDKPATHNATIVE}${install_file}
+ cp -rf ${src_prefix}${install_file}/* $D${SDKPATHNATIVE}${install_file}/
+ else
+ install -d $D${SDKPATHNATIVE}${install_file%/*}
+ cp -f ${src_prefix}${install_file} $D${SDKPATHNATIVE}${install_file}
+ fi
+ done
+ rm $D/sdk-${MCNAME} -rf
+}
+
+
+python () {
+ mcname = d.getVar('MCNAME')
+ if not mcname:
+ raise bb.parse.SkipRecipe("Not a multiconfig target")
+
+ multiconfigs = d.getVar('BBMULTICONFIG') or ""
+ if mcname not in multiconfigs:
+ raise bb.parse.SkipRecipe("multiconfig target %s not enabled" % mcname)
+}
+
+INSANE_SKIP = "native-last"
+
+BBCLASSEXTEND = "mcextend:x86 mcextend:x86_64"
Support two mutliconfig build x86 and x86_64: 1. Trigger a x86 multiconfig build to generate 32bit x86 buildtools-tarball. During package runtime installation, script postinst extracted 32bit x86 buildtools-tarball and installed it to 64bit x86_64 nativesdk sysroot. 2. Trigger a x86_64 multiconfig build to generate 64bit x86_64 buildtools-tarball. During package runtime installation, script postinst extracted 64bit x86_64 buildtools-tarball and installed it to 32bit x86 nativesdk sysroot. [ YOCTO #15722 ] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Changed in v2: Commit shortlog (first line of commit message) should follow the format "<target>: <summary>" --- ...ticonfig-multlib-toolchain-packager_0.1.bb | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 meta-selftest/recipes-test/multiconfig/nativesdk-multiconfig-multlib-toolchain-packager_0.1.bb