From 34abdc15628d5bc5b74648d453d6b266c6f99ae3 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sun, 2 Aug 2026 05:12:02 +0300 Subject: [PATCH] xwayland: port + un-defer; systemic autotools maintainer-mode fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un-defer xwayland in config/redbear-full.toml (it is a kwin build dependency). Getting it to build required: - cook_build script.rs: cookbook_configure now defeats autotools maintainer-mode regeneration. Release tarballs ship a complete build system, but extraction timestamp skew makes make re-run the version-pinned aclocal-/automake- the tarball was generated with, which the host (a different automake) lacks ('aclocal-1.NN: command not found'). Force generated files newer than their sources (staggered mtimes) and no-op ACLOCAL/AUTOMAKE/AUTOCONF/AUTOHEADER as a safety net. This unblocked the whole X11 autotools stack (libxcb, libx11, libxfont2, libxkbfile, ...) with no per-recipe edits. - xwayland recipe: meson -> custom template so it can (1) overlay the host wayland-scanner onto the sysroot path meson resolves (the sysroot scanner is a Redox binary, unrunnable on the build host; it is a build-time-only generator emitting arch-independent C), and (2) unset COOKBOOK_DYNAMIC so the cross pkg-config resolves --static, pulling the X11 libs' Requires.private closure (xcb -> xau) — those libs are static-only on Redox (libtool has no Redox shared support), so the closure was otherwise dropped and the link failed on XauGetBestAuthByAddr/XauDisposeAuth. - os/access.c: include on __redox__ (Redox lacks SIOCGIFCONF so the uname()-based DefineSelf is compiled; relibc provides uname/struct utsname). Produces a proper Redox /usr/bin/Xwayland ELF. --- config/redbear-full.toml | 4 +- local/recipes/wayland/xwayland/recipe.toml | 41 +++++++++++++++---- .../wayland/xwayland/source/os/access.c | 4 +- src/cook/script.rs | 29 +++++++++++++ 4 files changed, 67 insertions(+), 11 deletions(-) diff --git a/config/redbear-full.toml b/config/redbear-full.toml index bdbc029ee6..e53d9ffbdc 100644 --- a/config/redbear-full.toml +++ b/config/redbear-full.toml @@ -69,7 +69,7 @@ packages = [ # (malformed hunk counts + wrong a/source vs b/source-new strip prefix) and # needs full regeneration. xwayland is X11-app compat under Wayland, NOT # required for the SDDM login / Plasma-Wayland session. Re-add once vendored. - # "xwayland", + "xwayland", ] [package_groups.kde-desktop] @@ -237,7 +237,7 @@ pam-redbear = {} polkit = {} polkit-qt6 = {} sddm = {} -# xwayland = {} # deferred — see packages[] TODO(xwayland) +xwayland = {} # D-Bus Rust bindings + media zbus = {} diff --git a/local/recipes/wayland/xwayland/recipe.toml b/local/recipes/wayland/xwayland/recipe.toml index b61918c1b1..9eb37b4c74 100644 --- a/local/recipes/wayland/xwayland/recipe.toml +++ b/local/recipes/wayland/xwayland/recipe.toml @@ -12,7 +12,7 @@ version = "24.1.8" # upstream: https://www.x.org/releases/individual/xserver/xwayland-24.1.8.tar.xz path = "source" [build] -template = "meson" +template = "custom" dependencies = [ "libpthread-stubs", "libepoxy", @@ -39,10 +39,35 @@ dependencies = [ # Per local/AGENTS.md LINUX KERNEL SOURCE POLICY: Linux as reference only. "redbear-input-headers", ] -mesonflags = [ - "-Ddrm=false", - "-Dglamor=false", - "-Dglx=false", - "-Dsecure-rpc=false", - "-Dmitshm=false", -] +script = """ +DYNAMIC_INIT + +# xwayland's hw/xwayland/meson.build resolves wayland-scanner from the cross +# wayland-scanner.pc, which reports the sysroot (Redox) binary — unrunnable on +# the build host. wayland-scanner is a build-time code generator (reads protocol +# XML, emits arch-independent C) and is never shipped, so overlay the host +# binary onto the sysroot path the generator will invoke. +if [ -x /usr/bin/wayland-scanner ]; then + cp -f /usr/bin/wayland-scanner "${COOKBOOK_SYSROOT}/usr/bin/wayland-scanner" +fi + +COOKBOOK_MESON_FLAGS+=( + -Ddrm=false + -Dglamor=false + -Dglx=false + -Dsecure-rpc=false + -Dmitshm=false +) + +# The X11 client libraries (libxcb, libXau, libXdmcp, ...) build static-only on +# Redox (libtool has no Redox shared-lib support), and their inter-lib deps live +# in pkg-config Requires.private (e.g. xcb -> xau). The cross pkg-config wrapper +# only adds --static (which pulls Requires.private) when COOKBOOK_DYNAMIC is +# unset; DYNAMIC_INIT set it, so the static closure was dropped and xwayland's +# link failed on XauGetBestAuthByAddr/XauDisposeAuth. Unset it so pkg-config +# resolves the full static closure. The genuinely-shared deps (libwayland, +# relibc) still link as .so — the extra -l entries just resolve against them. +unset COOKBOOK_DYNAMIC + +cookbook_meson +""" diff --git a/local/recipes/wayland/xwayland/source/os/access.c b/local/recipes/wayland/xwayland/source/os/access.c index 485f6a5c3c..bd199aa36d 100644 --- a/local/recipes/wayland/xwayland/source/os/access.c +++ b/local/recipes/wayland/xwayland/source/os/access.c @@ -124,7 +124,9 @@ SOFTWARE. #include #endif -#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) +#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) || defined(__redox__) +/* Redox lacks SIOCGIFCONF, so the uname()-based DefineSelf below is compiled; + * relibc provides uname()/struct utsname, so pull in the header on Redox. */ #include #endif #if defined(SYSV) && defined(__i386__) diff --git a/src/cook/script.rs b/src/cook/script.rs index f390c0d906..b61f9abc19 100644 --- a/src/cook/script.rs +++ b/src/cook/script.rs @@ -230,6 +230,35 @@ COOKBOOK_CONFIGURE_FLAGS=( COOKBOOK_MAKE="make" function cookbook_configure { + # Defeat autotools maintainer-mode regeneration. Release tarballs ship a + # complete, consistent build system, but extraction timestamp skew makes + # make think aclocal.m4/configure/Makefile.in are stale and re-run the + # version-pinned aclocal-/automake- the tarball was generated with — + # which the host (a different automake) lacks, aborting with "aclocal-1.NN: + # command not found". Force the generated files newer than their sources so + # the regen rules never fire. Harmless for recipes with no autotools files, + # and for recipes that intentionally regenerated in their [source] script + # (that fresh configure just gets forward-dated). + if [ -n "${COOKBOOK_SOURCE}" ] && [ -d "${COOKBOOK_SOURCE}" ]; then + # Stagger timestamps so each generated file is strictly newer than its + # prerequisites: sources (2000) < aclocal.m4 (2001) < configure/ + # config.h.in/Makefile.in (2002). Equal mtimes make GNU make rebuild. + find "${COOKBOOK_SOURCE}" '(' -name 'configure.ac' -o -name 'configure.in' -o -name 'Makefile.am' -o -name 'acinclude.m4' ')' -exec touch -t 200001010000 {} + 2>/dev/null || true + find "${COOKBOOK_SOURCE}" -name '*.m4' -path '*/m4/*' -exec touch -t 200001010000 {} + 2>/dev/null || true + find "${COOKBOOK_SOURCE}" -name 'aclocal.m4' -exec touch -t 200101010000 {} + 2>/dev/null || true + find "${COOKBOOK_SOURCE}" '(' -name 'configure' -o -name 'config.h.in' -o -name 'Makefile.in' ')' -exec touch -t 200201010000 {} + 2>/dev/null || true + fi + # Safety net: if make still triggers a maintainer-mode regen rule (e.g. a + # nested Makefile.in whose prereqs include host-installed m4 macros with + # newer mtimes), no-op the version-pinned autotools instead of invoking the + # absent aclocal-1.NN/automake-1.NN. configure's AM_MISSING_PROG honors these + # pre-set values, so the generated Makefiles inherit the no-ops. The shipped + # build files are already correct, so skipping regeneration is safe. + export ACLOCAL="${ACLOCAL:-true}" + export AUTOMAKE="${AUTOMAKE:-true}" + export AUTOCONF="${AUTOCONF:-true}" + export AUTOHEADER="${AUTOHEADER:-true}" + export AUTORECONF="${AUTORECONF:-true}" "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" "$@" "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" "${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}"