1 # Copyright 2014 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 # This GYP file defines untrusted (NaCl) targets. All targets in this 6 # file should be conditionally depended upon via 'disable_nacl!=1' to avoid 7 # requiring NaCl sources for building. 8 9 { 10 'includes': [ 11 '../build/common_untrusted.gypi', 12 'ppapi_sources.gypi', 13 ], 14 'targets': [ 15 { 16 'target_name': 'ppapi_cpp_lib', 17 'type': 'none', 18 'variables': { 19 'nlib_target': 'libppapi_cpp.a', 20 'nso_target': 'libppapi_cpp.so', 21 'build_glibc': 1, 22 'build_newlib': 1, 23 'build_pnacl_newlib': 1, 24 'sources': [ 25 '<@(cpp_source_files)', 26 'cpp/module_embedder.h', 27 'cpp/ppp_entrypoints.cc', 28 ], 29 }, 30 'dependencies': [ 31 '<(DEPTH)/native_client/tools.gyp:prep_toolchain', 32 ], 33 }, 34 { 35 'target_name': 'ppapi_gles2_lib', 36 'type': 'none', 37 'variables': { 38 'nlib_target': 'libppapi_gles2.a', 39 'nso_target': 'libppapi_gles2.so', 40 'build_glibc': 1, 41 'build_newlib': 1, 42 'build_pnacl_newlib': 1, 43 'include_dirs': [ 44 'lib/gl/include', 45 ], 46 'sources': [ 47 'lib/gl/gles2/gl2ext_ppapi.c', 48 'lib/gl/gles2/gl2ext_ppapi.h', 49 'lib/gl/gles2/gles2.c', 50 ], 51 }, 52 'dependencies': [ 53 '<(DEPTH)/native_client/tools.gyp:prep_toolchain', 54 ], 55 }, 56 { 57 'target_name': 'ppapi_nacl_tests', 58 'type': 'none', 59 'dependencies': [ 60 '<(DEPTH)/native_client/tools.gyp:prep_toolchain', 61 '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib', 62 '<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib', 63 'ppapi_cpp_lib', 64 'native_client/native_client.gyp:ppapi_lib', 65 ], 66 'variables': { 67 # This is user code (vs IRT code), so tls accesses do not 68 # need to be indirect through a function call. 69 'newlib_tls_flags=': [], 70 # TODO(bradnelson): Remove this compile flag once new nacl_rev is 71 # above 9362. 72 'compile_flags': [ 73 '-DGL_GLEXT_PROTOTYPES', 74 ], 75 # Speed up pnacl linking by not generating debug info for tests. 76 # We compile with --strip-all under extra_args so debug info is 77 # discarded anyway. Remove this and the --strip-all flag if 78 # debug info is really needed. 79 'compile_flags!': [ 80 '-g', 81 ], 82 'defines': [ 83 'GL_GLEXT_PROTOTYPES', 84 ], 85 'nexe_target': 'ppapi_nacl_tests', 86 'build_newlib': 1, 87 'include_dirs': [ 88 'lib/gl/include', 89 '..', 90 ], 91 'link_flags': [ 92 '-lppapi_cpp', 93 '-lppapi', 94 '-pthread', 95 ], 96 'link_flags!': [ 97 '-O3', 98 ], 99 'translate_flags': [ 100 '-O0', 101 ], 102 'conditions': [ 103 ['target_arch=="ia32"', { 104 'extra_deps_newlib32': [ 105 '>(tc_lib_dir_newlib32)/libppapi_cpp.a', 106 '>(tc_lib_dir_newlib32)/libppapi.a', 107 ], 108 'extra_deps_glibc32': [ 109 '>(tc_lib_dir_glibc32)/libppapi_cpp.so', 110 '>(tc_lib_dir_glibc32)/libppapi.so', 111 ], 112 }], 113 ['target_arch=="x64" or (target_arch=="ia32" and OS=="win")', { 114 'extra_deps_newlib64': [ 115 '>(tc_lib_dir_newlib64)/libppapi_cpp.a', 116 '>(tc_lib_dir_newlib64)/libppapi.a', 117 ], 118 'extra_deps_glibc64': [ 119 '>(tc_lib_dir_glibc64)/libppapi_cpp.so', 120 '>(tc_lib_dir_glibc64)/libppapi.so', 121 ], 122 }], 123 ['target_arch=="arm"', { 124 'extra_deps_arm': [ 125 '>(tc_lib_dir_newlib_arm)/libppapi_cpp.a', 126 '>(tc_lib_dir_newlib_arm)/libppapi.a', 127 ], 128 }], 129 ], 130 'extra_deps_pnacl_newlib': [ 131 '>(tc_lib_dir_pnacl_newlib)/libppapi_cpp.a', 132 '>(tc_lib_dir_pnacl_newlib)/libppapi.a', 133 ], 134 'sources': [ 135 '<@(test_common_source_files)', 136 '<@(test_nacl_source_files)', 137 ], 138 'extra_args': [ 139 '--strip-all', 140 ], 141 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', 142 'create_nonsfi_test_nmf': 'tests/create_nonsfi_test_nmf.py', 143 }, 144 'conditions': [ 145 ['(target_arch=="ia32" or target_arch=="x64") and disable_glibc==0', { 146 'variables': { 147 'build_glibc': 1, 148 # NOTE: Use /lib, not /lib64 here; it is a symbolic link which 149 # doesn't work on Windows. 150 'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib', 151 'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32', 152 'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump', 153 'nmf_glibc%': '<(PRODUCT_DIR)/>(nexe_target)_glibc.nmf', 154 }, 155 'actions': [ 156 { 157 'action_name': 'Generate GLIBC NMF and copy libs', 158 # NOTE: create_nmf must be first, it is the script python executes 159 # below. 160 'inputs': ['>(create_nmf)'], 161 # NOTE: There is no explicit dependency for the lib32 162 # and lib64 directories created in the PRODUCT_DIR. 163 # They are created as a side-effect of NMF creation. 164 'outputs': ['>(nmf_glibc)'], 165 'action': [ 166 'python', 167 '>@(_inputs)', 168 '--objdump=>(nacl_objdump)', 169 '--output=>(nmf_glibc)', 170 '--stage-dependencies=<(PRODUCT_DIR)', 171 ], 172 'conditions': [ 173 ['target_arch=="ia32"', { 174 'action': [ 175 '--library-path=>(libdir_glibc32)', 176 '--library-path=>(tc_lib_dir_glibc32)', 177 ], 178 'inputs': ['>(out_glibc32)'], 179 }], 180 ['target_arch=="x64" or (target_arch=="ia32" and OS=="win")', { 181 'action': [ 182 '--library-path=>(libdir_glibc64)', 183 '--library-path=>(tc_lib_dir_glibc64)', 184 ], 185 'inputs': ['>(out_glibc64)'], 186 }], 187 ], 188 }, 189 ], 190 }], 191 # Test PNaCl pre-translated code (pre-translated to save bot time). 192 # We only care about testing that code generation is correct, 193 # and in-browser translation is tested elsewhere. 194 # NOTE: native_client/build/untrusted.gypi dictates that 195 # PNaCl only generate x86-32 and x86-64 on x86 platforms, 196 # ARM on ARM platforms, or MIPS on MIPS platforms, not all 197 # versions always. 198 # The same goes for the PNaCl shims. So, we have two variations here. 199 ['disable_pnacl==0 and (target_arch=="ia32" or target_arch=="x64")', { 200 'variables': { 201 'build_pnacl_newlib': 1, 202 'translate_pexe_with_build': 1, 203 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', 204 }, 205 # Shim is a dependency for the nexe because we pre-translate. 206 'dependencies': [ 207 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot', 208 ], 209 'actions': [ 210 { 211 'action_name': 'Generate PNACL NEWLIB NMF', 212 # NOTE: create_nmf must be first, it is the script python executes 213 # below. 214 'inputs': [ 215 '>(create_nmf)', 216 ], 217 'outputs': ['>(nmf_pnacl)'], 218 'action': [ 219 'python', 220 '>@(_inputs)', 221 '--output=>(nmf_pnacl)', 222 ], 223 'conditions': [ 224 ['target_arch=="ia32"', { 225 'inputs': [ 226 '>(out_pnacl_newlib_x86_32_nexe)', 227 ], 228 }], 229 ['target_arch=="x64" or (target_arch=="ia32" and OS=="win")', { 230 'inputs': [ 231 '>(out_pnacl_newlib_x86_64_nexe)', 232 ], 233 }], 234 ], 235 }, 236 ], 237 }], 238 ['disable_pnacl==0 and target_arch=="ia32" and OS=="linux"', { 239 # In addition to above configuration, build x86-32-nonsfi .nexe file 240 # by translating from .pexe binary, for non-SFI mode PPAPI testing. 241 'variables': { 242 'enable_x86_32_nonsfi': 1, 243 'translate_pexe_with_build': 1, 244 'nmf_nonsfi%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl_nonsfi.nmf', 245 }, 246 # Shim is a dependency for the nexe because we pre-translate. 247 'dependencies': [ 248 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot', 249 ], 250 'actions': [ 251 { 252 'action_name': 'Generate PNACL NEWLIB NONSFI NMF', 253 'inputs': ['>(create_nonsfi_test_nmf)'], 254 'outputs': ['>(nmf_nonsfi)'], 255 'action': [ 256 'python', 257 '>(create_nonsfi_test_nmf)', 258 '--output=>(nmf_nonsfi)', 259 '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)', 260 ], 261 }, 262 ], 263 }], 264 ['disable_pnacl==0 and target_arch=="arm"', { 265 'variables': { 266 'build_pnacl_newlib': 1, 267 'translate_pexe_with_build': 1, 268 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', 269 }, 270 # Shim is a dependency for the nexe because we pre-translate. 271 'dependencies': [ 272 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot', 273 ], 274 'actions': [ 275 { 276 'action_name': 'Generate PNACL NEWLIB NMF', 277 # NOTE: create_nmf must be first, it is the script python executes 278 # below. 279 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib_arm_nexe)'], 280 'outputs': ['>(nmf_pnacl)'], 281 'action': [ 282 'python', 283 '>@(_inputs)', 284 '--output=>(nmf_pnacl)', 285 ], 286 }, 287 ], 288 }], 289 ['disable_pnacl==0 and target_arch=="mipsel"', { 290 'variables': { 291 'build_pnacl_newlib': 1, 292 'translate_pexe_with_build': 1, 293 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', 294 }, 295 # Shim is a dependency for the nexe because we pre-translate. 296 'dependencies': [ 297 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot', 298 ], 299 'actions': [ 300 { 301 'action_name': 'Generate PNACL NEWLIB NMF', 302 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib_mips_nexe)'], 303 'outputs': ['>(nmf_pnacl)'], 304 'action': [ 305 'python', 306 '>@(_inputs)', 307 '--output=>(nmf_pnacl)', 308 ], 309 }, 310 ], 311 }], 312 ], 313 }, 314 ], 315 } 316