summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hochstein <tom.hochstein@nxp.com>2023-03-03 14:42:36 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-20 17:20:44 +0000
commitf3e03ceeef6ddfc6307238e4690ac2b22b90e383 (patch)
treecfa40a02ae2aa96a0699a8615dc72c19ee7dcb7e
parent9cf12249aa1cee1c20133069a1a311e2250f3904 (diff)
downloadpoky-f3e03ceeef6ddfc6307238e4690ac2b22b90e383.tar.gz
meson: Fix wrapper handling of implicit setup command
From an SDK, running a meson setup build without an explicit setup command can result in a native build when a cross build is expected. The problem is in meson-wrapper where it tries to detect whether a setup command is being used. The logic looks through all arguments for a command, and the first argument it finds that doesn't start with a - is treated as the command. This doesn't work for an implicit setup command if any option with a space-separated argument exists. In this case, the argument is incorrectly selected as the command, causing the setup command options for the cross build to be excluded from the command line, and thus a native build. Improve the logic by just looking at the first argument. If it is a known comand, then record it. Otherwise just assume it is the implicit setup command. Note that this fix does not address the possibility of a new meson command. Two new echo statements are included to help the user in case of trouble: ``` ~/git/weston-imx$ meson --warnlevel 3 --prefix=/usr -Ddoc=false -Dbackend-drm-screencast-vaapi=false -Dcolor-management-lcms=false -Dpipewire=false -Dbackend-x11=false -Dxwayland=true -Dsimple-clients=all -Dbackend-wayland=false -Dbackend-default=drm -Dbackend-rdp=false -Dtest-junit-xml=false -Dlauncher-libseat=false -Dimage-jpeg=false -Dimage-webp=false -Drenderer-g2d=true build meson-wrapper: Implicit setup command assumed meson-wrapper: Running meson with setup options: " --cross-file=/opt/fsl-imx-internal-xwayland/6.1-langdale/sysroots/x86_64-pokysdk-linux/usr/share/meson/aarch64-poky-linux-meson.cross --native-file=/opt/fsl-imx-internal-xwayland/6.1-langdale/sysroots/x86_64-pokysdk-linux/usr/share/meson/meson.native " The Meson build system Version: 0.63.3 ``` (From OE-Core rev: 1f30dedee80669475557d9de5f130b7a23eaa7ec) Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 9338bd66a3c9ab5cb781f2ee588306c5b31a3cb5) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xmeta/recipes-devtools/meson/meson/meson-wrapper17
1 files changed, 8 insertions, 9 deletions
diff --git a/meta/recipes-devtools/meson/meson/meson-wrapper b/meta/recipes-devtools/meson/meson/meson-wrapper
index b65ba8e803..71c61db84f 100755
--- a/meta/recipes-devtools/meson/meson/meson-wrapper
+++ b/meta/recipes-devtools/meson/meson/meson-wrapper
@@ -13,20 +13,19 @@ fi
13# config is already in meson.cross. 13# config is already in meson.cross.
14unset CC CXX CPP LD AR NM STRIP 14unset CC CXX CPP LD AR NM STRIP
15 15
16for arg in "$@"; do 16case "$1" in
17 case "$arg" in 17setup|configure|dist|install|introspect|init|test|wrap|subprojects|rewrite|compile|devenv|env2mfile|help) MESON_CMD="$1" ;;
18 -*) continue ;; 18*) echo meson-wrapper: Implicit setup command assumed; MESON_CMD=setup ;;
19 *) SUBCMD="$arg"; break ;; 19esac
20 esac
21done
22 20
23if [ "$SUBCMD" = "setup" ] || [ -d "$SUBCMD" ]; then 21if [ "$MESON_CMD" = "setup" ]; then
24 MESON_SUB_OPTS=" \ 22 MESON_SETUP_OPTS=" \
25 --cross-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/${TARGET_PREFIX}meson.cross" \ 23 --cross-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/${TARGET_PREFIX}meson.cross" \
26 --native-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/meson.native" \ 24 --native-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/meson.native" \
27 " 25 "
26 echo meson-wrapper: Running meson with setup options: \"$MESON_SETUP_OPTS\"
28fi 27fi
29 28
30exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \ 29exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
31 "$@" \ 30 "$@" \
32 $MESON_SUB_OPTS 31 $MESON_SETUP_OPTS