Skip to content

Opus: Support Mac OSX Arm64 #47

Opus: Support Mac OSX Arm64

Opus: Support Mac OSX Arm64 #47

Workflow file for this run

name: Update Opus
on:
release:
types:
- published
workflow_dispatch:
push:
branches:
- master
paths:
- '.github/workflows/opus.yml'
permissions:
contents: write
jobs:
build:
name: Build Opus for ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Android Arm64",
os: ubuntu-latest,
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool gcc cmake make",
args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a",
find-file: "libopus.so",
file: "libopus.so",
rid: "android-arm64",
}
- {
name: "Linux x64 (glibc)",
os: ubuntu-latest,
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool gcc cmake make",
args: "",
find-file: "libopus.so.*.*.*",
file: "libopus.so",
rid: "linux-x64"
}
- {
name: "Linux x64 (musl)",
os: ubuntu-latest,
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool cmake make \
&& wget https://musl.cc/x86_64-linux-musl-cross.tgz \
&& tar xzf x86_64-linux-musl-cross.tgz \
&& export PATH=\"$(pwd)/x86_64-linux-musl-cross/bin:$PATH\" \
&& export CC=x86_64-linux-musl-gcc \
&& alias gcc=x86_64-linux-musl-gcc",
args: "",
find-file: "libopus.so.*.*.*",
file: "libopus.so",
rid: "linux-x64-musl"
}
- {
name: "Linux Arm64 (glibc)",
os: ubuntu-latest,
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi cmake make \
&& export CC=arm-linux-gnueabi-gcc make \
&& alias gcc=arm-linux-gnueabi-gcc",
args: "",
find-file: "libopus.so.*.*.*",
file: "libopus.so",
rid: "linux-arm64"
}
- {
name: "Linux Arm64 (musl)",
os: ubuntu-latest,
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool cmake make \
&& wget https://musl.cc/aarch64-linux-musl-cross.tgz \
&& tar xzf aarch64-linux-musl-cross.tgz \
&& export PATH=\"$(pwd)/aarch64-linux-musl-cross/bin:$PATH\" \
&& export CC=aarch64-linux-musl-gcc \
&& alias gcc=aarch64-linux-musl-gcc",
args: "",
find-file: "libopus.so.*.*.*",
file: "libopus.so",
rid: "linux-arm64-musl"
}
- {
name: "MacOS x64",
os: macos-latest,
install-deps: "brew install autoconf automake libtool gcc cmake make && export PATH=\"/usr/local/opt/make/libexec/gnubin:$PATH\"",
args: "",
find-file: "libopus.*.*.*.dylib",
file: "libopus.dylib",
rid: "osx-x64"
}
- {
name: "MacOS Arm64",
os: macos-latest,
install-deps: "brew install autoconf automake libtool gcc cmake make && export PATH=\"/usr/local/opt/make/libexec/gnubin:$PATH\"",
args: "-DCMAKE_OSX_ARCHITECTURES=arm64",
find-file: "libopus.*.*.*.dylib",
file: "libopus.dylib",
rid: "osx-arm64"
}
- {
name: "iOS",
os: macos-latest,
install-deps: "brew install autoconf automake libtool gcc cmake make && export PATH=\"/usr/local/opt/make/libexec/gnubin:$PATH\"",
args: "-G \"Unix Makefiles\" -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64",
find-file: "libopus.*.*.*.dylib",
file: "libopus.dylib",
rid: "ios-arm64"
}
- {
name: "Windows x86",
os: windows-latest,
install-deps: "",
args: "-G \"Visual Studio 17 2022\" -A Win32",
find-file: "Release/opus.dll",
file: "opus.dll",
rid: "win-x86",
arch: "x86"
}
- {
name: "Windows x64",
os: windows-latest,
install-deps: "",
args: "-G \"Visual Studio 17 2022\" -A x64",
find-file: "Release/opus.dll",
file: "opus.dll",
rid: "win-x64",
arch: "x64"
}
- {
name: "Windows Arm64",
os: windows-latest,
install-deps: "",
args: "-G \"Visual Studio 17 2022\" -A ARM64",
find-file: "Release/opus.dll",
file: "opus.dll",
rid: "win-arm64",
arch: "arm64"
}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up MSBuild
if: contains('win', matrix.config.rid)
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: ${{ matrix.config.arch }}
- name: Set up JDK 17
if: contains('android', matrix.config.rid)
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
if: contains('android', matrix.config.rid)
uses: android-actions/setup-android@v3
- name: Install dependencies
run: ${{ matrix.config.install-deps }}
- name: Build on ${{ matrix.config.name }}
shell: bash
run: |
git clone https://gitlab.xiph.org/xiph/opus libs/opus
cd libs/opus
OPUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "OPUS_VERSION=$OPUS_VERSION" >> $GITHUB_ENV
git checkout $OPUS_VERSION
cmake -S . -B build ${{ matrix.config.args }} -DOPUS_BUILD_SHARED_LIBRARY=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev
cmake --build build --config Release
mkdir -p "${{ github.workspace }}/libs/libopus/${{ matrix.config.rid }}/native"
rm -f "${{ github.workspace }}/libs/libopus/${{ matrix.config.rid }}/native/${{ matrix.config.file }}"
mv build/${{ matrix.config.find-file }} "${{ github.workspace }}/libs/libopus/${{ matrix.config.rid }}/native/${{ matrix.config.file }}"
- name: "Update ${{ matrix.config.file }}"
uses: EndBug/add-and-commit@v9
with:
add: "libs/libopus/"
default_author: github_actions
message: Update ${{ matrix.config.file }} to ${{ env.OPUS_VERSION }}
pull: '--rebase --autostash'
push: true