build(darwin): add macOS arm64 support with VideoToolbox #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Enable FFmpeg and 20 dependencies to build on macOS arm64 within the Nix development environment, with full x264 assembly optimisation and VideoToolbox hardware encoder support.
Changes
AS=clangfor x264 on arm64 to ensure C preprocessor expands assembly macrosgit_versionfeature to avoid libgit2/libiconv dependency-nostdinc++and explicit libc++ pathNIX_CFLAGS_COMPILEto prevent incorrect-isysteminjection/usr/bin/libtoolinstead of GNU libtool for library combiningLIBCXX_INCLUDEfrom flake.nix for C++ dependency buildsRoot Cause
Nix dev shell provides both GCC and Clang, but
CGO_CFLAGSpoints to Clang's builtin headers containing preprocessor features (__has_feature,__building_module) that GCC doesn't recognise. Additionally, x264's aarch64 assembly uses macros requiring C preprocessor expansion, which the bareascommand skips.Testing
lib/darwin_arm64/libffmpeg.a(63MB)Known Limitations
just generaterequires Linux (go-clang bindings incompatible with macOS libclang blocks)