 Chromium Code Reviews
 Chromium Code Reviews Issue 1829783003:
  Build dynamic framework with podspec for Objective-C API.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master
    
  
    Issue 1829783003:
  Build dynamic framework with podspec for Objective-C API.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 #!/bin/bash | |
| 2 | |
| 3 # Copyright 2015 The WebRTC project authors. All Rights Reserved. | |
| 4 # | |
| 5 # Use of this source code is governed by a BSD-style license | |
| 6 # that can be found in the LICENSE file in the root of the source | |
| 7 # tree. An additional intellectual property rights grant can be found | |
| 8 # in the file PATENTS. All contributing project authors may | |
| 9 # be found in the AUTHORS file in the root of the source tree. | |
| 10 | |
| 11 # Generates dynamic FAT framework for iOS in out_ios_framework. | |
| 12 | |
| 13 # Check for Darwin. | |
| 14 if [[ ! $(uname) = "Darwin" ]]; then | |
| 15 echo "OS X required." >&2 | |
| 16 fi | |
| 17 | |
| 18 # Check for iOS library build script. | |
| 19 SCRIPT_DIR=$(dirname $0) | |
| 20 WEBRTC_BASE_DIR=${SCRIPT_DIR}/../../.. | |
| 21 BUILD_WEBRTC_SCRIPT=${WEBRTC_BASE_DIR}/webrtc/build/ios/build_ios_libs.sh | |
| 22 if [[ ! -x ${BUILD_WEBRTC_SCRIPT} ]]; then | |
| 23 echo "Failed to find iOS library build script." >&2 | |
| 24 exit 1 | |
| 25 fi | |
| 26 # Check for flatten iOS headers script. | |
| 27 FLATTEN_HEADERS_SCRIPT=${WEBRTC_BASE_DIR}/webrtc/build/ios/flatten_ios_headers.p y | |
| 28 if [[ ! -x ${FLATTEN_HEADERS_SCRIPT} ]]; then | |
| 29 echo "Failed to find flatten iOS headers script." >&2 | |
| 30 exit 1 | |
| 31 fi | |
| 32 | |
| 33 pushd ${WEBRTC_BASE_DIR} | |
| 34 | |
| 35 # Build static libraries for iOS. | |
| 36 ${BUILD_WEBRTC_SCRIPT} | |
| 
tkchin_webrtc
2016/03/23 17:52:55
check for return code and exit if failure
 
hjon_webrtc
2016/03/25 00:09:46
Done.
 | |
| 37 | |
| 38 # Flatten the directory structure for iOS headers. | |
| 39 ${FLATTEN_HEADERS_SCRIPT} | |
| 
tkchin_webrtc
2016/03/23 17:52:55
ditto
 
hjon_webrtc
2016/03/25 00:09:46
Done.
 | |
| 40 | |
| 41 # Replace full paths for headers with framework paths. | |
| 42 sed -E -i '' 's/"webrtc\/(api|base)\/objc\/(.*)"/<WebRTC\/\2>/g' out_ios_framewo rk/include/*.h | |
| 
tkchin_webrtc
2016/03/23 17:52:55
This will be hard to maintain as we include more f
 
hjon_webrtc
2016/03/25 00:09:46
Done.
 | |
| 43 | |
| 44 # Build the framework. | |
| 45 pushd webrtc/build/ios/webrtc/WebRTC | |
| 46 xcodebuild -project WebRTC.xcodeproj -scheme WebRTC -configuration Release build | |
| 47 xcodebuild -project WebRTC.xcodeproj -scheme WebRTC -destination 'platform=iOS S imulator,name=iPhone 6' -configuration Release build | |
| 
tkchin_webrtc
2016/03/23 17:52:56
nit: same order of arguments
Do these build both a
 
hjon_webrtc
2016/03/25 00:09:46
Done. Correct, the first builds armv7/arm64 and th
 | |
| 48 popd | |
| 49 | |
| 50 # Copy podspec and framework to out_ios_framework | |
| 51 cp webrtc/build/ios/webrtc/WebRTC.podspec out_ios_framework/ | |
| 52 cp -R webrtc/build/ios/webrtc/WebRTC/build/Release-iphoneos/WebRTC.framework out _ios_framework/ | |
| 53 | |
| 54 # Remove _CodeSignature for distribution | |
| 55 rm -R out_ios_framework/WebRTC.framework/_CodeSignature | |
| 
tkchin_webrtc
2016/03/23 17:52:56
Does this work? Is code signature just that direct
 
hjon_webrtc
2016/03/25 00:09:46
From everything I've tested so far, it does seem t
 | |
| 56 | |
| 57 # Combine multiple architectures | |
| 58 lipo out_ios_framework/WebRTC.framework/WebRTC webrtc/build/ios/webrtc/WebRTC/bu ild/Release-iphonesimulator/WebRTC.framework/WebRTC -create -output out_ios_fram ework/WebRTC.framework/WebRTC | |
| 59 | |
| 60 popd | |
| OLD | NEW |