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.
9 'compile_suid_client': 1,
10 'compile_credentials': 1,
12 'compile_suid_client': 0,
13 'compile_credentials': 0,
15 ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
16 'compile_seccomp_bpf_demo': 1,
18 'compile_seccomp_bpf_demo': 0,
23 'target_conditions': [
24 # All linux/ files will automatically be excluded on Android
25 # so make sure we re-include them explicitly.
28 ['include', '^linux/'],
34 # We have two principal targets: sandbox and sandbox_linux_unittests
35 # All other targets are listed as dependencies.
36 # There is one notable exception: for historical reasons, chrome_sandbox is
37 # the setuid sandbox and is its own target.
39 'target_name': 'sandbox',
45 [ 'compile_suid_client==1', {
47 'suid_sandbox_client',
50 # Compile seccomp BPF when we support it.
51 [ 'use_seccomp_bpf==1', {
54 'seccomp_bpf_helpers',
60 # The main sandboxing test target.
61 'target_name': 'sandbox_linux_unittests',
63 'sandbox_linux_test_sources.gypi',
68 # This target is the shared library used by Android APK (i.e.
69 # JNI-friendly) tests.
70 'target_name': 'sandbox_linux_jni_unittests',
72 'sandbox_linux_test_sources.gypi',
74 'type': 'shared_library',
76 [ 'OS == "android" and gtest_target_type == "shared_library"', {
78 '../testing/android/native_test.gyp:native_test_native_code',
84 'target_name': 'seccomp_bpf',
85 'type': 'static_library',
87 'seccomp-bpf/basicblock.cc',
88 'seccomp-bpf/basicblock.h',
89 'seccomp-bpf/codegen.cc',
90 'seccomp-bpf/codegen.h',
93 'seccomp-bpf/errorcode.cc',
94 'seccomp-bpf/errorcode.h',
95 'seccomp-bpf/instruction.h',
96 'seccomp-bpf/linux_seccomp.h',
97 'seccomp-bpf/sandbox_bpf.cc',
98 'seccomp-bpf/sandbox_bpf.h',
99 'seccomp-bpf/sandbox_bpf_policy.h',
100 'seccomp-bpf/syscall.cc',
101 'seccomp-bpf/syscall.h',
102 'seccomp-bpf/syscall_iterator.cc',
103 'seccomp-bpf/syscall_iterator.h',
104 'seccomp-bpf/trap.cc',
105 'seccomp-bpf/trap.h',
106 'seccomp-bpf/verifier.cc',
107 'seccomp-bpf/verifier.h',
110 '../base/base.gyp:base',
111 'sandbox_services_headers',
118 'target_name': 'seccomp_bpf_helpers',
119 'type': 'static_library',
121 'seccomp-bpf-helpers/baseline_policy.cc',
122 'seccomp-bpf-helpers/baseline_policy.h',
123 'seccomp-bpf-helpers/sigsys_handlers.cc',
124 'seccomp-bpf-helpers/sigsys_handlers.h',
125 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
126 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
127 'seccomp-bpf-helpers/syscall_sets.cc',
128 'seccomp-bpf-helpers/syscall_sets.h',
137 # A demonstration program for the seccomp-bpf sandbox.
138 'target_name': 'seccomp_bpf_demo',
140 ['compile_seccomp_bpf_demo==1', {
141 'type': 'executable',
143 'seccomp-bpf/demo.cc',
157 # The setuid sandbox, for Linux
158 'target_name': 'chrome_sandbox',
159 'type': 'executable',
161 'suid/common/sandbox.h',
162 'suid/common/suid_unsafe_environment_variables.h',
165 'suid/process_util.h',
166 'suid/process_util_linux.c',
177 { 'target_name': 'sandbox_services',
178 'type': 'static_library',
180 'services/broker_process.cc',
181 'services/broker_process.h',
182 'services/init_process_reaper.cc',
183 'services/init_process_reaper.h',
184 'services/scoped_process.cc',
185 'services/scoped_process.h',
186 'services/thread_helpers.cc',
187 'services/thread_helpers.h',
192 '../base/base.gyp:base',
195 ['compile_credentials==1', {
197 'services/credentials.cc',
198 'services/credentials.h',
201 # for capabilities.cc.
202 '../build/linux/system.gyp:libcap',
210 { 'target_name': 'sandbox_services_headers',
213 'services/android_arm_ucontext.h',
214 'services/android_ucontext.h',
215 'services/android_i386_ucontext.h',
216 'services/arm_linux_syscalls.h',
217 'services/linux_syscalls.h',
218 'services/x86_32_linux_syscalls.h',
219 'services/x86_64_linux_syscalls.h',
226 # We make this its own target so that it does not interfere
228 'target_name': 'libc_urandom_override',
229 'type': 'static_library',
231 'services/libc_urandom_override.cc',
232 'services/libc_urandom_override.h',
235 '../base/base.gyp:base',
242 'target_name': 'suid_sandbox_client',
243 'type': 'static_library',
245 'suid/common/sandbox.h',
246 'suid/common/suid_unsafe_environment_variables.h',
247 'suid/client/setuid_sandbox_client.cc',
248 'suid/client/setuid_sandbox_client.h',
251 '../base/base.gyp:base',
263 'target_name': 'sandbox_linux_unittests_stripped',
265 'dependencies': [ 'sandbox_linux_unittests' ],
267 'action_name': 'strip sandbox_linux_unittests',
268 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
269 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
270 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
275 # Strategy copied from base_unittests_apk in base/base.gyp.
276 [ 'OS=="android" and gtest_target_type == "shared_library"', {
279 'target_name': 'sandbox_linux_jni_unittests_apk',
282 'test_suite_name': 'sandbox_linux_jni_unittests',
284 '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)'
285 'sandbox_linux_jni_unittests'
286 '<(SHARED_LIB_SUFFIX)',
289 'sandbox_linux_jni_unittests',
291 'includes': [ '../../build/apk_test.gypi' ],