]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
toolchain-scripts: export the target endianism and word size
authorRoss Burton <ross.burton@arm.com>
Mon, 20 May 2024 10:18:31 +0000 (10:18 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 22 May 2024 09:20:08 +0000 (10:20 +0100)
Some build systems (notably, Meson) like to be told when cross-compiling
what the target endian and word size is.  We don't have these exported
via the variables, so add them using siteinfo as a source of data.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/toolchain-scripts.bbclass

index 6bfe0b6de0dc748cc4edec843adf05d8d2759d9a..cbef412e79613053d00b314551afa45e763da279 100644 (file)
@@ -16,6 +16,13 @@ DEBUG_PREFIX_MAP = ""
 
 EXPORT_SDK_PS1 = "${@ 'export PS1=\\"%s\\"' % d.getVar('SDK_PS1') if d.getVar('SDK_PS1') else ''}"
 
+def siteinfo_with_prefix(d, prefix):
+    # Return a prefixed value from siteinfo
+    for item in siteinfo_data_for_machine(d.getVar("TARGET_ARCH"), d.getVar("TARGET_OS"), d):
+        if item.startswith(prefix):
+            return item.replace(prefix, "")
+    raise KeyError
+
 # This function creates an environment-setup-script for use in a deployable SDK
 toolchain_create_sdk_env_script () {
        # Create environment setup script.  Remember that $SDKTARGETSYSROOT should
@@ -63,6 +70,8 @@ toolchain_create_sdk_env_script () {
        echo 'export OECORE_BASELIB="${baselib}"' >> $script
        echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
        echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
+       echo 'export OECORE_TARGET_BITS="${@siteinfo_with_prefix(d, 'bit-')}"' >>$script
+       echo 'export OECORE_TARGET_ENDIAN="${@siteinfo_with_prefix(d, 'endian-')}"' >>$script
 
        echo 'unset command_not_found_handle' >> $script