xcb-util-image: build for Redox; search recipe sysroot for autoconf macros

Three separate defects, one per class:

1. script.rs passed autoreconf only -I${COOKBOOK_HOST_SYSROOT}/share/aclocal, so
   macros installed by a DEPENDENCY into the per-recipe sysroot were invisible.
   util-macros was built and declared as a dependency, yet configure still said
     configure.ac:10: error: must install xorg-macros 1.16.0 or later
   Now also searches ${COOKBOOK_SYSROOT}/usr/share/aclocal and exports
   ACLOCAL_PATH. Fixed generically -- every autotools recipe benefits.

2. Upstream builds test/test_xcb_image_shm unconditionally (Makefile.am:15
   SUBDIRS = image test) and it needs SysV shared memory, which Redox lacks.
   The library itself does not: configure only probes sys/shm.h and adapts. So
   dropping test/ removes a test binary, not functionality.

3. libxcb is a STATIC archive here, so its libXau/libXdmcp dependencies do not
   propagate to consumers as a shared library's DT_NEEDED would:
     xcb_auth.c: undefined reference to `XauGetBestAuthByAddr'
   Named them via LIBS, not LDFLAGS: autoconf emits LDFLAGS BEFORE the objects
   and LIBS AFTER, and a static archive only satisfies symbols referenced by
   objects preceding it. With -lXau in LDFLAGS the link still failed while
   libXau.a sat in the sysroot. Same ordering rule as -lgcc in
   redox-toolchain.cmake and -licudata in plasma-workspace -- third occurrence.

Verified: cook xcb-util-image - successful, libxcb-image.a staged.
This commit is contained in:
2026-08-05 00:52:14 +03:00
parent a55e1d6bd9
commit ab9ccae80f
2 changed files with 35 additions and 1 deletions
+25
View File
@@ -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
"""
+10 -1
View File
@@ -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
}