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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
47 changes: 24 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,31 @@
# 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:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
defaults:
run:
working-directory: ./build
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=blaze/m137-patching
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="
treat_warnings_as_errors = false
ios_enable_code_signing = false
is_component_build = false
rtc_enable_symbol_export = true
rtc_libvpx_build_vp9 = true
rtc_include_tests = false
rtc_build_examples = false
rtc_use_h264 = false
rtc_enable_protobuf = false
enable_libaom = true
rtc_include_dav1d_in_internal_decoder_factory = true
use_rtti = true
is_debug = $DEBUG
enable_dsyms = $DEBUG
enable_stripping = 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
124 changes: 124 additions & 0 deletions build/patches/apple_prefix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
diff --git forkSrcPrefix/sdk/objc/base/RTCMacros.h forkDstPrefix/sdk/objc/base/RTCMacros.h
index 09418b86ac77a1a1dc8672775ce05bca0061377d..269e8acd718e51c65fba57304bee03ce6d94db80 100644
--- forkSrcPrefix/sdk/objc/base/RTCMacros.h
+++ forkDstPrefix/sdk/objc/base/RTCMacros.h
@@ -40,13 +40,9 @@
// problem.
//
// This macro must be defined uniformily across all the translation units.
-#ifndef RTC_OBJC_TYPE_PREFIX
-#define RTC_OBJC_TYPE_PREFIX
-#endif
+#define RTC_OBJC_TYPE_PREFIX LK

-#ifndef RTC_CONSTANT_TYPE_PREFIX
-#define RTC_CONSTANT_TYPE_PREFIX k
-#endif
+#define RTC_CONSTANT_TYPE_PREFIX kLK

// RCT_OBJC_TYPE
//
diff --git forkSrcPrefix/sdk/BUILD.gn forkDstPrefix/sdk/BUILD.gn
index a710d600d671a97b355467269907c1cde4c50e0c..3af067c7929640b5afc443eefd95152315d90286 100644
--- forkSrcPrefix/sdk/BUILD.gn
+++ forkDstPrefix/sdk/BUILD.gn
@@ -1409,7 +1409,7 @@ if (is_ios || is_mac) {
if (is_ios) {
apple_framework_bundle_with_umbrella_header("framework_objc") {
info_plist = "objc/Info.plist"
- output_name = "WebRTC"
+ output_name = "LiveKitWebRTC"

common_objc_headers = [
"objc/base/RTCCodecSpecificInfo.h",
@@ -1579,7 +1579,7 @@ if (is_ios || is_mac) {

bundle_data("ios_framework_bundle") {
deps = [ "../sdk:framework_objc" ]
- sources = [ "$root_build_dir/WebRTC.framework" ]
+ sources = [ "$root_build_dir/LiveKitWebRTC.framework" ]
outputs = [ "{{bundle_resources_dir}}/Frameworks/{{source_file_part}}" ]
}
}
@@ -1587,7 +1587,7 @@ if (is_ios || is_mac) {
if (is_mac) {
apple_framework_bundle_with_umbrella_header("mac_framework_objc") {
info_plist = "objc/Info.plist"
- output_name = "WebRTC"
+ output_name = "LiveKitWebRTC"

sources = [
"objc/api/peerconnection/RTCAudioDeviceModule.h",
@@ -1735,7 +1735,7 @@ if (is_ios || is_mac) {

bundle_data("mac_framework_bundle") {
deps = [ "../sdk:mac_framework_objc" ]
- sources = [ "$root_build_dir/WebRTC.framework" ]
+ sources = [ "$root_build_dir/LiveKitWebRTC.framework" ]
outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
}
}
diff --git forkSrcPrefix/tools_webrtc/ios/generate_umbrella_header.py forkDstPrefix/tools_webrtc/ios/generate_umbrella_header.py
index 1fd1eed38eedd64b11302c962d24c0cb0f60dc99..055732e044d61af98bec7c71949c18f84c54ea79 100644
--- forkSrcPrefix/tools_webrtc/ios/generate_umbrella_header.py
+++ forkDstPrefix/tools_webrtc/ios/generate_umbrella_header.py
@@ -41,7 +41,7 @@ def GenerateUmbrellaHeader():
*/\n\n""" % datetime.datetime.now().year))

for s in args.sources:
- outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s)))
+ outfile.write("#import <LiveKitWebRTC/{}>\n".format(os.path.basename(s)))

return 0

diff --git forkSrcPrefix/tools_webrtc/apple/copy_framework_header.py forkDstPrefix/tools_webrtc/apple/copy_framework_header.py
index 3574a67d2a243d4f95217b0a9e855f08b437c739..a68f22d887cbf798c4546ef4937fab75fd03e8ba 100755
--- forkSrcPrefix/tools_webrtc/apple/copy_framework_header.py
+++ forkDstPrefix/tools_webrtc/apple/copy_framework_header.py
@@ -20,7 +20,7 @@ def _ReplaceDoubleQuote(line):
if not match:
return line

- return '%s#import <WebRTC/%sRTC%s.h>%s' % (match.group(1), match.group(3),
+ return '%s#import <LiveKitWebRTC/%sRTC%s.h>%s' % (match.group(1), match.group(3),
match.group(4), match.group(5))


diff --git forkSrcPrefix/sdk/objc/Info.plist forkDstPrefix/sdk/objc/Info.plist
index 38c437e7feda9bfa1ee8aafb864174af1c891913..814989d53484f2b009f08ccfd2c6d0ad60e6f5ce 100644
--- forkSrcPrefix/sdk/objc/Info.plist
+++ forkDstPrefix/sdk/objc/Info.plist
@@ -5,13 +5,13 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
- <string>WebRTC</string>
+ <string>LiveKitWebRTC</string>
<key>CFBundleIdentifier</key>
- <string>org.webrtc.WebRTC</string>
+ <string>io.livekit.LiveKitWebRTC</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
- <string>WebRTC</string>
+ <string>LiveKitWebRTC</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
diff --git forkSrcPrefix/tools_webrtc/ios/build_ios_libs.py forkDstPrefix/tools_webrtc/ios/build_ios_libs.py
index 50c9398e1739dd765f02e097e7d04544a70221bd..53dc1b12d775b348a40acbf35242a719ec731dc4 100755
--- forkSrcPrefix/tools_webrtc/ios/build_ios_libs.py
+++ forkDstPrefix/tools_webrtc/ios/build_ios_libs.py
@@ -27,9 +27,9 @@ sys.path.append(os.path.join(SRC_DIR, 'build'))
import find_depot_tools

SDK_OUTPUT_DIR = os.path.join(SRC_DIR, 'out_ios_libs')
-SDK_FRAMEWORK_NAME = 'WebRTC.framework'
-SDK_DSYM_NAME = 'WebRTC.dSYM'
-SDK_XCFRAMEWORK_NAME = 'WebRTC.xcframework'
+SDK_FRAMEWORK_NAME = 'LiveKitWebRTC.framework'
+SDK_DSYM_NAME = 'LiveKitWebRTC.dSYM'
+SDK_XCFRAMEWORK_NAME = 'LiveKitWebRTC.xcframework'

ENABLED_ARCHS = [
'device:arm64', 'simulator:arm64', 'simulator:x64',
Loading
Loading