Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target based macos builds #10

Merged
merged 8 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 18 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update -y && \
sudo apt-get install -y cmake yasm
sudo apt-get install -y yasm
- name: Build
run: |
mkdir artifacts
./build-linux.sh
mv ffmpeg-*-audio-linux-* artifacts
run: ./build-linux.sh
- name: Archive production artifacts
uses: actions/upload-artifact@v1
with:
Expand All @@ -43,12 +40,9 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update -y && \
sudo apt-get install -y cmake yasm mingw-w64
sudo apt-get install -y yasm mingw-w64
- name: Build
run: |
mkdir artifacts
./build-windows.sh
mv ffmpeg-*-audio-windows-* artifacts
run: ./build-windows.sh
- name: Archive production artifacts
uses: actions/upload-artifact@v1
with:
Expand All @@ -59,61 +53,47 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
arch:
- x86_64
- arm64
# https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary#Update-the-Architecture-List-of-Custom-Makefiles
target:
- x86_64-apple-macos10.8
- arm64-apple-macos11
env:
ARCH: ${{ matrix.arch }}
TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: brew install nasm
run: brew install yasm
- name: Build
run: |
mkdir artifacts
./build-macos.sh
mv ffmpeg-*-audio-macos-** artifacts
- name: Archive production artifacts
run: ./build-macos.sh
- name: Archive artifacts
uses: actions/upload-artifact@v1
with:
name: ffmpeg-macos-${{ env.ARCH }}
name: ffmpeg-${{ matrix.target }}
path: artifacts/

release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- package-linux
- package-windows
- package-macos
steps:
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v2
with:
name: ffmpeg-linux-x86_64
path: artifacts/

- uses: actions/download-artifact@v1
with:
name: ffmpeg-windows-x86_64
path: artifacts/

- uses: actions/download-artifact@v1
with:
name: ffmpeg-macos-x86_64
path: artifacts/

- name: Make tarballs
run: |
mkdir artifacts/release/
cd artifacts/
dirs=$(find . -name 'ffmpeg-*' -type d)
for dir in $dirs
for dir in ffmpeg-*/ffmpeg-*
do
name=$(basename $dir)
tar cvzf release/$name.tar.gz $dir
tar czf release/$name.tar.gz $dir
done
ls -l release/
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: artifacts/release/*
env:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Building is done using GitHub Actions. You can find the built binaries on the re
Supported platforms:

- Linux
* x86\_64
* `x86\_64-linux-gnu`
- Windows
* x86\_64
* `x86\_64-w64-mingw32`
- macOS
* `x86_64-apple-macos10.8` (macOS Mountain Lion and newer on Intel CPU)
* `arm64-apple-macos11` (macOS Big Sur and newer on Apple M1 CPU)
6 changes: 3 additions & 3 deletions build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi

: ${ARCH?}

TARGET=ffmpeg-$FFMPEG_VERSION-audio-linux-$ARCH
OUTPUT_DIR=artifacts/ffmpeg-$FFMPEG_VERSION-audio-$ARCH-linux-gnu

case $ARCH in
x86_64)
Expand Down Expand Up @@ -66,11 +66,11 @@ trap 'rm -rf $BUILD_DIR' EXIT
cd $BUILD_DIR
tar --strip-components=1 -xf $BASE_DIR/$FFMPEG_TARBALL

FFMPEG_CONFIGURE_FLAGS+=(--prefix=$BASE_DIR/$TARGET)
FFMPEG_CONFIGURE_FLAGS+=(--prefix=$BASE_DIR/$OUTPUT_DIR)

./configure "${FFMPEG_CONFIGURE_FLAGS[@]}" || (cat ffbuild/config.log && exit 1)

make
make install

chown $(stat -c '%u:%g' $BASE_DIR) -R $BASE_DIR/$TARGET
chown $(stat -c '%u:%g' $BASE_DIR) -R $BASE_DIR/$OUTPUT_DIR
30 changes: 14 additions & 16 deletions build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,28 @@ then
curl -O $FFMPEG_TARBALL_URL
fi

: ${ARCH?}
: ${TARGET?}

OUTPUT_DIR=ffmpeg-$FFMPEG_VERSION-audio-macos-$ARCH

BUILD_DIR=$BASE_DIR/$(mktemp -d build.XXXXXXXX)
trap 'rm -rf $BUILD_DIR' EXIT

cd $BUILD_DIR
tar --strip-components=1 -xf $BASE_DIR/$FFMPEG_TARBALL

# https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary#Update-the-Architecture-List-of-Custom-Makefiles
case $ARCH in
x86_64)
TARGET="x86_64-apple-macos10.8"
case $TARGET in
x86_64-*)
ARCH="x86_64"
;;
arm64)
TARGET="arm64-apple-macos11"
arm64-*)
ARCH="arm64"
;;
*)
echo "Unknown architecture: $ARCH"
echo "Unknown target: $TARGET"
exit 1
;;
esac

OUTPUT_DIR=artifacts/ffmpeg-$FFMPEG_VERSION-audio-$TARGET

BUILD_DIR=$BASE_DIR/$(mktemp -d build.XXXXXXXX)
trap 'rm -rf $BUILD_DIR' EXIT

cd $BUILD_DIR
tar --strip-components=1 -xf $BASE_DIR/$FFMPEG_TARBALL

FFMPEG_CONFIGURE_FLAGS+=(
--cc=/usr/bin/clang
Expand Down
6 changes: 3 additions & 3 deletions build-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi

: ${ARCH?}

TARGET=ffmpeg-$FFMPEG_VERSION-audio-windows-$ARCH
OUTPUT_DIR=artifacts/ffmpeg-$FFMPEG_VERSION-audio-$ARCH-w64-mingw32

BUILD_DIR=$(mktemp -d -p $(pwd) build.XXXXXXXX)
trap 'rm -rf $BUILD_DIR' EXIT
Expand All @@ -23,7 +23,7 @@ cd $BUILD_DIR
tar --strip-components=1 -xf $BASE_DIR/$FFMPEG_TARBALL

FFMPEG_CONFIGURE_FLAGS+=(
--prefix=$BASE_DIR/$TARGET
--prefix=$BASE_DIR/$OUTPUT_DIR
--extra-cflags='-static -static-libgcc -static-libstdc++'
--target-os=mingw32
--arch=$ARCH
Expand All @@ -34,4 +34,4 @@ FFMPEG_CONFIGURE_FLAGS+=(
make
make install

chown $(stat -c '%u:%g' $BASE_DIR) -R $BASE_DIR/$TARGET
chown $(stat -c '%u:%g' $BASE_DIR) -R $BASE_DIR/$OUTPUT_DIR