Forked from hiroshihorie/build_xcframework_dynamic_livekit.sh
Created
June 1, 2024 21:53
-
-
Save bcherry/1e8af93ef8e7796fb0f7bb2fb21c6a7c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| if [ ! -n "$1" ]; then | |
| echo "Usage: $0 'debug' | 'release'" | |
| exit 0 | |
| fi | |
| MODE=$1 | |
| OUT_DIR=./out-$MODE | |
| DEBUG="false" | |
| if [ "$MODE" == "debug" ]; then | |
| DEBUG="true" | |
| fi | |
| echo "build_xframework_for_darwin.sh: MODE=$MODE, DEBUG=$DEBUG" | |
| gn gen $OUT_DIR/catalyst-arm64 --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os = \"ios\" | |
| ios_enable_code_signing = false | |
| is_component_build = false | |
| target_environment = \"catalyst\" | |
| target_cpu = \"arm64\" | |
| ios_deployment_target = \"14.0\" | |
| use_goma = 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" --ide=xcode | |
| ninja -C $OUT_DIR/catalyst-arm64 ios_framework_bundle -j 10 | |
| gn gen $OUT_DIR/catalyst-x64 --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os = \"ios\" | |
| ios_enable_code_signing = false | |
| is_component_build = false | |
| target_environment = \"catalyst\" | |
| target_cpu = \"x64\" | |
| ios_deployment_target = \"14.0\" | |
| use_goma = 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" --ide=xcode | |
| ninja -C $OUT_DIR/catalyst-x64 ios_framework_bundle -j 10 | |
| gn gen $OUT_DIR/iOS-arm64-device --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os = \"ios\" | |
| ios_enable_code_signing = false | |
| is_component_build = false | |
| target_environment = \"device\" | |
| target_cpu = \"arm64\" | |
| ios_deployment_target = \"13.0\" | |
| use_goma = 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" --ide=xcode | |
| ninja -C $OUT_DIR/iOS-arm64-device ios_framework_bundle -j 10 | |
| gn gen $OUT_DIR/iOS-x64-simulator --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os = \"ios\" | |
| ios_enable_code_signing = false | |
| is_component_build = false | |
| target_environment = \"simulator\" | |
| target_cpu = \"x64\" | |
| ios_deployment_target = \"13.0\" | |
| rtc_libvpx_build_vp9 = true | |
| use_goma = false | |
| rtc_enable_symbol_export = 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" --ide=xcode | |
| ninja -C $OUT_DIR/iOS-x64-simulator ios_framework_bundle -j 10 | |
| gn gen $OUT_DIR/iOS-arm64-simulator --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os = \"ios\" | |
| ios_enable_code_signing = false | |
| is_component_build = false | |
| target_environment = \"simulator\" | |
| target_cpu = \"arm64\" | |
| ios_deployment_target = \"13.0\" | |
| use_goma = 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" --ide=xcode | |
| ninja -C $OUT_DIR/iOS-arm64-simulator ios_framework_bundle -j 10 | |
| gn gen $OUT_DIR/macOS-x64 --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os=\"mac\" | |
| target_cpu=\"x64\" | |
| mac_deployment_target=\"10.15\" | |
| is_component_build = false | |
| target_cpu = \"x64\" | |
| use_goma = 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" --ide=xcode | |
| ninja -C $OUT_DIR/macOS-x64 mac_framework_bundle -j 10 | |
| gn gen $OUT_DIR/macOS-arm64 --root="src" --args=" | |
| treat_warnings_as_errors = false | |
| target_os=\"mac\" | |
| target_cpu=\"x64\" | |
| mac_deployment_target=\"10.15\" | |
| is_component_build = false | |
| target_cpu = \"arm64\" | |
| use_goma = 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" --ide=xcode | |
| ninja -C $OUT_DIR/macOS-arm64 mac_framework_bundle -j 10 | |
| rm -rf $OUT_DIR/*-lib $OUT_DIR/LiveKitWebRTC.* | |
| mkdir -p $OUT_DIR/macOS-lib | |
| cp -R $OUT_DIR/macOS-x64/LiveKitWebRTC.framework $OUT_DIR/macOS-lib/LiveKitWebRTC.framework | |
| lipo -create -output $OUT_DIR/macOS-lib/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/macOS-arm64/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/macOS-x64/LiveKitWebRTC.framework/LiveKitWebRTC | |
| mkdir -p $OUT_DIR/catalyst-lib | |
| cp -R $OUT_DIR/catalyst-arm64/LiveKitWebRTC.framework $OUT_DIR/catalyst-lib/LiveKitWebRTC.framework | |
| lipo -create -output $OUT_DIR/catalyst-lib/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/catalyst-arm64/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/catalyst-x64/LiveKitWebRTC.framework/LiveKitWebRTC | |
| mkdir -p $OUT_DIR/iOS-device-lib | |
| cp -R $OUT_DIR/iOS-arm64-device/LiveKitWebRTC.framework $OUT_DIR/iOS-device-lib/LiveKitWebRTC.framework | |
| lipo -create -output $OUT_DIR/iOS-device-lib/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/iOS-arm64-device/LiveKitWebRTC.framework/LiveKitWebRTC | |
| mkdir -p $OUT_DIR/iOS-simulator-lib | |
| cp -R $OUT_DIR/iOS-arm64-simulator/LiveKitWebRTC.framework $OUT_DIR/iOS-simulator-lib/LiveKitWebRTC.framework | |
| lipo -create -output $OUT_DIR/iOS-simulator-lib/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/iOS-arm64-simulator/LiveKitWebRTC.framework/LiveKitWebRTC $OUT_DIR/iOS-x64-simulator/LiveKitWebRTC.framework/LiveKitWebRTC | |
| xcodebuild -create-xcframework \ | |
| -framework $OUT_DIR/iOS-device-lib/LiveKitWebRTC.framework \ | |
| -framework $OUT_DIR/iOS-simulator-lib/LiveKitWebRTC.framework \ | |
| -framework $OUT_DIR/catalyst-lib/LiveKitWebRTC.framework \ | |
| -framework $OUT_DIR/macOS-lib/LiveKitWebRTC.framework \ | |
| -output $OUT_DIR/LiveKitWebRTC.xcframework | |
| cp LICENSE $OUT_DIR/LiveKitWebRTC.xcframework/ | |
| cd $OUT_DIR/LiveKitWebRTC.xcframework/macos-arm64_x86_64/LiveKitWebRTC.framework/ | |
| mv LiveKitWebRTC Versions/A/LiveKitWebRTC | |
| ln -s Versions/Current/LiveKitWebRTC LiveKitWebRTC | |
| cd ../../../ | |
| zip --symlinks -9 -r LiveKitWebRTC.xcframework.zip LiveKitWebRTC.xcframework | |
| # hash | |
| shasum -a 256 LiveKitWebRTC.xcframework.zip >LiveKitWebRTC.xcframework.zip.shasum | |
| cat LiveKitWebRTC.xcframework.zip.shasum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment