diff --git a/recipes/x11/xcb-util-image/recipe.toml b/recipes/x11/xcb-util-image/recipe.toml index 93ce6b43ea..3003da494a 100644 --- a/recipes/x11/xcb-util-image/recipe.toml +++ b/recipes/x11/xcb-util-image/recipe.toml @@ -6,6 +6,14 @@ version = "0.4.1" tar = "https://www.x.org/releases/individual/lib/xcb-util-image-0.4.1.tar.xz" blake3 = "c8a0652f7c215bd312d9f238aed2ba6a122f087b623dafbbac4456f5351df603" script = """ +# Drop the test/ subdirectory before regenerating. Upstream builds +# test/test_xcb_image_shm unconditionally (Makefile.am:15 SUBDIRS = image test), +# and it uses SysV shared memory, which Redox does not provide: +# make[2]: *** [Makefile:655: test_xcb_image_shm] Error 1 +# The LIBRARY itself (image/) has no such dependency -- configure only probes +# sys/shm.h with AC_CHECK_HEADERS and adapts. So this removes a test binary, +# not functionality: xcb-util-image still builds and installs in full. +sed -i 's/^SUBDIRS = image test$/SUBDIRS = image/' Makefile.am autotools_recursive_regenerate """ @@ -13,10 +21,27 @@ autotools_recursive_regenerate dependencies = [ # XORG_MACROS_VERSION() in configure.ac -- autoreconf fails without it. "util-macros", + # libxcb here is STATIC, so its own dependencies do not propagate to + # consumers the way a shared library's DT_NEEDED would. Without these the + # link fails on libXau/libXdmcp symbols pulled in by xcb_auth.c: + # undefined reference to `XauGetBestAuthByAddr' + "libxau", + "libxdmcp", "xcb-util", ] template = "custom" script = """ DYNAMIC_INIT + +# Name libXau/libXdmcp explicitly: pkg-config's non-static --libs for xcb omits +# them (they are Libs.private), but our libxcb is a static archive so they are +# genuinely required at link time. +# +# LIBS, not LDFLAGS. autoconf emits LDFLAGS BEFORE the objects and LIBS AFTER, +# and a static archive only satisfies symbols referenced by objects that precede +# it -- with -lXau in LDFLAGS the link still failed on XauGetBestAuthByAddr even +# though libXau.a was present in the sysroot. Same ordering rule as the -lgcc +# entry in redox-toolchain.cmake and -licudata in plasma-workspace. +export LIBS="${LIBS:-} -lXau -lXdmcp" cookbook_configure """ diff --git a/src/cook/script.rs b/src/cook/script.rs index a4f562dff4..9e8f1577b2 100644 --- a/src/cook/script.rs +++ b/src/cook/script.rs @@ -55,7 +55,16 @@ COOKBOOK_AUTORECONF="autoreconf" autotools_recursive_regenerate() { for f in $(find . -name configure.ac -o -name configure.in -type f | sort); do echo "* autotools regen in '$(dirname $f)'..." - ( cd "$(dirname "$f")" && "${COOKBOOK_AUTORECONF}" -fvi "$@" -I${COOKBOOK_HOST_SYSROOT}/share/aclocal ) + # Search the RECIPE sysroot as well as the host one. Autoconf macros + # installed by a dependency (util-macros ships xorg-macros.m4) land in + # the consumer's own sysroot, not the shared host sysroot, so passing + # only COOKBOOK_HOST_SYSROOT made them invisible: + # configure.ac:10: error: must install xorg-macros 1.16.0 or later + # even with util-macros built and listed as a dependency (xcb-util-image). + ( cd "$(dirname "$f")" && ACLOCAL_PATH="${COOKBOOK_SYSROOT}/usr/share/aclocal:${COOKBOOK_SYSROOT}/share/aclocal:${ACLOCAL_PATH:-}" \ + "${COOKBOOK_AUTORECONF}" -fvi "$@" \ + -I${COOKBOOK_SYSROOT}/usr/share/aclocal \ + -I${COOKBOOK_HOST_SYSROOT}/share/aclocal ) done }