Skip to content

Fix Apple and Android tools for m137 #32

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

Merged
merged 22 commits into from
Jul 21, 2025
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
88 changes: 64 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ on:
tags:
- '*'

permissions:
contents: write
actions: read

jobs:
# build-windows:
# defaults:
Expand Down Expand Up @@ -54,29 +58,30 @@ jobs:
# with:
# name: webrtc.${{ matrix.name }}.zip
# path: build\_package\${{ matrix.name }}\webrtc.zip
# build-macos:
# defaults:
# run:
# working-directory: ./build
# strategy:
# fail-fast: false
# matrix:
# name:
# - macos_arm64
# - macos_x86_64
# - ios
# runs-on: macos-11
# steps:
# - uses: actions/checkout@v4
# - name: Select Xcode 13.0
# run: sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer
# - run: brew install ninja
# - run: ./build.${{ matrix.name }}.sh "${{ github.event.inputs.commitHash }}"
# - name: Upload Artifact
# uses: actions/upload-artifact@v4
# with:
# name: webrtc.${{ matrix.name }}.tar.gz
# path: build/_package/${{ matrix.name }}/webrtc.tar.gz
build-apple:
defaults:
run:
working-directory: ./build
strategy:
fail-fast: false
matrix:
name:
- apple
- apple_prefixed
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16.4
- name: Build
id: build
run: ./build.${{ matrix.name }}.sh "${{ github.event.inputs.commitHash }}"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.framework_name }}.xcframework
path: build/_package/${{ matrix.name }}/${{ steps.build.outputs.framework_name }}.xcframework.zip
build-linux:
defaults:
run:
Expand Down Expand Up @@ -119,7 +124,7 @@ jobs:
if: contains(github.ref, 'tags/m')
needs:
# - build-windows
# - build-macos
- build-apple
- build-linux
runs-on: ubuntu-20.04
steps:
Expand Down Expand Up @@ -187,6 +192,41 @@ jobs:
asset_path: webrtc.${{ matrix.name }}.tar.gz/webrtc.tar.gz
asset_name: webrtc.${{ matrix.name }}.tar.gz
asset_content_type: application/gzip
upload-assets-apple:
strategy:
fail-fast: false
matrix:
name:
- WebRTC.xcframework
- LiveKitWebRTC.xcframework
name: Release ${{ matrix.name }}
if: contains(github.ref, 'tags/m')
needs:
- create-release
runs-on: ubuntu-latest
steps:
- name: Download ${{ matrix.name }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.name }}
- uses: actions/download-artifact@v4
with:
name: create-release.env
- name: Env to output
shell: bash
run: |
source create-release.env/create-release.env
echo "upload_url=$UPLOAD_URL" >> "$GITHUB_OUTPUT"
id: env
- name: Upload ${{ matrix.name }} Release Asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.env.outputs.upload_url }}
asset_path: ${{ matrix.name }}.zip
asset_name: ${{ matrix.name }}
asset_content_type: application/zip
# Windows だけ Content-Type が違うので別で記述する
# Windows has a different Content-Type, so handle it separately.
# upload-assets-windows:
Expand Down
8 changes: 4 additions & 4 deletions build/VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WEBRTC_BUILD_VERSION=125.6422.07.0
WEBRTC_VERSION=125.6422.07
WEBRTC_READABLE_VERSION=M125.6422@{#7}
WEBRTC_COMMIT=c4b376ac375710de19c1ba20157dba9b065930b0
WEBRTC_BUILD_VERSION=137.7151.00.0
WEBRTC_VERSION=137.7151.00
WEBRTC_READABLE_VERSION=M137.7151@{#0}
WEBRTC_COMMIT=m137_release
151 changes: 151 additions & 0 deletions build/apple/xcframework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#!/bin/bash

set -e

if [[ -z "$1" ]]; then
echo "Usage: $0 'debug' | 'release' 'source_dir' 'out_dir' ['prefix']"
exit 0
fi

MODE="$1"
SOURCE_DIR="$(realpath "$2")"
OUT_DIR="$(realpath "$3")"
PREFIX="${4:-""}"

if [ -z "$PREFIX" ]; then
FRAMEWORK_NAME="WebRTC"
else
FRAMEWORK_NAME="${PREFIX}WebRTC"
fi

DEBUG="false"
if [[ "$MODE" == "debug" ]]; then
DEBUG="true"
fi

PARALLEL_BUILDS=6

echo "xcframework.sh: MODE=$MODE, DEBUG=$DEBUG, SOURCE_DIR=$SOURCE_DIR, OUT_DIR=$OUT_DIR, PREFIX=$PREFIX, FRAMEWORK_NAME=$FRAMEWORK_NAME"

start_group() {
if [[ "$CI" == "true" ]]; then
echo "::group::$1"
else
echo "=== $1 ==="
fi
}

end_group() {
if [[ "$CI" == "true" ]]; then
echo "::endgroup::"
fi
}

COMMON_ARGS="
enable_dsyms = $DEBUG
enable_libaom = true
enable_stripping = true
ios_enable_code_signing = false
is_component_build = false
is_debug = $DEBUG
rtc_build_examples = false
rtc_enable_protobuf = false
rtc_enable_symbol_export = true
rtc_include_dav1d_in_internal_decoder_factory = true
rtc_include_tests = false
rtc_libvpx_build_vp9 = true
rtc_use_h264 = false
treat_warnings_as_errors = true
use_rtti = true"

PLATFORMS=(
"iOS-arm64-device:target_os=\"ios\" target_environment=\"device\" target_cpu=\"arm64\" ios_deployment_target=\"13.0\""
"iOS-arm64-simulator:target_os=\"ios\" target_environment=\"simulator\" target_cpu=\"arm64\" ios_deployment_target=\"13.0\""
"iOS-x64-simulator:target_os=\"ios\" target_environment=\"simulator\" target_cpu=\"x64\" ios_deployment_target=\"13.0\""
"macOS-arm64:target_os=\"mac\" target_cpu=\"arm64\" mac_deployment_target=\"10.15\""
"macOS-x64:target_os=\"mac\" target_cpu=\"x64\" mac_deployment_target=\"10.15\""
"catalyst-arm64:target_os=\"ios\" target_environment=\"catalyst\" target_cpu=\"arm64\" ios_deployment_target=\"14.0\""
"catalyst-x64:target_os=\"ios\" target_environment=\"catalyst\" target_cpu=\"x64\" ios_deployment_target=\"14.0\""
"tvOS-arm64-device:target_os=\"ios\" target_environment=\"appletv\" target_cpu=\"arm64\" ios_deployment_target=\"17.0\""
"tvOS-arm64-simulator:target_os=\"ios\" target_environment=\"appletvsimulator\" target_cpu=\"arm64\" ios_deployment_target=\"17.0\""
"xrOS-arm64-device:target_os=\"ios\" target_environment=\"xrdevice\" target_cpu=\"arm64\" ios_deployment_target=\"2.2.0\""
"xrOS-arm64-simulator:target_os=\"ios\" target_environment=\"xrsimulator\" target_cpu=\"arm64\" ios_deployment_target=\"2.2.0\""
)

cd "$SOURCE_DIR"

end_group

for platform_config in "${PLATFORMS[@]}"; do
platform="${platform_config%%:*}"
config="${platform_config#*:}"

start_group "Building $platform"

gn gen "$OUT_DIR/$platform" --args="$COMMON_ARGS $config" --ide=xcode

if [[ $platform == *"macOS"* ]]; then
build_target="mac_framework_bundle"
else
build_target="ios_framework_bundle"
fi

ninja -C "$OUT_DIR/$platform" "$build_target" -j $PARALLEL_BUILDS --quiet || exit 1
end_group
done

start_group "Creating universal binaries (x64 + arm64)"

mkdir -p "$OUT_DIR/macOS-lib"
cp -R "$OUT_DIR/macOS-x64/$FRAMEWORK_NAME.framework" "$OUT_DIR/macOS-lib/$FRAMEWORK_NAME.framework"
lipo -create -output "$OUT_DIR/macOS-lib/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/macOS-arm64/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/macOS-x64/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME"

mkdir -p "$OUT_DIR/catalyst-lib"
cp -R "$OUT_DIR/catalyst-arm64/$FRAMEWORK_NAME.framework" "$OUT_DIR/catalyst-lib/$FRAMEWORK_NAME.framework"
lipo -create -output "$OUT_DIR/catalyst-lib/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/catalyst-arm64/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/catalyst-x64/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME"

mkdir -p "$OUT_DIR/iOS-device-lib"
cp -R "$OUT_DIR/iOS-arm64-device/$FRAMEWORK_NAME.framework" "$OUT_DIR/iOS-device-lib/$FRAMEWORK_NAME.framework"
lipo -create -output "$OUT_DIR/iOS-device-lib/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/iOS-arm64-device/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME"

mkdir -p "$OUT_DIR/iOS-simulator-lib"
cp -R "$OUT_DIR/iOS-arm64-simulator/$FRAMEWORK_NAME.framework" "$OUT_DIR/iOS-simulator-lib/$FRAMEWORK_NAME.framework"
lipo -create -output "$OUT_DIR/iOS-simulator-lib/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/iOS-arm64-simulator/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME" "$OUT_DIR/iOS-x64-simulator/$FRAMEWORK_NAME.framework/$FRAMEWORK_NAME"

end_group

start_group "Creating XCFramework"

xcodebuild -create-xcframework \
-framework "$OUT_DIR/iOS-device-lib/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/iOS-simulator-lib/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/macOS-lib/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/catalyst-lib/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/tvOS-arm64-device/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/tvOS-arm64-simulator/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/xrOS-arm64-device/$FRAMEWORK_NAME.framework" \
-framework "$OUT_DIR/xrOS-arm64-simulator/$FRAMEWORK_NAME.framework" \
-output "$OUT_DIR/$FRAMEWORK_NAME.xcframework"

end_group

start_group "Post-processing XCFramework"

cp LICENSE "$OUT_DIR/$FRAMEWORK_NAME.xcframework/"

cd "$OUT_DIR/$FRAMEWORK_NAME.xcframework/macos-arm64_x86_64/$FRAMEWORK_NAME.framework/"
mv "$FRAMEWORK_NAME" "Versions/A/$FRAMEWORK_NAME"
ln -s "Versions/Current/$FRAMEWORK_NAME" "$FRAMEWORK_NAME"

cd "$OUT_DIR/$FRAMEWORK_NAME.xcframework/ios-arm64_x86_64-maccatalyst/$FRAMEWORK_NAME.framework/"
mv "$FRAMEWORK_NAME" "Versions/A/$FRAMEWORK_NAME"
ln -s "Versions/Current/$FRAMEWORK_NAME" "$FRAMEWORK_NAME"

cd "$OUT_DIR"
zip --symlinks -9 -r "$FRAMEWORK_NAME.xcframework.zip" "$FRAMEWORK_NAME.xcframework"

end_group

if [[ "$CI" == "true" ]]; then
echo "framework_name=$FRAMEWORK_NAME" >> "$GITHUB_OUTPUT"
fi
10 changes: 10 additions & 0 deletions build/build.apple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

cd `dirname $0`
python3 run.py build apple --commit "$1" --webrtc-fetch

export PATH="$PWD/_source/apple/depot_tools:$PATH"
mkdir -p _package/apple
. apple/xcframework.sh release _source/apple/webrtc/src _package/apple
10 changes: 10 additions & 0 deletions build/build.apple_prefixed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

cd `dirname $0`
python3 run.py build apple_prefixed --commit "$1" --webrtc-fetch

export PATH="$PWD/_source/apple_prefixed/depot_tools:$PATH"
mkdir -p _package/apple_prefixed
. apple/xcframework.sh release _source/apple_prefixed/webrtc/src _package/apple_prefixed LiveKit # prefix
Loading