#!/usr/bin/env python3 # Inside a framework, clang resolves #include "libavutil/x.h" by looking for a *framework* named libavutil, # so the shipped headers' cross-library includes are rewritten to . import sys, re, pathlib root = pathlib.Path(sys.argv[1]); n = 0 pat = re.compile(r'#include "(libavutil|libavcodec|libavformat|libavfilter|libswresample|libswscale)/([^"]+)"') for h in root.rglob('*.h'): s = h.read_text(); t, k = pat.subn(r'#include ', s) if k: h.write_text(t); n += k print(f"[ffmpeg-build] rewrote {n} cross-library includes in {root}")