From patchwork Mon May 20 10:18:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 43848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFBBAC04FFE for ; Mon, 20 May 2024 10:18:44 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.57680.1716200315934947666 for ; Mon, 20 May 2024 03:18:36 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7FFE0FEC for ; Mon, 20 May 2024 03:18:59 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 319883F766 for ; Mon, 20 May 2024 03:18:35 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/6] oeqa/sdk: rename test cases Date: Mon, 20 May 2024 10:18:28 +0000 Message-Id: <20240520101833.1798907-1-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 May 2024 10:18:44 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199563 Instead of having a test called eg "assimp", rename it to "cmake" as the point of the test is to verify that CMake works. This should make it clearer what the tests are actually exercising. Signed-off-by: Ross Burton --- meta/lib/oeqa/sdk/cases/{buildcpio.py => autotools.py} | 2 +- meta/lib/oeqa/sdk/cases/{assimp.py => cmake.py} | 4 ++-- meta/lib/oeqa/sdk/cases/{buildgalculator.py => gtk3.py} | 2 +- meta/lib/oeqa/sdk/cases/{buildlzip.py => makefile.py} | 2 +- meta/lib/oeqa/sdk/cases/{buildepoxy.py => meson.py} | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename meta/lib/oeqa/sdk/cases/{buildcpio.py => autotools.py} (97%) rename meta/lib/oeqa/sdk/cases/{assimp.py => cmake.py} (95%) rename meta/lib/oeqa/sdk/cases/{buildgalculator.py => gtk3.py} (98%) rename meta/lib/oeqa/sdk/cases/{buildlzip.py => makefile.py} (97%) rename meta/lib/oeqa/sdk/cases/{buildepoxy.py => meson.py} (93%) diff --git a/meta/lib/oeqa/sdk/cases/buildcpio.py b/meta/lib/oeqa/sdk/cases/autotools.py similarity index 97% rename from meta/lib/oeqa/sdk/cases/buildcpio.py rename to meta/lib/oeqa/sdk/cases/autotools.py index 51003b19cd0..a711353791c 100644 --- a/meta/lib/oeqa/sdk/cases/buildcpio.py +++ b/meta/lib/oeqa/sdk/cases/autotools.py @@ -13,7 +13,7 @@ from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() -class BuildCpioTest(OESDKTestCase): +class AutotoolsTest(OESDKTestCase): """ Check that autotools will cross-compile correctly. """ diff --git a/meta/lib/oeqa/sdk/cases/assimp.py b/meta/lib/oeqa/sdk/cases/cmake.py similarity index 95% rename from meta/lib/oeqa/sdk/cases/assimp.py rename to meta/lib/oeqa/sdk/cases/cmake.py index e986838aea7..4886435ddf1 100644 --- a/meta/lib/oeqa/sdk/cases/assimp.py +++ b/meta/lib/oeqa/sdk/cases/cmake.py @@ -13,7 +13,7 @@ from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() -class BuildAssimp(OESDKTestCase): +class CMakeTest(OESDKTestCase): """ Test case to build a project using cmake. """ @@ -21,7 +21,7 @@ class BuildAssimp(OESDKTestCase): def setUp(self): if not (self.tc.hasHostPackage("nativesdk-cmake") or self.tc.hasHostPackage("cmake-native")): - raise unittest.SkipTest("Needs cmake") + raise unittest.SkipTest("CMakeTest: needs cmake") def test_assimp(self): with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py b/meta/lib/oeqa/sdk/cases/gtk3.py similarity index 98% rename from meta/lib/oeqa/sdk/cases/buildgalculator.py rename to meta/lib/oeqa/sdk/cases/gtk3.py index 178f07472d5..c329c4bb86c 100644 --- a/meta/lib/oeqa/sdk/cases/buildgalculator.py +++ b/meta/lib/oeqa/sdk/cases/gtk3.py @@ -13,7 +13,7 @@ from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() -class GalculatorTest(OESDKTestCase): +class GTK3Test(OESDKTestCase): """ Test that autotools and GTK+ 3 compiles correctly. """ diff --git a/meta/lib/oeqa/sdk/cases/buildlzip.py b/meta/lib/oeqa/sdk/cases/makefile.py similarity index 97% rename from meta/lib/oeqa/sdk/cases/buildlzip.py rename to meta/lib/oeqa/sdk/cases/makefile.py index b4b7d85b882..c0b40f1f728 100644 --- a/meta/lib/oeqa/sdk/cases/buildlzip.py +++ b/meta/lib/oeqa/sdk/cases/makefile.py @@ -9,7 +9,7 @@ from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() -class BuildLzipTest(OESDKTestCase): +class MakefileTest(OESDKTestCase): """ Test that "plain" compilation works, using just $CC $CFLAGS etc. """ diff --git a/meta/lib/oeqa/sdk/cases/buildepoxy.py b/meta/lib/oeqa/sdk/cases/meson.py similarity index 93% rename from meta/lib/oeqa/sdk/cases/buildepoxy.py rename to meta/lib/oeqa/sdk/cases/meson.py index 147ee3e0eee..be53df204a5 100644 --- a/meta/lib/oeqa/sdk/cases/buildepoxy.py +++ b/meta/lib/oeqa/sdk/cases/meson.py @@ -13,14 +13,14 @@ from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() -class EpoxyTest(OESDKTestCase): +class MesonTest(OESDKTestCase): """ Test that Meson builds correctly. """ def setUp(self): if not (self.tc.hasHostPackage("nativesdk-meson") or self.tc.hasHostPackage("meson-native")): - raise unittest.SkipTest("EpoxyTest class: SDK doesn't contain Meson") + raise unittest.SkipTest("MesonTest: needs meson") def test_epoxy(self): with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: From patchwork Mon May 20 10:18:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 43852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0439EC04FFE for ; Mon, 20 May 2024 10:18:55 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.56864.1716200316365884410 for ; Mon, 20 May 2024 03:18:36 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0EF031063 for ; Mon, 20 May 2024 03:19:00 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B59CE3F766 for ; Mon, 20 May 2024 03:18:35 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/6] oeqa/sdk: remove unused imports from test cases Date: Mon, 20 May 2024 10:18:29 +0000 Message-Id: <20240520101833.1798907-2-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com> References: <20240520101833.1798907-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 May 2024 10:18:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199564 Remove redundant imports. Signed-off-by: Ross Burton --- meta/lib/oeqa/sdk/cases/autotools.py | 1 - meta/lib/oeqa/sdk/cases/makefile.py | 2 +- meta/lib/oeqa/sdk/cases/maturin.py | 1 - meta/lib/oeqa/sdk/cases/python.py | 2 +- meta/lib/oeqa/sdk/cases/rust.py | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/sdk/cases/autotools.py b/meta/lib/oeqa/sdk/cases/autotools.py index a711353791c..848e9392ec0 100644 --- a/meta/lib/oeqa/sdk/cases/autotools.py +++ b/meta/lib/oeqa/sdk/cases/autotools.py @@ -7,7 +7,6 @@ import os import tempfile import subprocess -import unittest from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output diff --git a/meta/lib/oeqa/sdk/cases/makefile.py b/meta/lib/oeqa/sdk/cases/makefile.py index c0b40f1f728..2ff54ce25ff 100644 --- a/meta/lib/oeqa/sdk/cases/makefile.py +++ b/meta/lib/oeqa/sdk/cases/makefile.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT # -import os, tempfile, subprocess, unittest +import os, tempfile, subprocess from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output errors_have_output() diff --git a/meta/lib/oeqa/sdk/cases/maturin.py b/meta/lib/oeqa/sdk/cases/maturin.py index ea10f568b27..20f6b553d0b 100644 --- a/meta/lib/oeqa/sdk/cases/maturin.py +++ b/meta/lib/oeqa/sdk/cases/maturin.py @@ -8,7 +8,6 @@ import os import shutil import unittest -from oeqa.core.utils.path import remove_safe from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index 5ea992b9f33..51284949f50 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT # -import subprocess, unittest +import unittest from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output diff --git a/meta/lib/oeqa/sdk/cases/rust.py b/meta/lib/oeqa/sdk/cases/rust.py index f5d437bb19d..a54245851b4 100644 --- a/meta/lib/oeqa/sdk/cases/rust.py +++ b/meta/lib/oeqa/sdk/cases/rust.py @@ -8,7 +8,6 @@ import os import shutil import unittest -from oeqa.core.utils.path import remove_safe from oeqa.sdk.case import OESDKTestCase from oeqa.utils.subprocesstweak import errors_have_output From patchwork Mon May 20 10:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 43847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1867C41513 for ; Mon, 20 May 2024 10:18:44 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.56865.1716200317005000870 for ; Mon, 20 May 2024 03:18:37 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9B8A0FEC for ; Mon, 20 May 2024 03:19:00 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4531F3F766 for ; Mon, 20 May 2024 03:18:36 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/6] meson: don't use deprecated pkgconfig variable Date: Mon, 20 May 2024 10:18:30 +0000 Message-Id: <20240520101833.1798907-3-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com> References: <20240520101833.1798907-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 May 2024 10:18:44 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199565 As with a previous change to the class[1], the "pkgconfig" entry is now deprecated and "pkg-config" should be used instead. [1] oe-core d64b307891422e290bbe821d4303b3af526bbe17 Signed-off-by: Ross Burton --- meta/recipes-devtools/meson/meson_1.3.1.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-devtools/meson/meson_1.3.1.bb b/meta/recipes-devtools/meson/meson_1.3.1.bb index 3d2eedca10a..5b0d82fe9f5 100644 --- a/meta/recipes-devtools/meson/meson_1.3.1.bb +++ b/meta/recipes-devtools/meson/meson_1.3.1.bb @@ -86,7 +86,7 @@ ar = ${@meson_array('BUILD_AR', d)} nm = ${@meson_array('BUILD_NM', d)} strip = ${@meson_array('BUILD_STRIP', d)} readelf = ${@meson_array('BUILD_READELF', d)} -pkgconfig = 'pkg-config-native' +pkg-config = 'pkg-config-native' [built-in options] c_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}] @@ -104,7 +104,7 @@ cpp = @CXX ar = @AR nm = @NM strip = @STRIP -pkgconfig = 'pkg-config' +pkg-config = 'pkg-config' [built-in options] c_args = @CFLAGS From patchwork Mon May 20 10:18:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 43849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1407FC25B77 for ; Mon, 20 May 2024 10:18:45 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.57681.1716200317419086004 for ; Mon, 20 May 2024 03:18:37 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2AF95FEC for ; Mon, 20 May 2024 03:19:01 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D1D8A3F766 for ; Mon, 20 May 2024 03:18:36 -0700 (PDT) From: Ross Burton 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 Message-Id: <20240520101833.1798907-4-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com> References: <20240520101833.1798907-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 May 2024 10:18:45 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199566 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 --- 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 From patchwork Mon May 20 10:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 43850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10DFEC25B78 for ; Mon, 20 May 2024 10:18:45 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.56866.1716200318008119271 for ; Mon, 20 May 2024 03:18:38 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AF42BFEC for ; Mon, 20 May 2024 03:19:01 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 619413F766 for ; Mon, 20 May 2024 03:18:37 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 5/6] meson: correct the host machine definition in SDKs Date: Mon, 20 May 2024 10:18:32 +0000 Message-Id: <20240520101833.1798907-5-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com> References: <20240520101833.1798907-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 May 2024 10:18:45 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199567 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 --- .../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 From patchwork Mon May 20 10:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 43851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 043E1C41513 for ; Mon, 20 May 2024 10:18:55 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.56867.1716200318499746759 for ; Mon, 20 May 2024 03:18:38 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E801FEC for ; Mon, 20 May 2024 03:19:02 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E57733F766 for ; Mon, 20 May 2024 03:18:37 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments Date: Mon, 20 May 2024 10:18:33 +0000 Message-Id: <20240520101833.1798907-6-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com> References: <20240520101833.1798907-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 20 May 2024 10:18:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199568 Use 'meson introspect' to dump JSON describing the build configuration and validate that the build and host architectures are correctly set in the meson.cross file. Also instead of calling ninja directly, call the relevant meson commands. Signed-off-by: Ross Burton --- meta/lib/oeqa/sdk/cases/meson.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py index be53df204a5..5b53668c958 100644 --- a/meta/lib/oeqa/sdk/cases/meson.py +++ b/meta/lib/oeqa/sdk/cases/meson.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: MIT # +import json import os import subprocess import tempfile @@ -35,10 +36,17 @@ class MesonTest(OESDKTestCase): self.assertTrue(os.path.isdir(dirs["source"])) os.makedirs(dirs["build"]) - log = self._run("meson --warnlevel 1 -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs)) - # Check that Meson thinks we're doing a cross build and not a native - self.assertIn("Build type: cross build", log) - self._run("ninja -C {build} -v".format(**dirs)) - self._run("DESTDIR={install} ninja -C {build} -v install".format(**dirs)) + log = self._run("meson setup --warnlevel 1 -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs)) + + # Check that the host (gcc) and build (cross-gcc) compilers are different + data = json.loads(self._run("meson introspect --compilers {build}".format(**dirs))) + self.assertNotEqual(data["build"]["c"]["exelist"], data["host"]["c"]["exelist"]) + # Check that the system architectures were set correctly + data = json.loads(self._run("meson introspect --machines {build}".format(**dirs))) + self.assertEqual(data["build"]["cpu"], self.td["SDK_ARCH"]) + self.assertEqual(data["host"]["cpu"], self.td["HOST_ARCH"]) + + self._run("meson compile -C {build} -v".format(**dirs)) + self._run("meson install -C {build} --destdir {install}".format(**dirs)) self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libepoxy.so"))