#!/bin/sh # Print zig's bundled Linux userspace headers directory. # # `v4l2r` and any other bindgen build script want `linux/videodev2.h`, which # lives in /usr/include on a machine with kernel headers installed and nowhere # at all on one without. zig ships its own copy, and since everything here is # already compiled by zig, using them keeps the promise the toolchain makes: # this workspace builds with no system C toolchain and no system headers. # # The path is derived rather than written down — it moves with every zig # version, and a hard-coded one is a build that breaks on the next upgrade. zig="$(dirname "$0")/zig" # Resolve through DotSlash, which prints the real binary when asked. real="$("$zig" --help >/dev/null 2>&1 && command -v "$zig")" lib="$(dirname "$(readlink -f "$(ls -d "$HOME"/.cache/dotslash/*/*/zig-*/zig 2>/dev/null | head -1)")")/lib" [ -d "$lib/libc/include/any-linux-any" ] || exit 1 printf '%s\n' "$lib/libc/include/any-linux-any"