Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@arm.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/6] toolchain-scripts: export the target endianism and word size
Date: Mon, 20 May 2024 10:18:31 +0000	[thread overview]
Message-ID: <20240520101833.1798907-4-ross.burton@arm.com> (raw)
In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com>

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>
---
 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



  parent reply	other threads:[~2024-05-20 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 10:18 [PATCH 1/6] oeqa/sdk: rename test cases Ross Burton
2024-05-20 10:18 ` [PATCH 2/6] oeqa/sdk: remove unused imports from " Ross Burton
2024-05-20 10:18 ` [PATCH 3/6] meson: don't use deprecated pkgconfig variable Ross Burton
2024-05-20 10:18 ` Ross Burton [this message]
2024-05-20 10:18 ` [PATCH 5/6] meson: correct the host machine definition in SDKs Ross Burton
2024-05-21  9:46   ` [OE-core] " Alexandre Belloni
2024-05-20 10:18 ` [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments Ross Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240520101833.1798907-4-ross.burton@arm.com \
    --to=ross.burton@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox