[go: nahoru, domu]

Sandbox Gyp: move Linux to its own .gypi file


BUG=None
TEST=None
NOTRY=true


Review URL: https://chromiumcodereview.appspot.com/10628012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143484 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/sandbox/sandbox.gyp b/sandbox/sandbox.gyp
index 4158c014..9f1267f 100644
--- a/sandbox/sandbox.gyp
+++ b/sandbox/sandbox.gyp
@@ -138,63 +138,20 @@
     ],
   },
   'conditions': [
-    [ 'OS!="win" and OS!="mac"', {
+    [ 'OS=="linux"', {
+      'includes': [
+        'sandbox_linux.gypi',
+      ],
+    }],
+    [ 'OS!="win" and OS!="mac" and OS!="linux"', {
+      # We need a 'default' to accomodate the "sandbox" target, for instance
+      # on Android.
       'targets': [
         {
           'target_name': 'sandbox',
           'type': 'none',
-          'conditions': [
-            # Only compile in the seccomp mode 1 code for the flag combination
-            # where we support it.
-            [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64") '
-              'and toolkit_views==0 and selinux==0', {
-              'dependencies': [
-                '../seccompsandbox/seccomp.gyp:seccomp_sandbox',
-              ],
-            }],
-            # This does not include Android.
-            [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
-              'type': 'static_library',
-              # Compile seccomp mode 2 code on Linux
-              'sources': [
-                'linux/seccomp-bpf/sandbox_bpf.cc',
-                'linux/seccomp-bpf/sandbox_bpf.h',
-                'linux/seccomp-bpf/verifier.cc',
-                'linux/seccomp-bpf/verifier.h',
-              ],
-              'dependencies': [
-                '../base/base.gyp:base',
-              ],
-              'include_dirs': [
-                '..',
-              ],
-            }],
-          ],
-        },
-      ],
-    }],
-    [ 'OS=="linux" and selinux==0', {
-      'targets': [
-        {
-          'target_name': 'chrome_sandbox',
-          'type': 'executable',
-          'sources': [
-            'linux/suid/linux_util.c',
-            'linux/suid/linux_util.h',
-            'linux/suid/process_util.h',
-            'linux/suid/process_util_linux.c',
-            'linux/suid/sandbox.h',
-            'linux/suid/sandbox.c',
-          ],
-          'cflags': [
-            # For ULLONG_MAX
-            '-std=gnu99',
-          ],
-          'include_dirs': [
-            '..',
-          ],
-        },
-      ],
+        }
+       ]
     }],
     [ 'OS=="win"', {
       'targets': [
diff --git a/sandbox/sandbox_linux.gypi b/sandbox/sandbox_linux.gypi
new file mode 100644
index 0000000..e03c5b5
--- /dev/null
+++ b/sandbox/sandbox_linux.gypi
@@ -0,0 +1,59 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+  'targets': [
+    {
+      'target_name': 'sandbox',
+      'type': 'none',
+      'conditions': [
+        # Only compile in the seccomp mode 1 code for the flag combination
+        # where we support it.
+        [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64") '
+          'and toolkit_views==0 and selinux==0', {
+          'dependencies': [
+            '../seccompsandbox/seccomp.gyp:seccomp_sandbox',
+          ],
+        }],
+        # This does not include Android.
+        [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
+          'type': 'static_library',
+          # Compile seccomp mode 2 code on Linux
+          'sources': [
+            'linux/seccomp-bpf/sandbox_bpf.cc',
+            'linux/seccomp-bpf/sandbox_bpf.h',
+            'linux/seccomp-bpf/verifier.cc',
+            'linux/seccomp-bpf/verifier.h',
+          ],
+          'dependencies': [
+            '../base/base.gyp:base',
+          ],
+          'include_dirs': [
+            '..',
+          ],
+        }],
+      ],
+    },
+    {
+      # The setuid sandbox, for Linux
+      'target_name': 'chrome_sandbox',
+      'type': 'executable',
+      'sources': [
+        'linux/suid/linux_util.c',
+        'linux/suid/linux_util.h',
+        'linux/suid/process_util.h',
+        'linux/suid/process_util_linux.c',
+        'linux/suid/sandbox.h',
+        'linux/suid/sandbox.c',
+      ],
+      'cflags': [
+        # For ULLONG_MAX
+        '-std=gnu99',
+      ],
+      'include_dirs': [
+        '..',
+      ],
+    },
+  ],
+}