diff mbox series

[v3,1/4] toolchain-scripts: Export meson settings for SDK builds

Message ID 20250329180853.1057381-1-tom.hochstein@oss.nxp.com
State Under Review
Headers show
Series [v3,1/4] toolchain-scripts: Export meson settings for SDK builds | expand

Commit Message

Tom Hochstein March 29, 2025, 6:08 p.m. UTC
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 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.

Signed-off-by: Tom Hochstein <tom.hochstein@oss.nxp.com>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Ross Burton March 31, 2025, 2:44 p.m. UTC | #1
I spent a little time glaring at the meson/sdk interaction previously before getting sidetracked, can you verify that the test case change I attached still passes?

Thanks,
Ross



> On 29 Mar 2025, at 18:08, Tom Hochstein via lists.openembedded.org <tom.hochstein=oss.nxp.com@lists.openembedded.org> wrote:
>
> 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 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.
>
> Signed-off-by: Tom Hochstein <tom.hochstein@oss.nxp.com>
> ---
> meta/classes-recipe/toolchain-scripts.bbclass | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
> index b59a295abc..e54685e965 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
>
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#213889): https://lists.openembedded.org/g/openembedded-core/message/213889
> Mute This Topic: https://lists.openembedded.org/mt/111975257/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Ross Burton March 31, 2025, 4:10 p.m. UTC | #2
On 31 Mar 2025, at 15:44, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> 
> I spent a little time glaring at the meson/sdk interaction previously before getting sidetracked, can you verify that the test case change I attached still passes?

Also some relevant bugs:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=15486
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15485

Ross
diff mbox series

Patch

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
index b59a295abc..e54685e965 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