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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/build/ios/build_ios_libs_gn.sh
diff --git a/webrtc/build/ios/build_ios_libs_gn.sh b/webrtc/build/ios/build_ios_libs_gn.sh
new file mode 100755
index 0000000000000000000000000000000000000000..0a47f6195a4208b4ab1932e5c9988a529b3d09bc
--- /dev/null
+++ b/webrtc/build/ios/build_ios_libs_gn.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# Copyright 2016 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+# Generates static FAT libraries for ios in out_sdk.
+
+# Exit on errors.
+set -e
+
+SCRIPT_DIR=$(cd $(dirname $0) && pwd)
+WEBRTC_BASE_DIR=${SCRIPT_DIR}/../../..
+
+SDK_OUTPUT_DIR=${WEBRTC_BASE_DIR}/out_sdk
+SDK_LIB_NAME="librtc_sdk_objc.a"
+GN_BASE_ARGS="target_os=\"ios\" is_debug=false ios_enable_code_signing=false \
+rtc_libvpx_build_vp9=false"
+GN_STATIC_TARGET_NAMES="rtc_sdk_peerconnection_objc field_trial_default \
+metrics_default"
+
+function build_static_webrtc {
+ local arch=$1
+ local xcode_arch=$2
+
+ OUTPUT_DIR=${SDK_OUTPUT_DIR}/${arch}_libs
+ OUTPUT_LIB=${OUTPUT_DIR}/${SDK_LIB_NAME}
+ GN_ARGS="${GN_BASE_ARGS} target_cpu=\"${arch}\""
+ gn gen ${OUTPUT_DIR} --args="${GN_ARGS}"
+ ninja -C ${OUTPUT_DIR} ${GN_STATIC_TARGET_NAMES}
+ # Combine the object files together into a single archive and strip debug
+ # symbols.
+ find ${OUTPUT_DIR}/obj -type f -name "*.o" |
+ xargs ld -r -static -S -all_load -arch ${xcode_arch} -o ${OUTPUT_LIB}
+}
+
+# Build all the common architectures.
+build_static_webrtc "arm" "armv7"
+build_static_webrtc "arm64" "arm64"
+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.
+build_static_webrtc "x64" "x86_64"
+
+# Combine the libraries.
+lipo ${SDK_OUTPUT_DIR}/arm_libs/${SDK_LIB_NAME} \
+ ${SDK_OUTPUT_DIR}/arm64_libs/${SDK_LIB_NAME} \
+ ${SDK_OUTPUT_DIR}/x86_libs/${SDK_LIB_NAME} \
+ ${SDK_OUTPUT_DIR}/x64_libs/${SDK_LIB_NAME} \
+ -create -output ${SDK_OUTPUT_DIR}/${SDK_LIB_NAME}
+
+echo "Done."

Powered by Google App Engine
This is Rietveld 408576698