Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / sandbox / mac / BUILD.gn
blob13960bfaef3fad7360692eaa8ea86a01640b4725
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/mac/mac_sdk.gni")
6 import("//testing/test.gni")
8 generate_stubs_script = "//tools/generate_stubs/generate_stubs.py"
9 generate_stubs_header = "xpc_stubs_header.fragment"
10 generate_stubs_sig_public = "xpc_stubs.sig"
11 generate_stubs_sig_private = "xpc_private_stubs.sig"
12 generate_stubs_project = "sandbox/mac"
13 generate_stubs_output_stem = "xpc_stubs"
15 action("generate_stubs") {
16   script = generate_stubs_script
17   sources = [
18     generate_stubs_sig_private,
19     generate_stubs_sig_public,
20   ]
21   inputs = [
22     generate_stubs_header,
23   ]
24   outputs = [
25     "$target_gen_dir/$generate_stubs_output_stem.cc",
26     "$target_gen_dir/$generate_stubs_output_stem.h",
27   ]
28   args = [
29     "-i",
30     rebase_path(target_gen_dir, root_build_dir),
31     "-o",
32     rebase_path(target_gen_dir, root_build_dir),
33     "-t",
34     "posix_stubs",
35     "-e",
36     rebase_path(generate_stubs_header, root_build_dir),
37     "-s",
38     generate_stubs_output_stem,
39     "-p",
40     generate_stubs_project,
41     "-x",
42     "SANDBOX_EXPORT",
43   ]
44   args += rebase_path(sources, root_build_dir)
47 component("sandbox") {
48   sources = [
49     "bootstrap_sandbox.cc",
50     "bootstrap_sandbox.h",
51     "launchd_interception_server.cc",
52     "launchd_interception_server.h",
53     "mach_message_server.cc",
54     "mach_message_server.h",
55     "message_server.h",
56     "os_compatibility.cc",
57     "os_compatibility.h",
58     "policy.cc",
59     "policy.h",
60     "xpc.cc",
61     "xpc.h",
62     "xpc_message_server.cc",
63     "xpc_message_server.h",
64   ]
66   defines = [ "SANDBOX_IMPLEMENTATION" ]
67   libs = [ "bsm" ]
69   deps = [
70     "//base",
71   ]
73   # When the build SDK is 10.6, generate a dynamic stub loader. When the
74   # SDK is higher, then libxpc.dylib will be loaded automatically as part
75   # of libSystem, and only forward declarations of private symbols are
76   # necessary.
77   if (mac_sdk_version == "10.6") {
78     deps += [ ":generate_stubs" ]
79     sources += get_target_outputs(":generate_stubs")
80   }
83 test("sandbox_mac_unittests") {
84   sources = [
85     "bootstrap_sandbox_unittest.mm",
86     "policy_unittest.cc",
87     "xpc_message_server_unittest.cc",
88   ]
90   libs = [
91     "CoreFoundation.framework",
92     "Foundation.framework",
93   ]
95   deps = [
96     ":sandbox",
97     "//base",
98     "//base/test:run_all_unittests",
99     "//testing/gtest",
100   ]