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.

(From OE-Core rev: 87d4f6d176f27c22dbb99abc271b9a6eaca314f8)

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>
This commit is contained in:
Alexander Kanavin
2022-07-22 20:39:15 +02:00
committed by Richard Purdie
parent 638f988602
commit 3c940fa09a
2 changed files with 30 additions and 6 deletions

View File

@@ -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

View File

@@ -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
}