* [PATCH 1/6] oeqa/sdk: rename test cases
@ 2024-05-20 10:18 Ross Burton
2024-05-20 10:18 ` [PATCH 2/6] oeqa/sdk: remove unused imports from " Ross Burton
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Ross Burton @ 2024-05-20 10:18 UTC (permalink / raw)
To: openembedded-core
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 <ross.burton@arm.com>
---
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:
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/6] oeqa/sdk: remove unused imports from test cases
2024-05-20 10:18 [PATCH 1/6] oeqa/sdk: rename test cases Ross Burton
@ 2024-05-20 10:18 ` Ross Burton
2024-05-20 10:18 ` [PATCH 3/6] meson: don't use deprecated pkgconfig variable Ross Burton
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2024-05-20 10:18 UTC (permalink / raw)
To: openembedded-core
Remove redundant imports.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
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
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/6] meson: don't use deprecated pkgconfig variable
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 ` Ross Burton
2024-05-20 10:18 ` [PATCH 4/6] toolchain-scripts: export the target endianism and word size Ross Burton
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2024-05-20 10:18 UTC (permalink / raw)
To: openembedded-core
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 <ross.burton@arm.com>
---
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
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/6] toolchain-scripts: export the target endianism and word size
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 ` Ross Burton
2024-05-20 10:18 ` [PATCH 5/6] meson: correct the host machine definition in SDKs Ross Burton
2024-05-20 10:18 ` [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments Ross Burton
4 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2024-05-20 10:18 UTC (permalink / raw)
To: openembedded-core
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 <ross.burton@arm.com>
---
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
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/6] meson: correct the host machine definition in SDKs
2024-05-20 10:18 [PATCH 1/6] oeqa/sdk: rename test cases Ross Burton
` (2 preceding siblings ...)
2024-05-20 10:18 ` [PATCH 4/6] toolchain-scripts: export the target endianism and word size Ross Burton
@ 2024-05-20 10:18 ` Ross Burton
2024-05-21 9:46 ` [OE-core] " Alexandre Belloni
2024-05-20 10:18 ` [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments Ross Burton
4 siblings, 1 reply; 7+ messages in thread
From: Ross Burton @ 2024-05-20 10:18 UTC (permalink / raw)
To: openembedded-core
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments
2024-05-20 10:18 [PATCH 1/6] oeqa/sdk: rename test cases Ross Burton
` (3 preceding siblings ...)
2024-05-20 10:18 ` [PATCH 5/6] meson: correct the host machine definition in SDKs Ross Burton
@ 2024-05-20 10:18 ` Ross Burton
4 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2024-05-20 10:18 UTC (permalink / raw)
To: openembedded-core
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 <ross.burton@arm.com>
---
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"))
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH 5/6] meson: correct the host machine definition in SDKs
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
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2024-05-21 9:46 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-05-21 9:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [OE-core] " Alexandre Belloni
2024-05-20 10:18 ` [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments Ross Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox