diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-07-22 20:39:15 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-28 11:50:17 +0100 |
commit | 3c940fa09aa9aa1f3dd086242720f19abe4a7596 (patch) | |
tree | ec5bff33c1e9912daeae29104575fbbbdf02554a /meta/recipes-devtools/meson | |
parent | 638f988602a2c6200deced46b1b1d65835387238 (diff) | |
download | poky-3c940fa09aa9aa1f3dd086242720f19abe4a7596.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.
(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>
Diffstat (limited to 'meta/recipes-devtools/meson')
-rwxr-xr-x | meta/recipes-devtools/meson/meson/meson-wrapper | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/meson/meson_0.63.0.bb | 34 |
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 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | if [ -z "$OECORE_NATIVE_SYSROOT" ]; then | 3 | if [ -z "$OECORE_NATIVE_SYSROOT" ]; then |
4 | echo "OECORE_NATIVE_SYSROOT not set; are you in a Yocto SDK environment?" >&2 | 4 | exec "meson.real" "$@" |
5 | fi | 5 | fi |
6 | 6 | ||
7 | if [ -z "$SSL_CERT_DIR" ]; then | 7 | 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): | |||
75 | 75 | ||
76 | return repr(val) | 76 | return repr(val) |
77 | 77 | ||
78 | do_install:append:class-nativesdk() { | 78 | install_templates() { |
79 | install -d ${D}${datadir}/meson | 79 | install -d ${D}${datadir}/meson |
80 | 80 | ||
81 | cat >${D}${datadir}/meson/meson.native.template <<EOF | 81 | cat >${D}${datadir}/meson/meson.native.template <<EOF |
@@ -117,11 +117,19 @@ needs_exe_wrapper = true | |||
117 | sys_root = @OECORE_TARGET_SYSROOT | 117 | sys_root = @OECORE_TARGET_SYSROOT |
118 | 118 | ||
119 | [host_machine] | 119 | [host_machine] |
120 | system = '${SDK_OS}' | 120 | system = '$host_system' |
121 | cpu_family = '${@meson_cpu_family("SDK_ARCH", d)}' | 121 | cpu_family = '$host_cpu_family' |
122 | cpu = '${SDK_ARCH}' | 122 | cpu = '$host_cpu' |
123 | endian = '${@meson_endian("SDK", d)}' | 123 | endian = '$host_endian' |
124 | EOF | 124 | EOF |
125 | } | ||
126 | |||
127 | do_install:append:class-nativesdk() { | ||
128 | host_system=${SDK_OS} | ||
129 | host_cpu_family=${@meson_cpu_family("SDK_ARCH", d)} | ||
130 | host_cpu=${SDK_ARCH} | ||
131 | host_endian=${@meson_endian("SDK", d)} | ||
132 | install_templates | ||
125 | 133 | ||
126 | install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d | 134 | install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d |
127 | install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ | 135 | install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ |
@@ -132,3 +140,19 @@ EOF | |||
132 | } | 140 | } |
133 | 141 | ||
134 | FILES:${PN}:append:class-nativesdk = "${datadir}/meson ${SDKPATHNATIVE}" | 142 | FILES:${PN}:append:class-nativesdk = "${datadir}/meson ${SDKPATHNATIVE}" |
143 | |||
144 | do_install:append:class-native() { | ||
145 | host_system=${HOST_OS} | ||
146 | host_cpu_family=${@meson_cpu_family("HOST_ARCH", d)} | ||
147 | host_cpu=${HOST_ARCH} | ||
148 | host_endian=${@meson_endian("HOST", d)} | ||
149 | install_templates | ||
150 | |||
151 | install -d ${D}${datadir}/post-relocate-setup.d | ||
152 | install -m 0755 ${WORKDIR}/meson-setup.py ${D}${datadir}/post-relocate-setup.d/ | ||
153 | |||
154 | # We need to wrap the real meson with a thin wrapper that substitues native/cross files | ||
155 | # when running in a direct SDK environment. | ||
156 | mv ${D}${bindir}/meson ${D}${bindir}/meson.real | ||
157 | install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson | ||
158 | } | ||