File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (201 lines) | stat: -rw-r--r-- 5,960 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/c++/c++.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/nacl/config.gni")
import("//components/nacl/features.gni")
import("//components/nacl/toolchain.gni")
import("//testing/test.gni")

assert(enable_nacl)

if (current_cpu != "arm64") {
  # This is separate so it can be used by ../broker:nacl64.
  source_set("minimal") {
    sources = [
      "nacl_ipc_adapter.cc",
      "nacl_ipc_adapter.h",
      "nacl_listener.cc",
      "nacl_listener.h",
      "nacl_main.cc",
      "nacl_main_platform_delegate.h",
      "nacl_trusted_listener.cc",
      "nacl_trusted_listener.h",
      "nacl_validation_db.h",
      "nacl_validation_query.cc",
      "nacl_validation_query.h",
    ]

    deps = [
      ":minimal_content_dummy",
      "//base",
      "//components/nacl/common:minimal",
      "//components/nacl/common:mojo_bindings",
      "//components/power_monitor",
      "//content/public/common:main_function_params",
      "//crypto",
      "//ipc",
      "//mojo/core/embedder",
      "//native_client/src/trusted/service_runtime:sel_main_chrome",
      "//ppapi/c",
      "//ppapi/proxy:ipc",
      "//sandbox",
      "//services/service_manager/public/cpp",
    ]

    if (is_linux || is_chromeos) {
      sources += [ "nacl_main_platform_delegate_linux.cc" ]
    }
  }

  # This exists just to make 'gn check' happy with :minimal and
  # :nacl_helper_win_64 (below).  They can't depend on //content/public/common
  # or anything like that, because that would bring in lots more than counts
  # as "minimal" (stuff that should not be in the nacl64.exe build).
  source_set("minimal_content_dummy") {
    check_includes = false

    sources = []

    if (is_linux || is_chromeos) {
      sources += [ "//content/public/common/zygote/sandbox_support_linux.h" ]
    }
  }

  source_set("loader") {
    public_deps = [ ":minimal" ]
    deps = [
      "//components/nacl/common",
      "//ppapi/shared_impl",
      "//services/service_manager/public/cpp",
    ]

    data_deps = [
      "//ppapi/native_client:irt",
      "//ppapi/native_client/src/untrusted/pnacl_support_extension",
    ]
  }

  test("nacl_loader_unittests") {
    sources = [
      "nacl_ipc_adapter_unittest.cc",
      "nacl_validation_query_unittest.cc",
      "run_all_unittests.cc",
    ]

    deps = [
      ":loader",
      "//base/test:test_support",
      "//ipc:test_support",
      "//ppapi/c",
      "//testing/gtest",
    ]
  }
}

if ((is_linux || is_chromeos) && current_cpu != "arm64") {
  executable("nacl_helper") {
    sources = [
      "nacl_helper_linux.cc",
      "nacl_helper_linux.h",
    ]

    deps = [
      ":loader",
      "//base",
      "//components/nacl/common:switches",
      "//components/nacl/loader/sandbox_linux",
      "//content/public/common:content_descriptors",
      "//content/public/common:main_function_params",
      "//content/public/common:sandbox_support_linux",
      "//crypto",
      "//ipc",
      "//mojo/core/embedder",
      "//sandbox/linux:sandbox_services",
      "//sandbox/policy",
      "//url/ipc:url_ipc",
    ]

    if (is_chromeos) {
      # NaCl is not working with compiler-rt in ChromeOS.
      # Force libgcc as a workaround. See https://crbug.com/761103
      ldflags = [
        "-rtlib=libgcc",
        "--unwindlib=libgcc",
      ]

      # nacl_helper needs to link with libgcc_s. We already have -lgcc_s in
      # the final link command line, but it was placed within "--as-needed"
      # with the result that the dependency gets dropped. Similarly, we need
      # to add this via "ldflags" and not "libs" because libraries added via
      # the latter are also placed within an "--as-needed"'.
      # See https://crbug.com/884017
      ldflags += [ "-lgcc_s" ]
    }

    # The only symbols that nacl_helper needs to export are those specified by
    # its direct dependencies, so -rdynamic would only serve to unnecessarily
    # increase the binary size.
    if (!export_libcxxabi_from_executables) {
      configs -= [ "//build/config/compiler:export_dynamic" ]
    }

    data_deps =
        [ "//native_client/src/trusted/service_runtime/linux:bootstrap" ]

    # In order to build ARM32 nacl_helper for ARM64 Chrome OS, we need to
    # minimize the dependencies on system libraries, including indirect
    # dependencies through other parts of Chrome (see
    # https://crbug.com/1339021).
    assert_no_deps = [
      "//content/public/common",
      "//media/audio",
    ]

    if (is_minimal_toolchain) {
      assert_no_deps += [
        "//net",
        "//skia",
      ]
    }
  }

  # For setting up nacl_helper.
  source_set("nacl_helper_integration") {
    public = [ "nacl_helper_linux.h" ]
    data_deps = [ ":nacl_helper" ]
  }
}

# In ARM64 Chrome, use the ARM32 versions of nacl_helper and
# nacl_helper_bootstrap.  Copy them from the build directory for the
# ARM32 toolchain.
if ((is_linux || is_chromeos) && current_cpu == "arm64") {
  if (default_toolchain == "//build/toolchain/cros:target") {
    toolchain = "//build/toolchain/cros:nacl_helper_arm32"
  } else {
    toolchain = "//build/toolchain/linux:clang_arm"
  }

  copy("nacl_helper") {
    label = ":nacl_helper($toolchain)"
    out_dir = get_label_info(label, "root_out_dir")
    sources = [ "${out_dir}/nacl_helper" ]
    outputs = [ "${root_out_dir}/nacl_helper" ]
    deps = [ label ]
    data_deps = [
      ":nacl_helper_bootstrap",
      "//ppapi/native_client/src/untrusted/pnacl_support_extension",
    ]
  }

  copy("nacl_helper_bootstrap") {
    label = "//native_client/src/trusted/service_runtime/linux:bootstrap($toolchain)"
    out_dir = get_label_info(label, "root_out_dir")
    sources = [ "${out_dir}/nacl_helper_bootstrap" ]
    outputs = [ "${root_out_dir}/nacl_helper_bootstrap" ]
    deps = [ label ]
  }
}