Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions .agents/tools/graphics/build-in-subos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,19 @@ rm -rf "$STAGE"
mkdir -p "$SRC" "$STAGE"

# ── fetch ───────────────────────────────────────────────────────────────
TARBALL="$SRC/$(basename "$URL")"
# Cached under NAME-VERSION, not under the URL's basename.
#
# Every GitHub archive URL is `.../archive/refs/tags/v<tag>.tar.gz`, so the
# basename carries the tag and nothing about the project. Vulkan-Headers and
# Vulkan-Loader are both released as v1.4.313, so the second build found the
# first one's `v1.4.313.tar.gz` already in $SRC, skipped the download, and
# configured, built, staged, leak-checked and PACKAGED the wrong source --
# producing a `vulkan-loader` payload containing Vulkan-Headers, with every step
# reporting success. It was caught only because the resulting package had no
# lib/ directory.
#
# The basename is kept as a suffix so the file is still recognisable on disk.
TARBALL="$SRC/${NAME}-${VERSION}-$(basename "$URL")"
[[ -f "$TARBALL" ]] || {
log "fetching $(basename "$URL")"
curl -fsSL --retry 3 -o "$TARBALL" "$URL" || fail "download failed"
Expand Down Expand Up @@ -189,7 +201,22 @@ for dep in $DEPS; do
fail "--deps $dep: not installed in $XHOME (xlings install $dep)"
fi
log " dep $dep -> ${depdir#"$XHOME"/data/xpkgs/}"
if [[ -d "$depdir/lib/pkgconfig" ]]; then
# BOTH pkgconfig locations, and the second one is not a nicety.
#
# `lib/pkgconfig` is where a library puts its .pc. A PROTOCOL-ONLY package
# installs no library at all and puts its .pc in `share/pkgconfig` --
# xorgproto ships 40 of them there (xineramaproto, damageproto, ...), and
# xcb-proto is the same shape.
#
# Looking only at `lib/` therefore made every protocol package invisible to
# pkg-config while its HEADERS were still spliced in by `-I` below. That
# combination is why the gap survived: mesa builds fine, because it includes
# the headers and never asks pkg-config for a protocol module. libXinerama
# does ask, and dies on `XINERAMA_CFLAGS ... no such package` for a package
# that is sitting right there and whose headers are already on the command
# line.
for pcsrc in "$depdir/lib/pkgconfig" "$depdir/share/pkgconfig"; do
[[ -d "$pcsrc" ]] || continue
# Rewrite `prefix=` into a scratch copy rather than use the payload's
# .pc as-is. libxml2's ships `prefix=/tmp/libxml2-install` — the
# directory it was built in, on a machine that no longer exists — so
Expand All @@ -202,12 +229,15 @@ for dep in $DEPS; do
# as far as a build is concerned.
pcdir="$WORK/pc/$dep"
mkdir -p "$pcdir"
for pc in "$depdir"/lib/pkgconfig/*.pc; do
for pc in "$pcsrc"/*.pc; do
[[ -e "$pc" ]] || continue
sed "s#^prefix=.*#prefix=${depdir%/}#" "$pc" > "$pcdir/$(basename "$pc")"
done
PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:$pcdir"
fi
case ":$PKG_CONFIG_LIBDIR:" in
*":$pcdir:"*) ;;
*) PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:$pcdir" ;;
esac
done
[[ -d "$depdir/include" ]] && CPPFLAGS="$CPPFLAGS -I$depdir/include"
if [[ -d "$depdir/lib" ]]; then
# A staged copy with an RPATH, not the payload itself.
Expand Down
20 changes: 20 additions & 0 deletions .agents/tools/graphics/vendorprobe.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Does glvnd's vendor actually load, and does its entry point exist?
*
* S1 fails with zero vendors and mesa printing nothing, which narrows the
* failure to glvnd's load-then-__egl_Main step. Everything upstream of it was
* eliminated by measurement (namespaces, /usr, /dev, /sys, the dependency
* closure, JSON readability). This asks the one remaining question directly. */
#include <dlfcn.h>
#include <stdio.h>
int main(int argc, char **argv) {
if (argc < 2) { fprintf(stderr, "usage: vendorprobe <vendor.so>\n"); return 2; }
void *h = dlopen(argv[1], RTLD_LAZY | RTLD_LOCAL);
if (!h) { printf("DLOPEN=fail\nERR=%s\n", dlerror()); return 1; }
printf("DLOPEN=ok\n");
dlerror();
void *m = dlsym(h, "__egl_Main");
const char *e = dlerror();
printf("EGL_MAIN=%s\n", m ? "present" : "MISSING");
if (e) printf("DLSYM_ERR=%s\n", e);
return 0;
}
Loading
Loading