OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/mac/mac_sdk.gni") | 5 import("//build/config/mac/mac_sdk.gni") |
6 import("//testing/test.gni") | 6 import("//testing/test.gni") |
7 | 7 |
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" | |
14 | |
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) | |
45 } | |
46 | |
47 component("sandbox") { | 8 component("sandbox") { |
48 sources = [ | 9 sources = [ |
49 "bootstrap_sandbox.cc", | 10 "bootstrap_sandbox.cc", |
50 "bootstrap_sandbox.h", | 11 "bootstrap_sandbox.h", |
51 "launchd_interception_server.cc", | 12 "launchd_interception_server.cc", |
52 "launchd_interception_server.h", | 13 "launchd_interception_server.h", |
53 "mach_message_server.cc", | 14 "mach_message_server.cc", |
54 "mach_message_server.h", | 15 "mach_message_server.h", |
55 "message_server.h", | 16 "message_server.h", |
56 "os_compatibility.cc", | 17 "os_compatibility.cc", |
57 "os_compatibility.h", | 18 "os_compatibility.h", |
58 "policy.cc", | 19 "policy.cc", |
59 "policy.h", | 20 "policy.h", |
60 "pre_exec_delegate.cc", | 21 "pre_exec_delegate.cc", |
61 "pre_exec_delegate.h", | 22 "pre_exec_delegate.h", |
62 "xpc.cc", | |
63 "xpc.h", | 23 "xpc.h", |
64 "xpc_message_server.cc", | 24 "xpc_message_server.cc", |
65 "xpc_message_server.h", | 25 "xpc_message_server.h", |
66 ] | 26 ] |
67 | 27 |
68 defines = [ "SANDBOX_IMPLEMENTATION" ] | 28 defines = [ "SANDBOX_IMPLEMENTATION" ] |
69 libs = [ "bsm" ] | 29 libs = [ "bsm" ] |
70 | 30 |
71 deps = [ | 31 deps = [ |
72 "//base", | 32 "//base", |
73 ] | 33 ] |
74 | |
75 # When the build SDK is 10.6, generate a dynamic stub loader. When the | |
76 # SDK is higher, then libxpc.dylib will be loaded automatically as part | |
77 # of libSystem, and only forward declarations of private symbols are | |
78 # necessary. | |
79 if (mac_sdk_version == "10.6") { | |
80 deps += [ ":generate_stubs" ] | |
81 sources += get_target_outputs(":generate_stubs") | |
82 } | |
83 } | 34 } |
84 | 35 |
85 test("sandbox_mac_unittests") { | 36 test("sandbox_mac_unittests") { |
86 sources = [ | 37 sources = [ |
87 "bootstrap_sandbox_unittest.mm", | 38 "bootstrap_sandbox_unittest.mm", |
88 "policy_unittest.cc", | 39 "policy_unittest.cc", |
89 "xpc_message_server_unittest.cc", | 40 "xpc_message_server_unittest.cc", |
90 ] | 41 ] |
91 | 42 |
92 libs = [ | 43 libs = [ |
93 "CoreFoundation.framework", | 44 "CoreFoundation.framework", |
94 "Foundation.framework", | 45 "Foundation.framework", |
95 ] | 46 ] |
96 | 47 |
97 deps = [ | 48 deps = [ |
98 ":sandbox", | 49 ":sandbox", |
99 "//base", | 50 "//base", |
100 "//base/test:run_all_unittests", | 51 "//base/test:run_all_unittests", |
101 "//testing/gtest", | 52 "//testing/gtest", |
102 ] | 53 ] |
103 } | 54 } |
OLD | NEW |