public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Tom Hochstein <tom.hochstein@oss.nxp.com>
To: openembedded-core@lists.openembedded.org
Cc: Tom Hochstein <tom.hochstein@oss.nxp.com>
Subject: [PATCH v6 3/6] toolchain-scripts: Export meson settings for SDK builds
Date: Fri, 11 Apr 2025 12:28:00 -0500	[thread overview]
Message-ID: <20250411172803.3706607-3-tom.hochstein@oss.nxp.com> (raw)
In-Reply-To: <20250411172803.3706607-1-tom.hochstein@oss.nxp.com>

Create a new set of exports for the Meson `host_machine` cross settings.
This allows the target cross file to be created correctly from
meson.cross.template and aligns with meson.bbclass.

Note, one might think that HOST_OS and HOST_ARCH would be appropriate as
inputs here, aligning nicely with the Meson naming. That turns out to be
incorrect since the script is generated in a native/nativesdk build with
HOST_OS and HOST_ARCH set for the "build machine", not the "host
machine", using the Meson terminology. See
https://mesonbuild.com/Cross-compilation.html.

Fixes: [YOCTO #15485]
Signed-off-by: Tom Hochstein <tom.hochstein@oss.nxp.com>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
index 9e4320f876..3053cd0f1f 100644
--- a/meta/classes-recipe/toolchain-scripts.bbclass
+++ b/meta/classes-recipe/toolchain-scripts.bbclass
@@ -4,7 +4,7 @@
 # SPDX-License-Identifier: MIT
 #
 
-inherit toolchain-scripts-base siteinfo kernel-arch
+inherit toolchain-scripts-base siteinfo kernel-arch meson-routines
 
 # We want to be able to change the value of MULTIMACH_TARGET_SYS, because it
 # doesn't always match our expectations... but we default to the stock value
@@ -72,6 +72,10 @@ toolchain_create_sdk_env_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 'export OECORE_MESON_HOST_SYSTEM="${@meson_operating_system('TARGET_OS', d)}"' >>$script
+	echo 'export OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
+	echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
+	echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' >>$script
 
 	echo 'unset command_not_found_handle' >> $script
 
@@ -101,6 +105,10 @@ toolchain_create_tree_env_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 'export OECORE_MESON_HOST_SYSTEM="${@meson_operating_system('TARGET_OS', d)}"' >>$script
+	echo 'export OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
+	echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
+	echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' >>$script
 
 	toolchain_shared_env_script
 
-- 
2.34.1



  parent reply	other threads:[~2025-04-11 17:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 17:27 [PATCH v6 1/6] meson: Allow user to override setup command options Tom Hochstein
2025-04-11 17:27 ` [PATCH v6 2/6] toolchain-scripts: Add Meson settings for Yocto build SDK Tom Hochstein
2025-04-11 17:28 ` Tom Hochstein [this message]
2025-04-11 17:28 ` [PATCH v6 4/6] meson: Fix host_machine setting for native cross-file Tom Hochstein
2025-04-11 17:28 ` [PATCH v6 5/6] oeqa/sdk/meson: improve test to validate host/build target assignments Tom Hochstein
2025-04-15  9:12   ` [OE-core] " Mathieu Dubois-Briand
2025-04-11 17:28 ` [PATCH v6 6/6] oeqa/sdk/meson: Skip test when SDK arch != build machine arch Tom Hochstein
2025-04-15 10:48   ` [OE-core] " Richard Purdie
2025-04-16 16:16     ` Tom Hochstein
     [not found]     ` <1836D8BA73D61DA5.22324@lists.openembedded.org>
2025-04-17 13:48       ` Tom Hochstein

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=20250411172803.3706607-3-tom.hochstein@oss.nxp.com \
    --to=tom.hochstein@oss.nxp.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