summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client/BUILD.gn
blob: 362a083ac4b285cc09f358b7f7fd1098010c6b7b (plain)
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
# 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/features.gni")
import("//build/config/nacl/config.gni")

if (is_nacl) {
  group("ppapi_lib") {
    deps = [
      "//ppapi/native_client/src/untrusted/irt_stub:ppapi_stub_lib",
    ]
  }

  executable("nacl_irt") {
    deps = [
      "//base",
      "//components/tracing",
      "//gpu/command_buffer/client",
      "//gpu/command_buffer/client:gles2_implementation",
      "//gpu/command_buffer/common",
      "//gpu/ipc/common",
      "//ipc",
      "//media:shared_memory_support",
      "//native_client/src/shared/gio",
      "//native_client/src/shared/platform",
      "//native_client/src/tools/tls_edit($host_toolchain)",
      "//native_client/src/untrusted/irt:irt_core_lib",
      "//native_client/src/untrusted/nacl:imc_syscalls",
      "//ppapi/native_client/src/untrusted/pnacl_irt_shim:irt",
      "//ppapi/proxy",
      "//ppapi/proxy:ipc",
      "//ppapi/shared_impl",
    ]

    assert_no_deps = [
      # Skia is one of the easiest dependencies to accidentally add since a
      # bunch of graphics and GPU code uses it.
      "//skia/*",
      "//third_party/WebKit/*",
    ]
  }

  # TODO(phosek): We can remove this ugliness if we change the
  # IRT file name in components/nacl/browser/nacl_browser.cc
  if (current_cpu == "x86") {
    irt_cpu = "x86_32"
  } else if (current_cpu == "x64") {
    irt_cpu = "x86_64"
  } else {
    irt_cpu = current_cpu
  }
  irt_name = "nacl_irt_" + irt_cpu + ".nexe"

  copy("nacl_irt_debug") {
    sources = [
      "${root_out_dir}/exe.unstripped/nacl_irt.nexe",
    ]
    outputs = [
      "${root_build_dir}/${irt_name}.debug",
    ]
    deps = [
      ":nacl_irt",
    ]
  }

  action("nacl_irt_debuglink") {
    deps = [
      ":nacl_irt",
      ":nacl_irt_debug",
    ]

    objcopy = "${nacl_toolprefix}objcopy"
    if (host_os == "win") {
      objcopy += ".exe"
    }

    irt_stripped = "${root_out_dir}/nacl_irt.nexe"
    irt_debug = get_target_outputs(":nacl_irt_debug")
    irt_debug = irt_debug[0]
    irt_final = "${root_build_dir}/${irt_name}"

    inputs = [
      objcopy,
    ]
    sources = [
      irt_debug,
      irt_stripped,
    ]
    outputs = [
      irt_final,
    ]

    script = "irt_debuglink.py"
    args = [
      rebase_path(objcopy),
      rebase_path(irt_debug),
      rebase_path(irt_stripped),
      rebase_path(irt_final),
    ]
  }
}

group("irt") {
  # The nacl_irt needs to be marked as data dependency so that it's
  # properly resolved as runtime dependency. However, some target
  # use nacl_irt as input for actions which require it to be marked
  # as public dependency as well.
  irt_deps = [
    ":nacl_irt_debug(//build/toolchain/nacl:irt_${target_cpu})",
    ":nacl_irt_debuglink(//build/toolchain/nacl:irt_${target_cpu})",
  ]
  public_deps = irt_deps
  data_deps = irt_deps

  # On 32-bit Windows, we also ship the 64-bit IRT.
  if (is_win && target_cpu == "x86") {
    irt_x64_deps = [
      ":nacl_irt_debug(//build/toolchain/nacl:irt_x64)",
      ":nacl_irt_debuglink(//build/toolchain/nacl:irt_x64)",
    ]
    public_deps += irt_x64_deps
    data_deps += irt_x64_deps
  }
}