| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright 2015 The WebRTC project authors. All Rights Reserved. | 3 # Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license | 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 | 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 | 7 # tree. An additional intellectual property rights grant can be found |
| 8 # in the file PATENTS. All contributing project authors may | 8 # in the file PATENTS. All contributing project authors may |
| 9 # be found in the AUTHORS file in the root of the source tree. | 9 # be found in the AUTHORS file in the root of the source tree. |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 function build_webrtc { | 30 function build_webrtc { |
| 31 local target_arch=$1 | 31 local target_arch=$1 |
| 32 local flavor=$2 | 32 local flavor=$2 |
| 33 local build_type=$3 | 33 local build_type=$3 |
| 34 local ios_deployment_target=$4 | 34 local ios_deployment_target=$4 |
| 35 local libvpx_build_vp9=$5 | 35 local libvpx_build_vp9=$5 |
| 36 local custom_gn_options=$6 | 36 local custom_gn_options=$6 |
| 37 | 37 |
| 38 OUTPUT_DIR=${SDK_OUTPUT_DIR}/${target_arch}_libs | 38 OUTPUT_DIR=${SDK_OUTPUT_DIR}/${target_arch}_libs |
| 39 GN_ARGS="target_os=\"ios\" ios_enable_code_signing=false \ | 39 GN_ARGS="target_os=\"ios\" ios_enable_code_signing=false \ |
| 40 use_xcode_clang=true is_component_build=false" | 40 use_xcode_clang=true is_component_build=false rtc_ios_enable_bitcode=true" |
| 41 | 41 |
| 42 # Add flavor option. | 42 # Add flavor option. |
| 43 if [[ ${flavor} = "debug" ]]; then | 43 if [[ ${flavor} = "debug" ]]; then |
| 44 GN_ARGS="${GN_ARGS} is_debug=true" | 44 GN_ARGS="${GN_ARGS} is_debug=true" |
| 45 elif [[ ${flavor} = "release" ]]; then | 45 elif [[ ${flavor} = "release" ]]; then |
| 46 GN_ARGS="${GN_ARGS} is_debug=false" | 46 GN_ARGS="${GN_ARGS} is_debug=false" |
| 47 else | 47 else |
| 48 echo "Unexpected flavor type: ${flavor}" | 48 echo "Unexpected flavor type: ${flavor}" |
| 49 exit 1 | 49 exit 1 |
| 50 fi | 50 fi |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 echo " -r Specifies a revision number to embed if building the framework." | 99 echo " -r Specifies a revision number to embed if building the framework." |
| 100 exit 0 | 100 exit 0 |
| 101 } | 101 } |
| 102 | 102 |
| 103 SDK_OUTPUT_DIR=${WEBRTC_BASE_DIR}/out_ios_libs | 103 SDK_OUTPUT_DIR=${WEBRTC_BASE_DIR}/out_ios_libs |
| 104 SDK_LIB_NAME="librtc_sdk_objc.a" | 104 SDK_LIB_NAME="librtc_sdk_objc.a" |
| 105 SDK_FRAMEWORK_NAME="WebRTC.framework" | 105 SDK_FRAMEWORK_NAME="WebRTC.framework" |
| 106 | 106 |
| 107 BUILD_FLAVOR="release" | 107 BUILD_FLAVOR="release" |
| 108 BUILD_TYPE="framework" | 108 BUILD_TYPE="framework" |
| 109 ENABLED_ARCHITECTURES=("arm" "arm64" "x64") |
| 109 IOS_DEPLOYMENT_TARGET="8.0" | 110 IOS_DEPLOYMENT_TARGET="8.0" |
| 110 LIBVPX_BUILD_VP9="false" | 111 LIBVPX_BUILD_VP9="false" |
| 111 CUSTOM_GN_OPTS="" | 112 CUSTOM_GN_OPTS="" |
| 112 WEBRTC_REVISION="0" | 113 WEBRTC_REVISION="0" |
| 113 | 114 |
| 114 # Parse arguments. | 115 # Parse arguments. |
| 115 while getopts "hb:co:r:" opt; do | 116 while getopts "hb:co:r:" opt; do |
| 116 case "${opt}" in | 117 case "${opt}" in |
| 117 h) usage;; | 118 h) usage;; |
| 118 b) BUILD_TYPE="${OPTARG}";; | 119 b) BUILD_TYPE="${OPTARG}";; |
| 119 c) PERFORM_CLEAN=1;; | 120 c) PERFORM_CLEAN=1;; |
| 120 o) SDK_OUTPUT_DIR="${OPTARG}";; | 121 o) SDK_OUTPUT_DIR="${OPTARG}";; |
| 121 r) WEBRTC_REVISION="${OPTARG}";; | 122 r) WEBRTC_REVISION="${OPTARG}";; |
| 122 *) | 123 *) |
| 123 usage | 124 usage |
| 124 exit 1 | 125 exit 1 |
| 125 ;; | 126 ;; |
| 126 esac | 127 esac |
| 127 done | 128 done |
| 128 | 129 |
| 129 if [[ ${PERFORM_CLEAN} -ne 0 ]]; then | 130 if [[ ${PERFORM_CLEAN} -ne 0 ]]; then |
| 130 clean_artifacts ${SDK_OUTPUT_DIR} | 131 clean_artifacts ${SDK_OUTPUT_DIR} |
| 131 exit 0 | 132 exit 0 |
| 132 fi | 133 fi |
| 133 | 134 |
| 134 # Build all architectures. | 135 # Build all architectures. |
| 135 build_webrtc "arm" ${BUILD_FLAVOR} ${BUILD_TYPE} \ | 136 for arch in ${ENABLED_ARCHITECTURES[*]}; do |
| 136 ${IOS_DEPLOYMENT_TARGET} ${LIBVPX_BUILD_VP9} ${CUSTOM_GN_OPTS} | 137 build_webrtc $arch ${BUILD_FLAVOR} ${BUILD_TYPE} \ |
| 137 build_webrtc "arm64" ${BUILD_FLAVOR} ${BUILD_TYPE} \ | 138 ${IOS_DEPLOYMENT_TARGET} ${LIBVPX_BUILD_VP9} ${CUSTOM_GN_OPTS} |
| 138 ${IOS_DEPLOYMENT_TARGET} ${LIBVPX_BUILD_VP9} ${CUSTOM_GN_OPTS} | 139 done |
| 139 build_webrtc "x64" ${BUILD_FLAVOR} ${BUILD_TYPE} \ | |
| 140 ${IOS_DEPLOYMENT_TARGET} ${LIBVPX_BUILD_VP9} ${CUSTOM_GN_OPTS} | |
| 141 | 140 |
| 142 # Ignoring x86 except for static libraries for now because of a GN build issue | 141 # Ignoring x86 except for static libraries for now because of a GN build issue |
| 143 # where the generated dynamic framework has the wrong architectures. | 142 # where the generated dynamic framework has the wrong architectures. |
| 144 | 143 |
| 145 # Create FAT archive. | 144 # Create FAT archive. |
| 146 if [[ ${BUILD_TYPE} = "static_only" ]]; then | 145 if [[ ${BUILD_TYPE} = "static_only" ]]; then |
| 147 build_webrtc "x86" ${BUILD_FLAVOR} ${BUILD_TYPE} \ | 146 build_webrtc "x86" ${BUILD_FLAVOR} ${BUILD_TYPE} \ |
| 148 ${IOS_DEPLOYMENT_TARGET} ${LIBVPX_BUILD_VP9} ${CUSTOM_GN_OPTS} | 147 ${IOS_DEPLOYMENT_TARGET} ${LIBVPX_BUILD_VP9} ${CUSTOM_GN_OPTS} |
| 149 | 148 |
| 150 ARM_LIB_PATH=${SDK_OUTPUT_DIR}/arm_libs/${SDK_LIB_NAME} | 149 ARM_LIB_PATH=${SDK_OUTPUT_DIR}/arm_libs/${SDK_LIB_NAME} |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 VERSION_NUMBER="${MAJOR_MINOR}.${WEBRTC_REVISION}" | 196 VERSION_NUMBER="${MAJOR_MINOR}.${WEBRTC_REVISION}" |
| 198 echo "Substituting revision number: ${VERSION_NUMBER}" | 197 echo "Substituting revision number: ${VERSION_NUMBER}" |
| 199 PlistBuddy -c "Set :CFBundleVersion ${VERSION_NUMBER}" ${INFOPLIST_PATH} | 198 PlistBuddy -c "Set :CFBundleVersion ${VERSION_NUMBER}" ${INFOPLIST_PATH} |
| 200 plutil -convert binary1 ${INFOPLIST_PATH} | 199 plutil -convert binary1 ${INFOPLIST_PATH} |
| 201 else | 200 else |
| 202 echo "BUILD_TYPE ${BUILD_TYPE} not supported." | 201 echo "BUILD_TYPE ${BUILD_TYPE} not supported." |
| 203 exit 1 | 202 exit 1 |
| 204 fi | 203 fi |
| 205 | 204 |
| 206 echo "Done." | 205 echo "Done." |
| OLD | NEW |