OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 { |
| 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 'bpf_dsl/policy_compiler.cc', |
| 126 'bpf_dsl/policy_compiler.h', |
| 127 'bpf_dsl/trap_registry.h', |
| 128 'seccomp-bpf/basicblock.cc', |
| 129 'seccomp-bpf/basicblock.h', |
| 130 'seccomp-bpf/codegen.cc', |
| 131 'seccomp-bpf/codegen.h', |
| 132 'seccomp-bpf/die.cc', |
| 133 'seccomp-bpf/die.h', |
| 134 'seccomp-bpf/errorcode.cc', |
| 135 'seccomp-bpf/errorcode.h', |
| 136 'seccomp-bpf/instruction.h', |
| 137 'seccomp-bpf/linux_seccomp.h', |
| 138 'seccomp-bpf/sandbox_bpf.cc', |
| 139 'seccomp-bpf/sandbox_bpf.h', |
| 140 'seccomp-bpf/syscall.cc', |
| 141 'seccomp-bpf/syscall.h', |
| 142 'seccomp-bpf/syscall_iterator.cc', |
| 143 'seccomp-bpf/syscall_iterator.h', |
| 144 'seccomp-bpf/trap.cc', |
| 145 'seccomp-bpf/trap.h', |
| 146 'seccomp-bpf/verifier.cc', |
| 147 'seccomp-bpf/verifier.h', |
| 148 ], |
| 149 'dependencies': [ |
| 150 '../base/base.gyp:base', |
| 151 'sandbox_services_headers', |
| 152 ], |
| 153 'defines': [ |
| 154 'SANDBOX_IMPLEMENTATION', |
| 155 ], |
| 156 'includes': [ |
| 157 # Disable LTO due to compiler bug |
| 158 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57703 |
| 159 '../../build/android/disable_lto.gypi', |
| 160 ], |
| 161 'include_dirs': [ |
| 162 '../..', |
| 163 ], |
| 164 }, |
| 165 { |
| 166 'target_name': 'seccomp_bpf_helpers', |
| 167 'type': '<(component)', |
| 168 'sources': [ |
| 169 'seccomp-bpf-helpers/baseline_policy.cc', |
| 170 'seccomp-bpf-helpers/baseline_policy.h', |
| 171 'seccomp-bpf-helpers/sigsys_handlers.cc', |
| 172 'seccomp-bpf-helpers/sigsys_handlers.h', |
| 173 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc', |
| 174 'seccomp-bpf-helpers/syscall_parameters_restrictions.h', |
| 175 'seccomp-bpf-helpers/syscall_sets.cc', |
| 176 'seccomp-bpf-helpers/syscall_sets.h', |
| 177 ], |
| 178 'dependencies': [ |
| 179 '../base/base.gyp:base', |
| 180 'seccomp_bpf', |
| 181 ], |
| 182 'defines': [ |
| 183 'SANDBOX_IMPLEMENTATION', |
| 184 ], |
| 185 'include_dirs': [ |
| 186 '../..', |
| 187 ], |
| 188 }, |
| 189 { |
| 190 # The setuid sandbox, for Linux |
| 191 'target_name': 'chrome_sandbox', |
| 192 'type': 'executable', |
| 193 'sources': [ |
| 194 'suid/common/sandbox.h', |
| 195 'suid/common/suid_unsafe_environment_variables.h', |
| 196 'suid/process_util.h', |
| 197 'suid/process_util_linux.c', |
| 198 'suid/sandbox.c', |
| 199 ], |
| 200 'cflags': [ |
| 201 # For ULLONG_MAX |
| 202 '-std=gnu99', |
| 203 ], |
| 204 'include_dirs': [ |
| 205 '../..', |
| 206 ], |
| 207 # Do not use any sanitizer tools with this binary. http://crbug.com/382766 |
| 208 'cflags/': [ |
| 209 ['exclude', '-fsanitize'], |
| 210 ], |
| 211 'ldflags/': [ |
| 212 ['exclude', '-fsanitize'], |
| 213 ], |
| 214 }, |
| 215 { 'target_name': 'sandbox_services', |
| 216 'type': '<(component)', |
| 217 'sources': [ |
| 218 'services/broker_process.cc', |
| 219 'services/broker_process.h', |
| 220 'services/init_process_reaper.cc', |
| 221 'services/init_process_reaper.h', |
| 222 'services/scoped_process.cc', |
| 223 'services/scoped_process.h', |
| 224 'services/thread_helpers.cc', |
| 225 'services/thread_helpers.h', |
| 226 'services/yama.h', |
| 227 'services/yama.cc', |
| 228 ], |
| 229 'dependencies': [ |
| 230 '../base/base.gyp:base', |
| 231 ], |
| 232 'defines': [ |
| 233 'SANDBOX_IMPLEMENTATION', |
| 234 ], |
| 235 'conditions': [ |
| 236 ['compile_credentials==1', { |
| 237 'sources': [ |
| 238 'services/credentials.cc', |
| 239 'services/credentials.h', |
| 240 ], |
| 241 'dependencies': [ |
| 242 # for capabilities.cc. |
| 243 '../build/linux/system.gyp:libcap', |
| 244 ], |
| 245 }], |
| 246 ], |
| 247 'include_dirs': [ |
| 248 '..', |
| 249 ], |
| 250 }, |
| 251 { 'target_name': 'sandbox_services_headers', |
| 252 'type': 'none', |
| 253 'sources': [ |
| 254 'services/android_arm_ucontext.h', |
| 255 'services/android_arm64_ucontext.h', |
| 256 'services/android_futex.h', |
| 257 'services/android_ucontext.h', |
| 258 'services/android_i386_ucontext.h', |
| 259 'services/android_mips_ucontext.h', |
| 260 'services/arm_linux_syscalls.h', |
| 261 'services/arm64_linux_syscalls.h', |
| 262 'services/mips_linux_syscalls.h', |
| 263 'services/linux_syscalls.h', |
| 264 'services/x86_32_linux_syscalls.h', |
| 265 'services/x86_64_linux_syscalls.h', |
| 266 ], |
| 267 'include_dirs': [ |
| 268 '..', |
| 269 ], |
| 270 }, |
| 271 { |
| 272 # We make this its own target so that it does not interfere |
| 273 # with our tests. |
| 274 'target_name': 'libc_urandom_override', |
| 275 'type': 'static_library', |
| 276 'sources': [ |
| 277 'services/libc_urandom_override.cc', |
| 278 'services/libc_urandom_override.h', |
| 279 ], |
| 280 'dependencies': [ |
| 281 '../base/base.gyp:base', |
| 282 ], |
| 283 'include_dirs': [ |
| 284 '..', |
| 285 ], |
| 286 }, |
| 287 { |
| 288 'target_name': 'suid_sandbox_client', |
| 289 'type': '<(component)', |
| 290 'sources': [ |
| 291 'suid/common/sandbox.h', |
| 292 'suid/common/suid_unsafe_environment_variables.h', |
| 293 'suid/client/setuid_sandbox_client.cc', |
| 294 'suid/client/setuid_sandbox_client.h', |
| 295 ], |
| 296 'defines': [ |
| 297 'SANDBOX_IMPLEMENTATION', |
| 298 ], |
| 299 'dependencies': [ |
| 300 '../base/base.gyp:base', |
| 301 'sandbox_services', |
| 302 ], |
| 303 'include_dirs': [ |
| 304 '..', |
| 305 ], |
| 306 }, |
| 307 ], |
| 308 'conditions': [ |
| 309 [ 'OS=="android"', { |
| 310 'targets': [ |
| 311 { |
| 312 'target_name': 'sandbox_linux_unittests_stripped', |
| 313 'type': 'none', |
| 314 'dependencies': [ 'sandbox_linux_unittests' ], |
| 315 'actions': [{ |
| 316 'action_name': 'strip sandbox_linux_unittests', |
| 317 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ], |
| 318 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ], |
| 319 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ], |
| 320 }], |
| 321 } |
| 322 ], |
| 323 }], |
| 324 [ 'OS=="android"', { |
| 325 'targets': [ |
| 326 { |
| 327 'target_name': 'sandbox_linux_jni_unittests_apk', |
| 328 'type': 'none', |
| 329 'variables': { |
| 330 'test_suite_name': 'sandbox_linux_jni_unittests', |
| 331 }, |
| 332 'dependencies': [ |
| 333 'sandbox_linux_jni_unittests', |
| 334 ], |
| 335 'includes': [ '../../build/apk_test.gypi' ], |
| 336 } |
| 337 ], |
| 338 }], |
| 339 ['test_isolation_mode != "noop"', { |
| 340 'targets': [ |
| 341 { |
| 342 'target_name': 'sandbox_linux_unittests_run', |
| 343 'type': 'none', |
| 344 'dependencies': [ |
| 345 'sandbox_linux_unittests', |
| 346 ], |
| 347 'includes': [ |
| 348 '../../build/isolate.gypi', |
| 349 ], |
| 350 'sources': [ |
| 351 '../sandbox_linux_unittests.isolate', |
| 352 ], |
| 353 }, |
| 354 ], |
| 355 }], |
| 356 ], |
| 357 } |
OLD | NEW |