]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toolchain-scripts: Export meson settings for SDK builds
authorTom Hochstein <tom.hochstein@oss.nxp.com>
Sat, 10 May 2025 08:43:52 +0000 (09:43 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 12 May 2025 09:52:52 +0000 (10:52 +0100)
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]
(From OE-Core rev: 9e742a0a9078f4a19a5edbfa51f22f7b71992188)

Signed-off-by: Tom Hochstein <tom.hochstein@oss.nxp.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/toolchain-scripts.bbclass

index 9e4320f87626cb8d0bc4f0b925a0e1bdd9287c7d..3053cd0f1fae871417ac08067a89b2b0d0b21a7d 100644 (file)
@@ -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