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 <[email protected]>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass 
b/meta/classes-recipe/toolchain-scripts.bbclass
index 6bfe0b6de0d..cbef412e796 100644
--- a/meta/classes-recipe/toolchain-scripts.bbclass
+++ b/meta/classes-recipe/toolchain-scripts.bbclass
@@ -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
 
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#199566): 
https://lists.openembedded.org/g/openembedded-core/message/199566
Mute This Topic: https://lists.openembedded.org/mt/106200490/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to