Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: webrtc/build/ios/build_ios_libs_gn.sh

Issue 2391123002: Add iOS static library GN build script. (Closed)
Patch Set: Update comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright 2016 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 static FAT libraries for ios in out_sdk.
12
13 # Exit on errors.
14 set -e
15
16 SCRIPT_DIR=$(cd $(dirname $0) && pwd)
17 WEBRTC_BASE_DIR=${SCRIPT_DIR}/../../..
18
19 SDK_OUTPUT_DIR=${WEBRTC_BASE_DIR}/out_sdk
20 SDK_LIB_NAME="librtc_sdk_objc.a"
21 GN_BASE_ARGS="target_os=\"ios\" is_debug=false ios_enable_code_signing=false \
22 rtc_libvpx_build_vp9=false"
23 GN_STATIC_TARGET_NAMES="rtc_sdk_peerconnection_objc field_trial_default \
24 metrics_default"
25
26 function build_static_webrtc {
27 local arch=$1
28 local xcode_arch=$2
29
30 OUTPUT_DIR=${SDK_OUTPUT_DIR}/${arch}_libs
31 OUTPUT_LIB=${OUTPUT_DIR}/${SDK_LIB_NAME}
32 GN_ARGS="${GN_BASE_ARGS} target_cpu=\"${arch}\""
33 gn gen ${OUTPUT_DIR} --args="${GN_ARGS}"
34 ninja -C ${OUTPUT_DIR} ${GN_STATIC_TARGET_NAMES}
35 # Combine the object files together into a single archive and strip debug
36 # symbols.
37 find ${OUTPUT_DIR}/obj -type f -name "*.o" |
38 xargs ld -r -static -S -all_load -arch ${xcode_arch} -o ${OUTPUT_LIB}
39 }
40
41 # Build all the common architectures.
42 build_static_webrtc "arm" "armv7"
43 build_static_webrtc "arm64" "arm64"
44 build_static_webrtc "x86" "i386"
kthelgason 2016/10/05 07:46:24 I'm not really convinced we need this.
tkchin_webrtc 2016/10/05 16:42:26 Required to build correctly in other repository.
45 build_static_webrtc "x64" "x86_64"
46
47 # Combine the libraries.
48 lipo ${SDK_OUTPUT_DIR}/arm_libs/${SDK_LIB_NAME} \
49 ${SDK_OUTPUT_DIR}/arm64_libs/${SDK_LIB_NAME} \
50 ${SDK_OUTPUT_DIR}/x86_libs/${SDK_LIB_NAME} \
51 ${SDK_OUTPUT_DIR}/x64_libs/${SDK_LIB_NAME} \
52 -create -output ${SDK_OUTPUT_DIR}/${SDK_LIB_NAME}
53
54 echo "Done."
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698