Files
Daniel LynchandClaude Opus 5 1f3dc40c07 docs+build: hygiene pass — close leak risk, de-drift docs, fix build prereqs
Repo hygiene round following a full review. No shim behaviour changes.

Leak risk:
- .gitignore: ignore CLAUDE.md (personal assistant-lane config, was one
  `git add -A` away from a public commit) and scratch_obj/.

Docs vs. reality:
- shim/README.md: rewritten. It described a pre-implementation skeleton with
  "core fns are TODO stubs returning -1005", three mutually inconsistent stub
  counts, and four completed milestones listed as open. Now carries the verified
  breakdown: 438/438 exports = 371 generated stubs + 46 core + 7 layers + 2
  Vulkan queries + 12 passthru trampolines.
- TESTING.md: dropped the self-contradicting "NOT yet" block (5 of 6 items were
  done or misstated, and contradicted the same file 45 lines above). Path B now
  points at tools/desktop-harness, which exists, instead of the orphaned
  shim/tests/harness.c. Path A prereqs marked as the record they are.
- HOST.md: corrected the runtime assumption. The OpenXR runtime inside Lepton is
  SteamVR (vendor/etc/openxr/1/active_runtime.json -> vrclient.so), not Monado.
  Favourable: SteamVR emulates Oculus Touch by default and advertises the
  XR_FB_foveation family, so the existing input and foveation paths should carry
  over. The old "remaining unknowns" are resolved by Lepton's published source
  and replaced with the items to check before a first Frame boot.
- README.md: same runtime correction.
- docs/research/RECON.md: the four passages prescribing an entitlement
  NOP/stub/bypass are corrected in place rather than merely disclaimed by the
  top banner, which they contradicted.

Build correctness:
- shim/build_android.sh: missing patchelf is now fatal. It warned and exited 0,
  producing a .so that cannot resolve the OpenXR loader at runtime.
- scripts/fetch_deps.sh + packaging/build_openxr_loader.sh: pin the OpenXR and
  Vulkan header versions (were tracking `main`), overridable via OPENXR_TAG /
  VULKAN_HEADERS_TAG; require cmake for the loader build.
- packaging/steamframe_patches.sh: use the apktool.jar that fetch_deps.sh
  downloads. Its prereq check demanded an `apktool` binary on PATH that the
  documented setup never provides, so it could not run after a clean setup.
- shim/gen_stubs.sh: it reads all_exports.txt, not shim_surface.txt; comment and
  emitted banner corrected. stubs.c regenerated (banner line only).
- shim/src/core.c: split seven `if (out) ...; return ...;` one-liners. Host
  build now compiles with zero warnings, down from seven.

Verified: host build 0 warnings; gen_stubs.sh output identical on regeneration;
bash -n clean on all edited scripts; pinned header/tarball URLs return 200 and
the tag tarball extracts to the expected directory name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 02:15:10 -04:00

58 lines
2.8 KiB
Bash

#!/usr/bin/env bash
# Fetch build dependencies that aren't committed (permissively-licensed headers +
# the Android NDK). Run once after cloning.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# Pinned upstream versions. Bump deliberately, not implicitly: tracking `main` means a
# clone six months from now builds against different headers than the one that was tested.
OPENXR_TAG="${OPENXR_TAG:-release-1.1.50}"
VULKAN_HEADERS_TAG="${VULKAN_HEADERS_TAG:-v1.4.321}"
OXR="$ROOT/shim/third_party/openxr/openxr"
VK="$ROOT/shim/third_party/vulkan/vulkan"
echo "== OpenXR headers (Apache-2.0, $OPENXR_TAG) =="
mkdir -p "$OXR"
OXRBASE="https://raw.githubusercontent.com/KhronosGroup/OpenXR-SDK/$OPENXR_TAG/include/openxr"
for h in openxr.h openxr_platform.h openxr_platform_defines.h; do
curl -fsSL "$OXRBASE/$h" -o "$OXR/$h"
done
echo "== Vulkan headers (Apache-2.0, $VULKAN_HEADERS_TAG) =="
mkdir -p "$VK/vk_video"
VKBASE="https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/$VULKAN_HEADERS_TAG/include/vulkan"
for h in vulkan_core.h vk_platform.h; do curl -fsSL "$VKBASE/$h" -o "$VK/$h"; done
printf '#ifndef VULKAN_H_\n#define VULKAN_H_\n#include "vk_platform.h"\n#include "vulkan_core.h"\n#endif\n' > "$VK/vulkan.h"
VVBASE="https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/$VULKAN_HEADERS_TAG/include/vk_video"
for f in $(grep -oE 'vk_video/[a-zA-Z0-9_]+\.h' "$VK/vulkan_core.h" | sed 's|vk_video/||' | sort -u); do
curl -fsSL "$VVBASE/$f" -o "$VK/vk_video/$f"
done
mkdir -p "$ROOT/tools"; cd "$ROOT/tools"
echo "== Android NDK r27c (large ~700MB) =="
[ -d "$ROOT"/tools/android-ndk-* ] 2>/dev/null || {
curl -L -o ndk.zip "https://dl.google.com/android/repository/android-ndk-r27c-linux.zip"
unzip -q ndk.zip && rm ndk.zip; }
echo "== JDK (Temurin 21, for keytool/apksigner) =="
ls -d "$ROOT"/tools/jdk-* >/dev/null 2>&1 || {
curl -L -o jdk.tgz "https://api.adoptium.net/v3/binary/latest/21/ga/linux/x64/jdk/hotspot/normal/eclipse"
tar xzf jdk.tgz && rm jdk.tgz; }
echo "== Android build-tools (zipalign/apksigner/aapt2) =="
ls -d "$ROOT"/tools/android-[0-9]* >/dev/null 2>&1 || {
curl -L -o bt.zip "https://dl.google.com/android/repository/build-tools_r34-linux.zip"
unzip -q bt.zip && rm bt.zip; }
echo "== apktool (manifest tooling) =="
[ -f "$ROOT/tools/apktool.jar" ] || curl -fsSL -o apktool.jar \
"https://github.com/iBotPeaches/Apktool/releases/download/v2.10.0/apktool_2.10.0.jar"
echo
echo "Also needed, not fetched here: patchelf (build_android.sh) and cmake"
echo "(packaging/build_openxr_loader.sh). Install them from your distro."
echo "done. Now: shim/build_android.sh, packaging/build_openxr_loader.sh,"
echo "then packaging/repack.sh for an installable APK."
echo "NOTE: URLs are Linux-x86_64; on macOS swap the NDK/JDK/build-tools archives."