summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-07-22 20:39:15 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-28 11:50:01 +0100
commit87d4f6d176f27c22dbb99abc271b9a6eaca314f8 (patch)
tree60c2ba8fb5a6c989e7e9471dfd33dafbe36ea181 /meta
parent3134d19ba15bb783389c40617d5e2b568c7cd81c (diff)
downloadopenembedded-core-contrib-87d4f6d176f27c22dbb99abc271b9a6eaca314f8.tar.gz
meson: provide relocation script and native/cross wrappers also for meson-native
When using meson-native directly from bitbake this has no effect and everything works as before; the use case is being able to build meson-driven projects from the 'direct SDK' environment. Build systems like cmake/autotools are entirely driven by environment variables, but meson needs configuration files, and so this replicates how SDKs set things up. In particular, with this change the libepoxy build test from the SDK test suite is able to pass. Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/recipes-devtools/meson/meson/meson-wrapper2
-rw-r--r--meta/recipes-devtools/meson/meson_0.63.0.bb34
2 files changed, 30 insertions, 6 deletions
diff --git a/meta/recipes-devtools/meson/meson/meson-wrapper b/meta/recipes-devtools/meson/meson/meson-wrapper
index 8fafaad975..c62007f507 100755
--- a/meta/recipes-devtools/meson/meson/meson-wrapper
+++ b/meta/recipes-devtools/meson/meson/meson-wrapper
@@ -1,7 +1,7 @@
#!/bin/sh
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
- echo "OECORE_NATIVE_SYSROOT not set; are you in a Yocto SDK environment?" >&2
+ exec "meson.real" "$@"
fi
if [ -z "$SSL_CERT_DIR" ]; then
diff --git a/meta/recipes-devtools/meson/meson_0.63.0.bb b/meta/recipes-devtools/meson/meson_0.63.0.bb
index 42e64e351f..890f47506f 100644
--- a/meta/recipes-devtools/meson/meson_0.63.0.bb
+++ b/meta/recipes-devtools/meson/meson_0.63.0.bb
@@ -75,7 +75,7 @@ def generate_native_link_template(d):
return repr(val)
-do_install:append:class-nativesdk() {
+install_templates() {
install -d ${D}${datadir}/meson
cat >${D}${datadir}/meson/meson.native.template <<EOF
@@ -117,11 +117,19 @@ needs_exe_wrapper = true
sys_root = @OECORE_TARGET_SYSROOT
[host_machine]
-system = '${SDK_OS}'
-cpu_family = '${@meson_cpu_family("SDK_ARCH", d)}'
-cpu = '${SDK_ARCH}'
-endian = '${@meson_endian("SDK", d)}'
+system = '$host_system'
+cpu_family = '$host_cpu_family'
+cpu = '$host_cpu'
+endian = '$host_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
install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
@@ -132,3 +140,19 @@ EOF
}
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
+ install -m 0755 ${WORKDIR}/meson-setup.py ${D}${datadir}/post-relocate-setup.d/
+
+ # We need to wrap the real meson with a thin wrapper that substitues native/cross files
+ # when running in a direct SDK environment.
+ mv ${D}${bindir}/meson ${D}${bindir}/meson.real
+ install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson
+}