summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/config/chromecast/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/build/config/chromecast/BUILD.gn')
-rw-r--r--third_party/libwebrtc/build/config/chromecast/BUILD.gn95
1 files changed, 95 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/config/chromecast/BUILD.gn b/third_party/libwebrtc/build/config/chromecast/BUILD.gn
new file mode 100644
index 0000000000..d52d19cad8
--- /dev/null
+++ b/third_party/libwebrtc/build/config/chromecast/BUILD.gn
@@ -0,0 +1,95 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/chromecast_build.gni")
+
+assert(is_chromecast)
+
+config("static_config") {
+ if (!is_clang) {
+ ldflags = [
+ # Don't allow visible symbols from libraries that contain
+ # assembly code with symbols that aren't hidden properly.
+ # http://b/26390825
+ "-Wl,--exclude-libs=libffmpeg.a",
+ ]
+
+ if (!is_android) {
+ ldflags += [
+ # We want to statically link libstdc++/libgcc on Linux.
+ # (On Android, libstdc++ and libgcc aren't used.)
+ "-static-libstdc++",
+ "-static-libgcc",
+ ]
+ }
+ }
+}
+
+config("ldconfig") {
+ visibility = [ ":*" ]
+ configs = []
+
+ # Chromecast executables depend on several shared libraries in
+ # /oem_cast_shlib, $ORIGIN, and $ORIGIN/lib. Add these rpaths to each binary.
+ # This is explicitly disabled in Chrome for security reasons (see comments in
+ # //build/config/gcc/BUILD.gn), but necessary on Chromecast so that OEM's may
+ # override the default libraries shipped in the Cast receiver package.
+ if (target_rpath == "") {
+ ldflags = [
+ "-Wl,-rpath=/oem_cast_shlib",
+ "-Wl,-rpath=\$ORIGIN/lib",
+ "-Wl,-rpath=\$ORIGIN",
+ ]
+ } else {
+ ldflags = [ "-Wl,-rpath=${target_rpath}" ]
+ }
+
+ if (chromecast_branding != "public") {
+ # Some internal x64 builds need additional rpath and dynamic-linker config.
+ configs += [ "//chromecast/internal/build/config/ldconfig" ]
+ }
+
+ # Binaries which don't live in the same directory as Chrome component
+ # libraries may still depend on them. Explicitly add the component library
+ # directory to the rpath for the component build.
+ if (is_component_build) {
+ ldflags += [ "-Wl,-rpath=/system/chrome" ]
+ }
+}
+
+config("executable_config") {
+ configs = [ ":ldconfig" ]
+
+ if (!is_clang && target_cpu == "arm") {
+ ldflags = [
+ # Export stdlibc++ and libgcc symbols to force shlibs to refer to these
+ # symbols from the executable.
+ "-Wl,--export-dynamic",
+
+ "-lm", # stdlibc++ requires math.h
+
+ # In case we redefined stdlibc++ symbols (e.g. tc_malloc)
+ "-Wl,--allow-multiple-definition",
+
+ "-Wl,--whole-archive",
+ "-l:libstdc++.a",
+ "-l:libgcc.a",
+ "-Wl,--no-whole-archive",
+ ]
+
+ # Despite including libstdc++/libgcc archives, we still need to specify
+ # static linking for them in order to prevent the executable from having a
+ # dynamic dependency on them.
+ configs += [ ":static_config" ]
+ }
+}
+
+# Shared libaries should not have RPATH or RUNPATH set. This allows the
+# shared libs to inherit RPATH from the parent executable that is loading
+# the shared library. (See internal b/37514052 for more details.)
+config("shared_library_config") {
+ if (target_cpu == "arm") {
+ configs = [ ":static_config" ]
+ }
+}