From 42545ffbb37f2646a2a8c20999c21d3300e24f59 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Fri, 22 Jun 2012 18:44:06 -0500 Subject: populate_sdk: enable basic multilib support In order to enable basic multilib support for the export of an SDK image, a number of minor changes had to be made: The value of MULTIMACH_TARGET_SYS needs to be variable. This way we can define the value to the appropriate multilib. (Also in some cases the default PACKAGE_ARCH is set to MACHINE_ARCH which is incorrect for the SDK.) Add a companion REAL_MULTIMACH_TARGET_SYS, based on code from meta-environment, to allow for this. We have to convert the do_populate_sdk into a python call, and then break up the previous items into three parts. * Image construction * Setup of environment files * Generation of the tarball Then we can iterate over the multilibs to populate the environment files. Finally, matching changes were needed in the toolchain-scripts file. And what I presume is an optimization of immediate evaluation for TOOLCHAIN_CONFIGSITE_NOCACHE and ..._SYSROOTCACHE needed to be done at runtime, otherwise the wrong values may be used. Signed-off-by: Mark Hatle --- meta/classes/populate_sdk_base.bbclass | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'meta/classes/populate_sdk_base.bbclass') diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index 6508bd96cd..6dc66fbbbe 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass @@ -16,6 +16,10 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${DISTRO_VERSION}" SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" SDK_DEPENDS = "virtual/fakeroot-native sed-native" +# We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it +# could be set to the MACHINE_ARCH +REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}" + PID = "${@os.getpid()}" EXCLUDE_FROM_WORLD = "1" @@ -27,7 +31,33 @@ python () { runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", d) } -fakeroot do_populate_sdk() { +fakeroot python do_populate_sdk() { + bb.build.exec_func("populate_sdk_image", d) + + # Handle multilibs in the SDK environment, siteconfig, etc files... + localdata = bb.data.createCopy(d) + + # make sure we only use the WORKDIR value from 'd', or it can change + localdata.setVar('WORKDIR', d.getVar('WORKDIR', True)) + + # make sure we only use the SDKTARGETSYSROOT value from 'd' + localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT', True)) + + # Process DEFAULTTUNE + bb.build.exec_func("create_sdk_files", localdata) + + variants = d.getVar("MULTILIB_VARIANTS", True) or "" + for item in variants.split(): + # Load overrides from 'd' to avoid having to reset the value... + overrides = d.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item + localdata.setVar("OVERRIDES", overrides) + bb.data.update_data(localdata) + bb.build.exec_func("create_sdk_files", localdata) + + bb.build.exec_func("tar_sdk", d) +} + +fakeroot populate_sdk_image() { rm -rf ${SDK_OUTPUT} mkdir -p ${SDK_OUTPUT} @@ -54,15 +84,19 @@ fakeroot do_populate_sdk() { # Link the ld.so.cache file into the hosts filesystem ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache +} +fakeroot create_sdk_files() { # Setup site file for external use - toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS} + toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS} - toolchain_create_sdk_env_script + toolchain_create_sdk_env_script ${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS} # Add version information - toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS} + toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS} +} +fakeroot tar_sdk() { # Package it up mkdir -p ${SDK_DEPLOY} cd ${SDK_OUTPUT} -- cgit 1.2.3-korg