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