Fix some lint errors in url_request_context_adapter
[chromium-blink-merge.git] / sandbox / linux / sandbox_linux.gypi
blob1a742b5354ecd46574dc4887b54b1e5de91f7073
1 # Copyright (c) 2012 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.
6   'variables': {
7     'conditions': [
8       ['OS=="linux"', {
9         'compile_suid_client': 1,
10         'compile_credentials': 1,
11       }, {
12         'compile_suid_client': 0,
13         'compile_credentials': 0,
14       }],
15       ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64" or '
16          'target_arch=="mipsel")', {
17         'compile_seccomp_bpf_demo': 1,
18       }, {
19         'compile_seccomp_bpf_demo': 0,
20       }],
21     ],
22   },
23   'target_defaults': {
24     'target_conditions': [
25       # All linux/ files will automatically be excluded on Android
26       # so make sure we re-include them explicitly.
27       ['OS == "android"', {
28         'sources/': [
29           ['include', '^linux/'],
30         ],
31       }],
32     ],
33   },
34   'targets': [
35     # We have two principal targets: sandbox and sandbox_linux_unittests
36     # All other targets are listed as dependencies.
37     # There is one notable exception: for historical reasons, chrome_sandbox is
38     # the setuid sandbox and is its own target.
39     {
40       'target_name': 'sandbox',
41       'type': 'none',
42       'dependencies': [
43         'sandbox_services',
44       ],
45       'conditions': [
46         [ 'compile_suid_client==1', {
47           'dependencies': [
48             'suid_sandbox_client',
49           ],
50         }],
51         # Compile seccomp BPF when we support it.
52         [ 'use_seccomp_bpf==1', {
53           'dependencies': [
54             'seccomp_bpf',
55             'seccomp_bpf_helpers',
56           ],
57         }],
58       ],
59     },
60     {
61       'target_name': 'sandbox_linux_test_utils',
62       'type': 'static_library',
63       'dependencies': [
64         '../testing/gtest.gyp:gtest',
65       ],
66       'include_dirs': [
67         '../..',
68       ],
69       'sources': [
70         'tests/sandbox_test_runner.cc',
71         'tests/sandbox_test_runner.h',
72         'tests/sandbox_test_runner_function_pointer.cc',
73         'tests/sandbox_test_runner_function_pointer.h',
74         'tests/test_utils.cc',
75         'tests/test_utils.h',
76         'tests/unit_tests.cc',
77         'tests/unit_tests.h',
78       ],
79       'conditions': [
80         [ 'use_seccomp_bpf==1', {
81           'sources': [
82             'seccomp-bpf/bpf_tester_compatibility_delegate.h',
83             'seccomp-bpf/bpf_tests.h',
84             'seccomp-bpf/sandbox_bpf_test_runner.cc',
85             'seccomp-bpf/sandbox_bpf_test_runner.h',
86           ],
87           'dependencies': [
88             'seccomp_bpf',
89           ]
90         }],
91       ],
92     },
93     {
94       # The main sandboxing test target.
95       'target_name': 'sandbox_linux_unittests',
96       'includes': [
97         'sandbox_linux_test_sources.gypi',
98       ],
99       'type': 'executable',
100     },
101     {
102       # This target is the shared library used by Android APK (i.e.
103       # JNI-friendly) tests.
104       'target_name': 'sandbox_linux_jni_unittests',
105       'includes': [
106         'sandbox_linux_test_sources.gypi',
107       ],
108       'type': 'shared_library',
109       'conditions': [
110         [ 'OS == "android"', {
111           'dependencies': [
112             '../testing/android/native_test.gyp:native_test_native_code',
113           ],
114         }],
115       ],
116     },
117     {
118       'target_name': 'seccomp_bpf',
119       'type': '<(component)',
120       'sources': [
121         'bpf_dsl/bpf_dsl.cc',
122         'bpf_dsl/bpf_dsl.h',
123         'bpf_dsl/bpf_dsl_impl.h',
124         'bpf_dsl/cons.h',
125         'seccomp-bpf/basicblock.cc',
126         'seccomp-bpf/basicblock.h',
127         'seccomp-bpf/codegen.cc',
128         'seccomp-bpf/codegen.h',
129         'seccomp-bpf/die.cc',
130         'seccomp-bpf/die.h',
131         'seccomp-bpf/errorcode.cc',
132         'seccomp-bpf/errorcode.h',
133         'seccomp-bpf/instruction.h',
134         'seccomp-bpf/linux_seccomp.h',
135         'seccomp-bpf/sandbox_bpf.cc',
136         'seccomp-bpf/sandbox_bpf.h',
137         'seccomp-bpf/syscall.cc',
138         'seccomp-bpf/syscall.h',
139         'seccomp-bpf/syscall_iterator.cc',
140         'seccomp-bpf/syscall_iterator.h',
141         'seccomp-bpf/trap.cc',
142         'seccomp-bpf/trap.h',
143         'seccomp-bpf/verifier.cc',
144         'seccomp-bpf/verifier.h',
145       ],
146       'dependencies': [
147         '../base/base.gyp:base',
148         'sandbox_services_headers',
149       ],
150       'defines': [
151         'SANDBOX_IMPLEMENTATION',
152       ],
153       'include_dirs': [
154         '../..',
155       ],
156     },
157     {
158       'target_name': 'seccomp_bpf_helpers',
159       'type': '<(component)',
160       'sources': [
161         'seccomp-bpf-helpers/baseline_policy.cc',
162         'seccomp-bpf-helpers/baseline_policy.h',
163         'seccomp-bpf-helpers/sigsys_handlers.cc',
164         'seccomp-bpf-helpers/sigsys_handlers.h',
165         'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
166         'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
167         'seccomp-bpf-helpers/syscall_sets.cc',
168         'seccomp-bpf-helpers/syscall_sets.h',
169       ],
170       'dependencies': [
171         '../base/base.gyp:base',
172         'seccomp_bpf',
173       ],
174       'defines': [
175         'SANDBOX_IMPLEMENTATION',
176       ],
177       'include_dirs': [
178         '../..',
179       ],
180     },
181     {
182       # The setuid sandbox, for Linux
183       'target_name': 'chrome_sandbox',
184       'type': 'executable',
185       'sources': [
186         'suid/common/sandbox.h',
187         'suid/common/suid_unsafe_environment_variables.h',
188         'suid/process_util.h',
189         'suid/process_util_linux.c',
190         'suid/sandbox.c',
191       ],
192       'cflags': [
193         # For ULLONG_MAX
194         '-std=gnu99',
195       ],
196       'include_dirs': [
197         '../..',
198       ],
199       # Do not use any sanitizer tools with this binary. http://crbug.com/382766
200       'cflags/': [
201         ['exclude', '-fsanitize'],
202       ],
203       'ldflags/': [
204         ['exclude', '-fsanitize'],
205       ],
206     },
207     { 'target_name': 'sandbox_services',
208       'type': '<(component)',
209       'sources': [
210         'services/broker_process.cc',
211         'services/broker_process.h',
212         'services/init_process_reaper.cc',
213         'services/init_process_reaper.h',
214         'services/scoped_process.cc',
215         'services/scoped_process.h',
216         'services/thread_helpers.cc',
217         'services/thread_helpers.h',
218         'services/yama.h',
219         'services/yama.cc',
220       ],
221       'dependencies': [
222         '../base/base.gyp:base',
223       ],
224       'defines': [
225         'SANDBOX_IMPLEMENTATION',
226       ],
227       'conditions': [
228         ['compile_credentials==1', {
229           'sources': [
230             'services/credentials.cc',
231             'services/credentials.h',
232           ],
233           'dependencies': [
234             # for capabilities.cc.
235             '../build/linux/system.gyp:libcap',
236           ],
237         }],
238       ],
239       'include_dirs': [
240         '..',
241       ],
242     },
243     { 'target_name': 'sandbox_services_headers',
244       'type': 'none',
245       'sources': [
246         'services/android_arm_ucontext.h',
247         'services/android_arm64_ucontext.h',
248         'services/android_futex.h',
249         'services/android_ucontext.h',
250         'services/android_i386_ucontext.h',
251         'services/android_mips_ucontext.h',
252         'services/arm_linux_syscalls.h',
253         'services/arm64_linux_syscalls.h',
254         'services/mips_linux_syscalls.h',
255         'services/linux_syscalls.h',
256         'services/x86_32_linux_syscalls.h',
257         'services/x86_64_linux_syscalls.h',
258       ],
259       'include_dirs': [
260         '..',
261       ],
262     },
263     {
264       # We make this its own target so that it does not interfere
265       # with our tests.
266       'target_name': 'libc_urandom_override',
267       'type': 'static_library',
268       'sources': [
269         'services/libc_urandom_override.cc',
270         'services/libc_urandom_override.h',
271       ],
272       'dependencies': [
273         '../base/base.gyp:base',
274       ],
275       'include_dirs': [
276         '..',
277       ],
278     },
279     {
280       'target_name': 'suid_sandbox_client',
281       'type': '<(component)',
282       'sources': [
283         'suid/common/sandbox.h',
284         'suid/common/suid_unsafe_environment_variables.h',
285         'suid/client/setuid_sandbox_client.cc',
286         'suid/client/setuid_sandbox_client.h',
287       ],
288       'defines': [
289         'SANDBOX_IMPLEMENTATION',
290       ],
291       'dependencies': [
292         '../base/base.gyp:base',
293         'sandbox_services',
294       ],
295       'include_dirs': [
296         '..',
297       ],
298     },
299   ],
300   'conditions': [
301     [ 'OS=="android"', {
302       'targets': [
303         {
304         'target_name': 'sandbox_linux_unittests_stripped',
305         'type': 'none',
306         'dependencies': [ 'sandbox_linux_unittests' ],
307         'actions': [{
308           'action_name': 'strip sandbox_linux_unittests',
309           'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
310           'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
311           'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
312           }],
313         }
314       ],
315     }],
316     [ 'OS=="android"', {
317       'targets': [
318         {
319         'target_name': 'sandbox_linux_jni_unittests_apk',
320         'type': 'none',
321         'variables': {
322           'test_suite_name': 'sandbox_linux_jni_unittests',
323         },
324         'dependencies': [
325           'sandbox_linux_jni_unittests',
326         ],
327         'includes': [ '../../build/apk_test.gypi' ],
328         }
329       ],
330     }],
331     ['test_isolation_mode != "noop"', {
332       'targets': [
333         {
334           'target_name': 'sandbox_linux_unittests_run',
335           'type': 'none',
336           'dependencies': [
337             'sandbox_linux_unittests',
338           ],
339           'includes': [
340             '../../build/isolate.gypi',
341           ],
342           'sources': [
343             '../sandbox_linux_unittests.isolate',
344           ],
345         },
346       ],
347     }],
348   ],