OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 # | |
3 # libjingle | |
4 # Copyright 2015 Google Inc. | |
5 # | |
6 # Redistribution and use in source and binary forms, with or without | |
7 # modification, are permitted provided that the following conditions are met: | |
8 # | |
9 # 1. Redistributions of source code must retain the above copyright notice, | |
10 # this list of conditions and the following disclaimer. | |
11 # 2. Redistributions in binary form must reproduce the above copyright notice, | |
12 # this list of conditions and the following disclaimer in the documentation | |
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 | |
15 # derived from this software without specific prior written permission. | |
16 # | |
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 | |
19 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
20 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
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, | |
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 | |
26 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | |
28 # Generates static FAT libraries for ios in out_ios_libs. | |
29 | |
30 # Flag to build the new or legacy version of the API. | |
31 USE_LEGACY_API=1 | |
32 | |
33 # Check for Darwin. | |
34 if [[ ! $(uname) = "Darwin" ]]; then | |
35 echo "OS/X required." >&2 | |
36 fi | |
37 | |
38 # Check for libtool. | |
39 if [[ -z $(which libtool) ]]; then | |
40 echo "Missing libtool binary." >&2 | |
41 fi | |
42 | |
43 # Check for GYP generator. | |
44 SCRIPT_DIR=$(dirname $0) | |
45 WEBRTC_BASE_DIR=${SCRIPT_DIR}/../.. | |
46 GYP_WEBRTC_SCRIPT=${WEBRTC_BASE_DIR}/webrtc/build/gyp_webrtc | |
47 if [[ ! -x ${GYP_WEBRTC_SCRIPT} ]]; then | |
48 echo "Failed to find gyp generator." >&2 | |
49 exit 1 | |
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 | |
57 # Check for merge script. | |
58 MERGE_SCRIPT=${SCRIPT_DIR}/merge_ios_libs | |
59 if [[ ! -x ${MERGE_SCRIPT} ]]; then | |
60 echo "Failed to find library merging script." >&2 | |
61 exit 1 | |
62 fi | |
63 | |
64 pushd ${WEBRTC_BASE_DIR} | |
65 LIBRARY_BASE_DIR="out_ios_libs" | |
66 | |
67 function build_webrtc { | |
68 OUTPUT_DIR=$1 | |
69 FLAVOR=$2 | |
70 TARGET_ARCH=$3 | |
71 if [[ ${TARGET_ARCH} = 'arm' || ${TARGET_ARCH} = 'arm64' ]]; then | |
72 FLAVOR="${FLAVOR}-iphoneos" | |
73 else | |
74 FLAVOR="${FLAVOR}-iphonesimulator" | |
75 fi | |
76 export GYP_DEFINES="OS=ios target_arch=${TARGET_ARCH} use_objc_h264=1 \ | |
77 clang_xcode=1" | |
78 export GYP_GENERATORS="ninja" | |
79 export GYP_GENERATOR_FLAGS="output_dir=${OUTPUT_DIR}" | |
80 webrtc/build/gyp_webrtc talk/build/merge_ios_libs.gyp | |
81 if [[ ${USE_LEGACY_API} -eq 1 ]]; then | |
82 ninja -C ${OUTPUT_DIR}/${FLAVOR} libjingle_peerconnection_objc_no_op | |
83 else | |
84 ninja -C ${OUTPUT_DIR}/${FLAVOR} webrtc_api_objc_no_op | |
85 fi | |
86 mkdir -p ${LIBRARY_BASE_DIR}/${TARGET_ARCH} | |
87 mv ${OUTPUT_DIR}/${FLAVOR}/*.a ${LIBRARY_BASE_DIR}/${TARGET_ARCH} | |
88 } | |
89 | |
90 # Build all the common architectures. | |
91 build_webrtc "out_ios_arm" "Release" "arm" | |
92 build_webrtc "out_ios_arm64" "Release" "arm64" | |
93 build_webrtc "out_ios_ia32" "Release" "ia32" | |
94 build_webrtc "out_ios_x86_64" "Release" "x64" | |
95 | |
96 popd | |
97 | |
98 # Export header files. | |
99 ${EXPORT_HEADERS_SCRIPT} ${WEBRTC_BASE_DIR}/${LIBRARY_BASE_DIR} \ | |
100 ${USE_LEGACY_API} | |
101 | |
102 # Merge the libraries together. | |
103 ${MERGE_SCRIPT} ${WEBRTC_BASE_DIR}/${LIBRARY_BASE_DIR} | |
OLD | NEW |