| OLD | NEW | 
|---|
| 1 #!/bin/bash | 1 #!/bin/bash | 
| 2 # | 2 # | 
| 3 # libjingle | 3 # libjingle | 
| 4 # Copyright 2015 Google Inc. | 4 # Copyright 2015 Google Inc. | 
| 5 # | 5 # | 
| 6 # Redistribution and use in source and binary forms, with or without | 6 # Redistribution and use in source and binary forms, with or without | 
| 7 # modification, are permitted provided that the following conditions are met: | 7 # modification, are permitted provided that the following conditions are met: | 
| 8 # | 8 # | 
| 9 #  1. Redistributions of source code must retain the above copyright notice, | 9 #  1. Redistributions of source code must retain the above copyright notice, | 
| 10 #     this list of conditions and the following disclaimer. | 10 #     this list of conditions and the following disclaimer. | 
| 11 #  2. Redistributions in binary form must reproduce the above copyright notice, | 11 #  2. Redistributions in binary form must reproduce the above copyright notice, | 
| 12 #     this list of conditions and the following disclaimer in the documentation | 12 #     this list of conditions and the following disclaimer in the documentation | 
| 13 #     and/or other materials provided with the distribution. | 13 #     and/or other materials provided with the distribution. | 
| 14 #  3. The name of the author may not be used to endorse or promote products | 14 #  3. The name of the author may not be used to endorse or promote products | 
| 15 #     derived from this software without specific prior written permission. | 15 #     derived from this software without specific prior written permission. | 
| 16 # | 16 # | 
| 17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 
| 18 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 18 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 
| 19 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 19 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 
| 20 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 
| 22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 
| 23 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 23 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 
| 24 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 24 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 
| 25 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 25 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 
| 26 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 27 | 27 | 
| 28 # Generates static FAT libraries for ios in out_ios_libs. | 28 # Generates static FAT libraries for ios in out_ios_libs. | 
| 29 | 29 | 
|  | 30 # Flag to build the new or legacy version of the API. | 
|  | 31 USE_LEGACY_API=1 | 
|  | 32 | 
| 30 # Check for Darwin. | 33 # Check for Darwin. | 
| 31 if [[ ! $(uname) = "Darwin" ]]; then | 34 if [[ ! $(uname) = "Darwin" ]]; then | 
| 32   echo "OS/X required." >&2 | 35   echo "OS/X required." >&2 | 
| 33 fi | 36 fi | 
| 34 | 37 | 
| 35 # Check for libtool. | 38 # Check for libtool. | 
| 36 if [[ -z $(which libtool) ]]; then | 39 if [[ -z $(which libtool) ]]; then | 
| 37   echo "Missing libtool binary." >&2 | 40   echo "Missing libtool binary." >&2 | 
| 38 fi | 41 fi | 
| 39 | 42 | 
| 40 # Check for GYP generator. | 43 # Check for GYP generator. | 
| 41 SCRIPT_DIR=$(dirname $0) | 44 SCRIPT_DIR=$(dirname $0) | 
| 42 WEBRTC_BASE_DIR=${SCRIPT_DIR}/../.. | 45 WEBRTC_BASE_DIR=${SCRIPT_DIR}/../.. | 
| 43 GYP_WEBRTC_SCRIPT=${WEBRTC_BASE_DIR}/webrtc/build/gyp_webrtc | 46 GYP_WEBRTC_SCRIPT=${WEBRTC_BASE_DIR}/webrtc/build/gyp_webrtc | 
| 44 if [[ ! -x ${GYP_WEBRTC_SCRIPT} ]]; then | 47 if [[ ! -x ${GYP_WEBRTC_SCRIPT} ]]; then | 
| 45   echo "Failed to find gyp generator." >&2 | 48   echo "Failed to find gyp generator." >&2 | 
| 46   exit 1 | 49   exit 1 | 
| 47 fi | 50 fi | 
|  | 51 # Check for export headers script. | 
|  | 52 EXPORT_HEADERS_SCRIPT=${SCRIPT_DIR}/export_headers | 
|  | 53 if [[ ! -x ${EXPORT_HEADERS_SCRIPT} ]]; then | 
|  | 54   echo "Failed to find export headers script." >&2 | 
|  | 55   exit 1 | 
|  | 56 fi | 
| 48 # Check for merge script. | 57 # Check for merge script. | 
| 49 MERGE_SCRIPT=${SCRIPT_DIR}/merge_ios_libs | 58 MERGE_SCRIPT=${SCRIPT_DIR}/merge_ios_libs | 
| 50 if [[ ! -x ${MERGE_SCRIPT} ]]; then | 59 if [[ ! -x ${MERGE_SCRIPT} ]]; then | 
| 51   echo "Failed to find library merging script." >&2 | 60   echo "Failed to find library merging script." >&2 | 
| 52   exit 1 | 61   exit 1 | 
| 53 fi | 62 fi | 
| 54 | 63 | 
| 55 pushd ${WEBRTC_BASE_DIR} | 64 pushd ${WEBRTC_BASE_DIR} | 
| 56 LIBRARY_BASE_DIR="out_ios_libs" | 65 LIBRARY_BASE_DIR="out_ios_libs" | 
| 57 | 66 | 
| 58 function build_webrtc { | 67 function build_webrtc { | 
| 59   OUTPUT_DIR=$1 | 68   OUTPUT_DIR=$1 | 
| 60   FLAVOR=$2 | 69   FLAVOR=$2 | 
| 61   TARGET_ARCH=$3 | 70   TARGET_ARCH=$3 | 
| 62   TARGET_SUBARCH=$4 |  | 
| 63   if [[ ${TARGET_ARCH} = 'arm' || ${TARGET_ARCH} = 'arm64' ]]; then | 71   if [[ ${TARGET_ARCH} = 'arm' || ${TARGET_ARCH} = 'arm64' ]]; then | 
| 64     FLAVOR="${FLAVOR}-iphoneos" | 72     FLAVOR="${FLAVOR}-iphoneos" | 
| 65   else | 73   else | 
| 66     FLAVOR="${FLAVOR}-iphonesimulator" | 74     FLAVOR="${FLAVOR}-iphonesimulator" | 
| 67   fi | 75   fi | 
| 68   export GYP_DEFINES="OS=ios target_arch=${TARGET_ARCH} clang_xcode=1" | 76   export GYP_DEFINES="OS=ios target_arch=${TARGET_ARCH} clang_xcode=1" | 
| 69   export GYP_GENERATORS="ninja" | 77   export GYP_GENERATORS="ninja" | 
| 70   export GYP_GENERATOR_FLAGS="output_dir=${OUTPUT_DIR}" | 78   export GYP_GENERATOR_FLAGS="output_dir=${OUTPUT_DIR}" | 
| 71   webrtc/build/gyp_webrtc talk/build/merge_ios_libs.gyp | 79   webrtc/build/gyp_webrtc talk/build/merge_ios_libs.gyp | 
| 72   ninja -C ${OUTPUT_DIR}/${FLAVOR} libjingle_peerconnection_objc_no_op | 80   if [[ ${USE_LEGACY_API} -eq 1 ]]; then | 
|  | 81     ninja -C ${OUTPUT_DIR}/${FLAVOR} libjingle_peerconnection_objc_no_op | 
|  | 82   else | 
|  | 83     ninja -C ${OUTPUT_DIR}/${FLAVOR} webrtc_api_objc_no_op | 
|  | 84   fi | 
| 73   mkdir -p ${LIBRARY_BASE_DIR}/${TARGET_ARCH} | 85   mkdir -p ${LIBRARY_BASE_DIR}/${TARGET_ARCH} | 
| 74   mv ${OUTPUT_DIR}/${FLAVOR}/*.a ${LIBRARY_BASE_DIR}/${TARGET_ARCH} | 86   mv ${OUTPUT_DIR}/${FLAVOR}/*.a ${LIBRARY_BASE_DIR}/${TARGET_ARCH} | 
| 75 } | 87 } | 
| 76 | 88 | 
| 77 # Build all the common architectures. | 89 # Build all the common architectures. | 
| 78 build_webrtc "out_ios_arm" "Release" "arm" | 90 build_webrtc "out_ios_arm" "Release" "arm" | 
| 79 build_webrtc "out_ios_arm64" "Release" "arm64" | 91 build_webrtc "out_ios_arm64" "Release" "arm64" | 
| 80 build_webrtc "out_ios_ia32" "Release" "ia32" | 92 build_webrtc "out_ios_ia32" "Release" "ia32" | 
| 81 build_webrtc "out_ios_x86_64" "Release" "x64" | 93 build_webrtc "out_ios_x86_64" "Release" "x64" | 
| 82 | 94 | 
| 83 popd | 95 popd | 
| 84 | 96 | 
|  | 97 # Export header files. | 
|  | 98 ${EXPORT_HEADERS_SCRIPT} ${WEBRTC_BASE_DIR}/${LIBRARY_BASE_DIR} \ | 
|  | 99     ${USE_LEGACY_API} | 
|  | 100 | 
| 85 # Merge the libraries together. | 101 # Merge the libraries together. | 
| 86 ${MERGE_SCRIPT} ${WEBRTC_BASE_DIR}/${LIBRARY_BASE_DIR} | 102 ${MERGE_SCRIPT} ${WEBRTC_BASE_DIR}/${LIBRARY_BASE_DIR} | 
| OLD | NEW | 
|---|