tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BUILD.gn (2731B)


      1 # Copyright 2015 The Chromium Authors
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import("//chromium/build/config/cast.gni")
      6 
      7 assert(is_castos || is_cast_android)
      8 
      9 config("static_config") {
     10   if (!is_clang) {
     11     ldflags = [
     12       # Don't allow visible symbols from libraries that contain
     13       # assembly code with symbols that aren't hidden properly.
     14       # http://b/26390825
     15       "-Wl,--exclude-libs=libffmpeg.a",
     16     ]
     17 
     18     if (!is_android) {
     19       ldflags += [
     20         # We want to statically link libstdc++/libgcc on Linux.
     21         # (On Android, libstdc++ and libgcc aren't used.)
     22         "-static-libstdc++",
     23         "-static-libgcc",
     24       ]
     25     }
     26   }
     27 }
     28 
     29 config("ldconfig") {
     30   visibility = [ ":*" ]
     31   configs = []
     32 
     33   # Chromecast executables depend on several shared libraries in
     34   # /oem_cast_shlib, $ORIGIN, and $ORIGIN/lib. Add these rpaths to each binary.
     35   # This is explicitly disabled in Chrome for security reasons (see comments in
     36   # //build/config/gcc/BUILD.gn), but necessary on Chromecast so that OEM's may
     37   # override the default libraries shipped in the Cast receiver package.
     38   if (target_rpath == "") {
     39     ldflags = [
     40       "-Wl,-rpath=/oem_cast_shlib",
     41       "-Wl,-rpath=\$ORIGIN/lib",
     42       "-Wl,-rpath=\$ORIGIN",
     43     ]
     44   } else {
     45     ldflags = [ "-Wl,-rpath=${target_rpath}" ]
     46   }
     47 
     48   # Binaries which don't live in the same directory as Chrome component
     49   # libraries may still depend on them. Explicitly add the component library
     50   # directory to the rpath for the component build.
     51   if (is_component_build) {
     52     ldflags += [ "-Wl,-rpath=/system/chrome" ]
     53   }
     54 }
     55 
     56 config("executable_config") {
     57   configs = [ ":ldconfig" ]
     58 
     59   if (!is_clang && target_cpu == "arm") {
     60     ldflags = [
     61       # Export stdlibc++ and libgcc symbols to force shlibs to refer to these
     62       # symbols from the executable.
     63       "-Wl,--export-dynamic",
     64 
     65       "-lm",  # stdlibc++ requires math.h
     66 
     67       # In case we redefined stdlibc++ symbols (e.g. tc_malloc)
     68       "-Wl,--allow-multiple-definition",
     69 
     70       "-Wl,--whole-archive",
     71       "-l:libstdc++.a",
     72       "-l:libgcc.a",
     73       "-Wl,--no-whole-archive",
     74     ]
     75 
     76     # Despite including libstdc++/libgcc archives, we still need to specify
     77     # static linking for them in order to prevent the executable from having a
     78     # dynamic dependency on them.
     79     configs += [ ":static_config" ]
     80   }
     81 }
     82 
     83 # Shared libaries should not have RPATH or RUNPATH set. This allows the
     84 # shared libs to inherit RPATH from the parent executable that is loading
     85 # the shared library. (See internal b/37514052 for more details.)
     86 config("shared_library_config") {
     87   if (target_cpu == "arm") {
     88     configs = [ ":static_config" ]
     89   }
     90 }