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

Unified Diff: webrtc/build/ios/build_ios_libs_gn.sh

Issue 2391123002: Add iOS static library GN build script. (Closed)
Patch Set: Remove commented line 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..867b840274a2cca638ea71fbb52f3342213ec7ab
--- /dev/null
+++ b/webrtc/build/ios/build_ios_libs_gn.sh
@@ -0,0 +1,66 @@
+#!/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 or dynamic FAT libraries for ios in out_ios_libs.
+
+# 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_override_visibility=true"
+GN_STATIC_TARGET_NAMES="rtc_sdk_peerconnection_objc field_trial_default \
+metrics_default"
+
+# Chromium currently hides all inline symbols by default. This is not
+# overridable in GN, but we need it to build static libraries correctly. Apply
+# a temporary hack to get what we want until inline symbol visibility is
+# configurable.
+CHROMIUM_BASE_DIR=${WEBRTC_BASE_DIR}/chromium/src
+pushd ${CHROMIUM_BASE_DIR}
+git apply ${SCRIPT_DIR}/rtc_override_visibility.diff
+popd
+
+# Static libraries need to be built with all symbols visible for linking to
+# behave correctly when static libraries are included in external projects.
+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}
+ 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"
+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}
+
+# Undo our hack.
+pushd ${CHROMIUM_BASE_DIR}
+git checkout -- build/config/compiler/BUILD.gn
+popd
« no previous file with comments | « no previous file | webrtc/build/ios/rtc_override_visibility.diff » ('j') | webrtc/sdk/objc/Framework/Classes/RTCVideoTrack.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698