Skip to content

android: build Xwayland from an explicit source dir - #4

Merged
joshuatam merged 1 commit into
gamenativefrom
fix/xwayland-build-source-dir
Nov 2, 2026
Merged

joshuatam merged 1 commit into
gamenativefrom
fix/xwayland-build-source-dir

Conversation

@joshuatam

Copy link
Copy Markdown
Collaborator

meson setup treats the current directory as the source tree when it is given a single positional argument, and android/build-xwayland.sh never changed directory. The build dir it configures therefore depended on where the caller stood.

That was latent while the script ran only when Xwayland was missing. With GameNative/gamescope#29 the gamescope package script runs it on every pack, from the gamescope checkout, and the failure is:

Source dir: /data/workspace/Projects/gamescope
Build dir: /data/workspace/Projects/gamenative-xwayland/build-android
meson.build:1:0: ERROR: 'cpp' compiler binary not defined in cross file [binaries] section

meson was configuring gamescope's tree into Xwayland's build dir, with Xwayland's cross file — which defines only c, while gamescope's meson.build is C++. Nothing is wrong with the cross file or the NDK, and the reported source dir is the giveaway.

Fix

Both directories are named explicitly, matching what the xkbcomp setup in the same script already did:

-meson setup "$XS_DIR/build-android" \
+meson setup "$XS_DIR/build-android" "$XS_DIR" \
     --cross-file "$XS_DIR/android/cross/aarch64-linux-android.txt" \

Verification

Run from the gamescope checkout, which is the failing case:

Source dir: /data/workspace/Projects/gamenative-xwayland
Build dir: /data/workspace/Projects/gamenative-xwayland/build-android
ninja: no work to do.

and from this repo's own directory, same result. bash -n clean; build-android/hw/xwayland/Xwayland (2 052 456 bytes) intact throughout.

The failure is non-destructive — meson aborts during compiler detection, before coredata.dat is written, so an existing build dir keeps its correct source dir and no clean is needed.

`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.
@joshuatam
joshuatam merged commit 71abafb into gamenative Nov 2, 2026
@joshuatam
joshuatam deleted the fix/xwayland-build-source-dir branch November 2, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant