From 4410ab8981ed26298b0d7144aa55b0b796fa209e Mon Sep 17 00:00:00 2001
From: Philipp Bischoff
Date: Sun, 1 Nov 2026 18:24:38 +0100
Subject: [PATCH] build(xcframework): nest the CFFmpeg module map under
Headers/CFFmpeg/
Xcode copies every static xcframework's Headers/ into one
Products//include/, so a root module.modulemap collides with any
other package that ships one there. Lume hits this once it links
AetherEngine, whose LibDovi xcframework also puts module.modulemap at the
Headers root ("Multiple commands produce .../include/module.modulemap").
CFFmpeg.h, CFFmpegShim.h and module.modulemap now go to Headers/CFFmpeg/;
lume_ffmpeg/ stays at the root, where CFFmpeg.h's
includes resolve against the Headers search path.
The published v0.3.0 artifact still has the old layout: a release has to
attach a rebuilt FFmpeg.xcframework.zip before Package.swift's URL and
checksum move to it.
---
build/scripts/make-xcframework.sh | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/build/scripts/make-xcframework.sh b/build/scripts/make-xcframework.sh
index 52f9cba..b0b9801 100755
--- a/build/scripts/make-xcframework.sh
+++ b/build/scripts/make-xcframework.sh
@@ -37,9 +37,15 @@ for dirpath, _, files in os.walk(root):
with open(path, 'w') as fh:
fh.write(rewritten)
PYEOF
- cp "$BUILD_DIR/support/CFFmpeg.h" "$slice/Headers/"
- cp "$BUILD_DIR/support/CFFmpegShim.h" "$slice/Headers/"
- cp "$BUILD_DIR/support/module.modulemap" "$slice/Headers/"
+ # The module map lives in Headers/CFFmpeg/, not at the Headers root: Xcode
+ # copies every static xcframework's Headers/ into one Products//include/,
+ # so a root module.modulemap collides with any other package that ships one
+ # (LibDovi, via AetherEngine in Lume). lume_ffmpeg/ stays at the root, where
+ # CFFmpeg.h's includes resolve against the Headers search path.
+ mkdir -p "$slice/Headers/CFFmpeg"
+ cp "$BUILD_DIR/support/CFFmpeg.h" "$slice/Headers/CFFmpeg/"
+ cp "$BUILD_DIR/support/CFFmpegShim.h" "$slice/Headers/CFFmpeg/"
+ cp "$BUILD_DIR/support/module.modulemap" "$slice/Headers/CFFmpeg/"
}
# xcodebuild rejects two libraries for the same platform+variant, so arm64 and