build iOS 🍏 #314
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'build iOS 🍏' | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
schedule: | |
- cron: "0 0 * * 6" # Run every Saturday at midnight | |
jobs: | |
ios-build: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64, arm64] | |
ffmpeg_version: ["6.1.1", "7.0"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
brew install meson nasm jq pkg-config | |
- name: Get ffmpeg source code | |
run: | | |
wget https://ffmpeg.org/releases/ffmpeg-${{ matrix.ffmpeg_version }}.tar.xz | |
tar -xf ffmpeg-${{ matrix.ffmpeg_version }}.tar.xz | |
- name: Compile ffmpeg source with the Xcode toolchain for ios & install it to a specific directory | |
run: | | |
if [ ${{ matrix.arch }} == "x86_64" ]; then | |
PLATFORM="iphonesimulator" | |
IOS_VERSION=$(xcrun simctl list runtimes iOS -j|jq '.runtimes|last.version') | |
CFLAGS="-arch ${{ matrix.arch }} -mios-simulator-version-min=$IOS_VERSION" | |
elif [ ${{ matrix.arch }} == "arm64" ]; then | |
PLATFORM="iphoneos" | |
IOS_VERSION=$(xcrun --sdk $PLATFORM --show-sdk-version) | |
CFLAGS="-arch ${{ matrix.arch }} -mios-version-min=$IOS_VERSION" | |
else | |
echo "Unknown architecture ${{ matrix.arch }}" | |
exit 1 | |
fi | |
SDK=$(xcrun --sdk $PLATFORM --show-sdk-path) | |
LDFLAGS="$CFLAGS" | |
cd ffmpeg-${{ matrix.ffmpeg_version }} | |
./configure \ | |
--disable-everything --disable-doc --disable-static --disable-autodetect --disable-programs \ | |
--enable-shared --enable-cross-compile \ | |
--enable-avdevice --enable-swresample ${{ matrix.ff_opts }} \ | |
--enable-filter=aresample,aformat,asetnsamples,asettb,copy,format,scale,settb \ | |
--enable-demuxer=image_jpeg_pipe,matroska \ | |
--enable-decoder=mjpeg,flac,h264 \ | |
--enable-parser=h264,mjpeg,flac \ | |
--enable-protocol=file \ | |
--target-os=darwin \ | |
--arch=${{ matrix.arch }} \ | |
--sysroot=$SDK \ | |
--extra-cflags="$CFLAGS" \ | |
--extra-ldflags="$LDFLAGS" \ | |
--prefix=$HOME/ffmpeg-install-${{ matrix.ffmpeg_version }} | |
make install -j $(sysctl -n hw.ncpu) | |
- name: Build nope.media for ios | |
run: | | |
PKG_CONFIG_LIBDIR=$HOME/ffmpeg-install-${{ matrix.ffmpeg_version }}/lib/pkgconfig \ | |
LDFLAGS="$LDFLAGS -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/" \ | |
meson setup --cross-file .github/meson-ios-${{ matrix.arch }}.ini builddir | |
meson compile -C builddir -v | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios-shared-logs | |
path: builddir/meson-logs |