From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Ross Burton <ross.burton@arm.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH 5/6] meson: correct the host machine definition in SDKs
Date: Tue, 21 May 2024 11:46:58 +0200 [thread overview]
Message-ID: <202405210946585c4dc6df@mail.local> (raw)
In-Reply-To: <20240520101833.1798907-5-ross.burton@arm.com>
I believe this causes the following failure:
https://autobuilder.yoctoproject.org/typhoon/#/builders/146/builds/1733/steps/12/logs/stdio
On 20/05/2024 10:18:32+0000, Ross Burton wrote:
> The SDK_ARCH is not the correct definiton for the host machine definition
> inside the SDK, but because a nativesdk recipe doesn't know what the
> final target will be these values should be set up at SDK installation
> time via the environment script.
>
> Put placeholders in the installed meson.cross file instead, and replace
> them at SDK installation time with the correct values.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> .../meson/meson/meson-setup.py | 37 +++++++++++++++++++
> meta/recipes-devtools/meson/meson_1.3.1.bb | 16 ++------
> 2 files changed, 41 insertions(+), 12 deletions(-)
>
> diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py b/meta/recipes-devtools/meson/meson/meson-setup.py
> index daaa551de2d..74579ecca6b 100755
> --- a/meta/recipes-devtools/meson/meson/meson-setup.py
> +++ b/meta/recipes-devtools/meson/meson/meson-setup.py
> @@ -1,9 +1,42 @@
> #!/usr/bin/env python3
>
> import os
> +import re
> import string
> import sys
>
> +# Keep these in sync with the logic in meson-routines.bbclass
> +def meson_cpu_family():
> + arch = os.environ["OECORE_TARGET_ARCH"]
> + if arch == 'powerpc':
> + return 'ppc'
> + elif arch == 'powerpc64' or arch == 'powerpc64le':
> + return 'ppc64'
> + elif arch == 'armeb':
> + return 'arm'
> + elif arch == 'aarch64_be':
> + return 'aarch64'
> + elif arch == 'mipsel':
> + return 'mips'
> + elif arch == 'mips64el':
> + return 'mips64'
> + elif re.match(r"i[3-6]86", arch):
> + return "x86"
> + elif arch == "microblazeel":
> + return "microblaze"
> + else:
> + return arch
> +
> +def meson_operating_system():
> + opersys = os.environ["OECORE_TARGET_ARCH"]
> + if "mingw" in opersys:
> + return "windows"
> + # avoid e.g 'linux-gnueabi'
> + elif "linux" in opersys:
> + return "linux"
> + else:
> + return opersys
> +
> class Template(string.Template):
> delimiter = "@"
>
> @@ -30,6 +63,10 @@ cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ[
> native_template_file = os.path.join(sysroot, 'usr/share/meson/meson.native.template')
> native_file = os.path.join(sysroot, 'usr/share/meson/meson.native')
>
> +# Inject transformed values
> +os.environ["OECORE_MESON_TARGET_FAMILY"] = meson_cpu_family()
> +os.environ["OECORE_MESON_TARGET_OS"] = meson_operating_system()
> +
> with open(template_file) as in_file:
> template = in_file.read()
> output = Template(template).substitute(Environ())
> diff --git a/meta/recipes-devtools/meson/meson_1.3.1.bb b/meta/recipes-devtools/meson/meson_1.3.1.bb
> index 5b0d82fe9f5..f8085f369bf 100644
> --- a/meta/recipes-devtools/meson/meson_1.3.1.bb
> +++ b/meta/recipes-devtools/meson/meson_1.3.1.bb
> @@ -117,18 +117,14 @@ needs_exe_wrapper = true
> sys_root = @OECORE_TARGET_SYSROOT
>
> [host_machine]
> -system = '$host_system'
> -cpu_family = '$host_cpu_family'
> -cpu = '$host_cpu'
> -endian = '$host_endian'
> +system = @OECORE_MESON_TARGET_OS
> +cpu_family = @OECORE_MESON_TARGET_FAMILY
> +cpu = @OECORE_TARGET_ARCH
> +endian = @OECORE_TARGET_ENDIAN
> EOF
> }
>
> do_install:append:class-nativesdk() {
> - host_system=${SDK_OS}
> - host_cpu_family=${@meson_cpu_family("SDK_ARCH", d)}
> - host_cpu=${SDK_ARCH}
> - host_endian=${@meson_endian("SDK", d)}
> install_templates
>
> install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
> @@ -142,10 +138,6 @@ do_install:append:class-nativesdk() {
> FILES:${PN}:append:class-nativesdk = "${datadir}/meson ${SDKPATHNATIVE}"
>
> do_install:append:class-native() {
> - host_system=${HOST_OS}
> - host_cpu_family=${@meson_cpu_family("HOST_ARCH", d)}
> - host_cpu=${HOST_ARCH}
> - host_endian=${@meson_endian("HOST", d)}
> install_templates
>
> install -d ${D}${datadir}/post-relocate-setup.d
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#199567): https://lists.openembedded.org/g/openembedded-core/message/199567
> Mute This Topic: https://lists.openembedded.org/mt/106200491/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-05-21 9:47 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 ` [PATCH 4/6] toolchain-scripts: export the target endianism and word size Ross Burton
2024-05-20 10:18 ` [PATCH 5/6] meson: correct the host machine definition in SDKs Ross Burton
2024-05-21 9:46 ` Alexandre Belloni [this message]
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=202405210946585c4dc6df@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=ross.burton@arm.com \
/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