From 66ec33c5d2bfd2c0b1ff9b1c6a582577372bc936 Mon Sep 17 00:00:00 2001 From: Joshua Tam <297250+joshuatam@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:33:36 +0800 Subject: [PATCH] android: build Xwayland from an explicit source dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `meson setup` takes the *current directory* as the source tree when it is given a single positional argument, and this script never changed directory. So the build dir it configures depends on where the caller happens to stand: run it from the gamescope checkout — which gamescope's package script now does on every pack — and meson configures gamescope's tree into `build-android` with Xwayland's cross file. Xwayland's cross file defines only `c`; gamescope's meson.build is C++, so compiler detection fails with meson.build:1:0: ERROR: 'cpp' compiler binary not defined in cross file and the reported source dir in that error is gamescope's, not this tree's. Both directories are now named on the command line, matching what the xkbcomp setup in the same script already did, so the build dir is configured against Xwayland wherever the script is invoked from. The failure is non-destructive — meson aborts during compiler detection, before writing coredata.dat, so an existing build dir keeps its correct source dir. Verified from both directories: `Source dir: .../gamenative-xwayland`, then `ninja: no work to do.` and rc 0, from the gamescope checkout and from this one, with `build-android/hw/xwayland/Xwayland` left intact. --- android/build-xwayland.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/build-xwayland.sh b/android/build-xwayland.sh index 6ba60cad3..c9e12a8cd 100755 --- a/android/build-xwayland.sh +++ b/android/build-xwayland.sh @@ -99,7 +99,13 @@ if [ -d "$XS_DIR/build-android/meson-info" ]; then elif [ -d "$XS_DIR/build-android" ]; then rm -rf "$XS_DIR/build-android" fi -meson setup "$XS_DIR/build-android" \ +# Both directories are named rather than relying on the caller's cwd: with one +# positional argument meson takes the *current* directory as the source tree, and +# this script is called from other trees (gamescope's package script runs it from +# the gamescope checkout), where the build dir then gets configured against the +# wrong source — 'cpp compiler binary not defined', because Xwayland's cross file +# is C-only and gamescope's meson.build is C++. +meson setup "$XS_DIR/build-android" "$XS_DIR" \ --cross-file "$XS_DIR/android/cross/aarch64-linux-android.txt" \ -Dprefix="$RUNTIME" \ -Dxvfb=false \