summaryrefslogtreecommitdiffstats
path: root/ppapi/ppapi_untrusted.gyp
blob: 4e11b2cfdffabdda0873b9b977e285d89d798af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# 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.

# This GYP file defines untrusted (NaCl) targets.  All targets in this
# file should be conditionally depended upon via 'disable_nacl!=1' to avoid
# requiring NaCl sources for building.

{
  'includes': [
    '../native_client/build/untrusted.gypi',
    'ppapi_sources.gypi',
  ],
  'targets': [
    {
      'target_name': 'ppapi_cpp_lib',
      'type': 'none',
      'variables': {
        'nlib_target': 'libppapi_cpp.a',
        'nso_target': 'libppapi_cpp.so',
        'build_glibc': 1,
        'build_newlib': 1,
        'build_pnacl_newlib': 1,
        'sources': [
          '<@(cpp_source_files)',
          'cpp/module_embedder.h',
          'cpp/ppp_entrypoints.cc',
        ],
      },
      'dependencies': [
        '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
      ],
    },
    {
      'target_name': 'ppapi_gles2_lib',
      'type': 'none',
      'variables': {
        'nlib_target': 'libppapi_gles2.a',
        'nso_target': 'libppapi_gles2.so',
        'build_glibc': 1,
        'build_newlib': 1,
        'build_pnacl_newlib': 1,
        'include_dirs': [
          'lib/gl/include',
        ],
        'sources': [
          'lib/gl/gles2/gl2ext_ppapi.c',
          'lib/gl/gles2/gl2ext_ppapi.h',
          'lib/gl/gles2/gles2.c',
        ],
      },
      'dependencies': [
        '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
      ],
    },
    {
      'target_name': 'ppapi_nacl_tests',
      'type': 'none',
      'dependencies': [
         '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
         'ppapi_cpp_lib',
         'native_client/native_client.gyp:ppapi_lib',
      ],
      'variables': {
        # This is user code (vs IRT code), so tls accesses do not
        # need to be indirect through a function call.
        'newlib_tls_flags=': [],
        # TODO(bradnelson): Remove this compile flag once new nacl_rev is
        # above 9362.
        'compile_flags': [
          '-DGL_GLEXT_PROTOTYPES',
        ],
        # Speed up pnacl linking by not generating debug info for tests.
        # We compile with --strip-all under extra_args so debug info is
        # discarded anyway.  Remove this and the --strip-all flag if
        # debug info is really needed.
       'compile_flags!': [
          '-g',
        ],
        'defines': [
          'GL_GLEXT_PROTOTYPES',
        ],
        'nexe_target': 'ppapi_nacl_tests',
        'build_newlib': 1,
        'include_dirs': [
          'lib/gl/include',
          '..',
        ],
        'link_flags': [
          '-lppapi_cpp',
          '-lppapi',
          '-pthread',
        ],
        'link_flags!': [
          '-O3',
        ],
        'translate_flags': [
          '-O0',
        ],
        'conditions': [
          ['target_arch!="arm"', {
            'extra_deps_newlib64': [
              '>(tc_lib_dir_newlib64)/libppapi_cpp.a',
              '>(tc_lib_dir_newlib64)/libppapi.a',
            ],
            'extra_deps_newlib32': [
              '>(tc_lib_dir_newlib32)/libppapi_cpp.a',
              '>(tc_lib_dir_newlib32)/libppapi.a',
            ],
            'extra_deps_glibc64': [
              '>(tc_lib_dir_glibc64)/libppapi_cpp.so',
              '>(tc_lib_dir_glibc64)/libppapi.so',
            ],
            'extra_deps_glibc32': [
              '>(tc_lib_dir_glibc32)/libppapi_cpp.so',
              '>(tc_lib_dir_glibc32)/libppapi.so',
            ],
          }],
          ['target_arch=="arm"', {
            'extra_deps_arm': [
              '>(tc_lib_dir_newlib_arm)/libppapi_cpp.a',
              '>(tc_lib_dir_newlib_arm)/libppapi.a',
            ],
          }],
        ],
        'extra_deps_pnacl_newlib': [
          '>(tc_lib_dir_pnacl_newlib)/libppapi_cpp.a',
          '>(tc_lib_dir_pnacl_newlib)/libppapi.a',
        ],
        'sources': [
          '<@(test_common_source_files)',
          '<@(test_nacl_source_files)',
        ],
        'extra_args': [
          '--strip-all',
        ],
      },
      'conditions': [
        ['target_arch!="arm" and disable_glibc==0', {
          'variables': {
            'build_glibc': 1,
            # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
            # doesn't work on Windows.
            'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
            'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
            'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
            'nmf_glibc%': '<(PRODUCT_DIR)/>(nexe_target)_glibc.nmf',
          },
          'actions': [
          {
            'action_name': 'Generate GLIBC NMF and copy libs',
            'inputs': ['>(out_glibc64)', '>(out_glibc32)'],
            # NOTE: There is no explicit dependency for the lib32
            # and lib64 directories created in the PRODUCT_DIR.
            # They are created as a side-effect of NMF creation.
            'outputs': ['>(nmf_glibc)'],
            'action': [
              'python',
              '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
              '>@(_inputs)',
              '--objdump=>(nacl_objdump)',
              '--library-path=>(libdir_glibc64)',
              '--library-path=>(libdir_glibc32)',
              '--library-path=>(tc_lib_dir_glibc32)',
              '--library-path=>(tc_lib_dir_glibc64)',
              '--output=>(nmf_glibc)',
              '--stage-dependencies=<(PRODUCT_DIR)',
            ],
            'msvs_cygwin_shell': 1,
          },
        ],
        }],
        # Test PNaCl pre-translated code (pre-translated to save bot time).
        # We only care about testing that code generation is correct,
        # and in-browser translation is tested elsewhere.
        # NOTE: native_client/build/untrusted.gypi dictates that
        # PNaCl only generate x86-32 and x86-64 on x86 platforms,
        # or ARM on ARM platforms, not all versions always.
        # The same goes for the PNaCl shims. So, we have two variations here.
        ['disable_pnacl==0 and target_arch!="arm"', {
          'variables': {
            'build_pnacl_newlib': 1,
            'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
          },
          # Shim is a dependency for the nexe because we pre-translate.
          'dependencies': [
            '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
          ],
         'actions': [
            {
              'action_name': 'Generate PNACL NEWLIB NMF',
              'inputs': ['>(out_pnacl_newlib_x86_32_nexe)',
                         '>(out_pnacl_newlib_x86_64_nexe)'],
              'outputs': ['>(nmf_pnacl)'],
              'action': [
                'python',
                '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
                '>@(_inputs)',
                '--output=>(nmf_pnacl)',
              ],
            },
          ],
        }],
        ['disable_pnacl==0 and target_arch=="arm"', {
          'variables': {
            'build_pnacl_newlib': 1,
            'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
          },
          # Shim is a dependency for the nexe because we pre-translate.
          'dependencies': [
            '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
          ],
          'actions': [
            {
              'action_name': 'Generate PNACL NEWLIB NMF',
              'inputs': ['>(out_pnacl_newlib_arm_nexe)'],
              'outputs': ['>(nmf_pnacl)'],
              'action': [
                'python',
                '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
                '>@(_inputs)',
                '--output=>(nmf_pnacl)',
              ],
            },
          ],
        }],
      ],
    },
  ],
}