Home | History | Annotate | Download | only in ppapi
      1 # Copyright (c) 2013 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   'includes': [
      7     '../native_client/build/untrusted.gypi',
      8   ],
      9   'target_defaults': {
     10     # We need to override the variables in untrusted.gypi outside of a
     11     # target_condition block because the target_condition block in
     12     # untrusted gypi is fully evaluated and interpolated before any of the
     13     # target_condition blocks in this file are expanded.  This means that any
     14     # variables overriden inside a target_condition block in this file will not
     15     # affect the values in untrusted.gypi.
     16     'variables': {
     17       'test_files': [],
     18       'generate_nmf%': 1,
     19       'nacl_newlib_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/newlib',
     20       'nacl_glibc_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/glibc',
     21       'nacl_pnacl_newlib_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/pnacl',
     22       'target_conditions': [
     23         ['nexe_target!=""', {
     24           # These variables are used for nexe building and for library building.
     25           'out_newlib32%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_32.nexe',
     26           'out_newlib64%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_64.nexe',
     27           'out_newlib_arm%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_arm.nexe',
     28           'nmf_newlib%': '>(nacl_newlib_out_dir)/>(nexe_target).nmf',
     29           'out_glibc32%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_32.nexe',
     30           'out_glibc64%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_64.nexe',
     31           'out_glibc_arm%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_arm.nexe',
     32           'nmf_glibc%': '>(nacl_glibc_out_dir)/>(nexe_target).nmf',
     33           'out_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target)_newlib_pnacl.pexe',
     34           'nmf_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target).nmf',
     35         }],
     36       ],
     37     },
     38     'dependencies': [
     39        '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
     40        '<(DEPTH)/ppapi/ppapi_untrusted.gyp:ppapi_cpp_lib',
     41        '<(DEPTH)/ppapi/native_client/native_client.gyp:ppapi_lib',
     42     ],
     43     'target_conditions': [
     44       ['test_files!=[] and build_newlib==1', {
     45         'copies': [
     46           {
     47             'destination': '>(nacl_newlib_out_dir)',
     48             'files': [
     49               '>@(test_files)',
     50             ],
     51           },
     52         ],
     53       }],
     54       ['test_files!=[] and "<(target_arch)"!="arm" and disable_glibc==0 and build_glibc==1', {
     55         'copies': [
     56           {
     57             'destination': '>(nacl_glibc_out_dir)',
     58             'files': [
     59               '>@(test_files)',
     60             ],
     61           },
     62         ],
     63       }],
     64       ['test_files!=[] and build_pnacl_newlib==1 and disable_pnacl==0', {
     65         'copies': [
     66           {
     67             'destination': '>(nacl_pnacl_newlib_out_dir)',
     68             'files': [
     69               '>@(test_files)',
     70             ],
     71           },
     72         ],
     73       }],
     74       ['nexe_target!=""', {
     75         'variables': {
     76           # Patch over the fact that untrusted.gypi doesn't define these in all
     77           # cases.
     78           'enable_x86_64%': 0,
     79           'enable_x86_32%': 0,
     80           'enable_arm%': 0,
     81           'include_dirs': [
     82             '<(DEPTH)',
     83           ],
     84           'link_flags': [
     85             '-lppapi_cpp',
     86             '-lppapi',
     87             '-pthread',
     88           ],
     89           'extra_args': [
     90             '--strip-all',
     91           ],
     92           'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
     93         },
     94         'target_conditions': [
     95           ['generate_nmf==1 and build_newlib==1', {
     96             'actions': [
     97               {
     98                 'action_name': 'Generate NEWLIB NMF',
     99                 'inputs': ['>(create_nmf)'],
    100                 'outputs': ['>(nmf_newlib)'],
    101                 'action': [
    102                   'python',
    103                   '>@(_inputs)',
    104                   '--output=>(nmf_newlib)',
    105                 ],
    106                 'target_conditions': [
    107                   ['enable_x86_64==1', {
    108                     'inputs': ['>(out_newlib64)'],
    109                   }],
    110                   ['enable_x86_32==1', {
    111                     'inputs': ['>(out_newlib32)'],
    112                   }],
    113                   ['enable_arm==1', {
    114                     'inputs': ['>(out_newlib_arm)'],
    115                   }],
    116                 ],
    117               },
    118             ],
    119           }],
    120           ['"<(target_arch)"!="arm" and generate_nmf==1 and disable_glibc==0 and build_glibc==1', {
    121             'variables': {
    122               # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
    123               # doesn't work on Windows.
    124               'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
    125               'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
    126               'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
    127             },
    128             'actions': [
    129               {
    130                 'action_name': 'Generate GLIBC NMF and copy libs',
    131                 'inputs': ['>(create_nmf)'],
    132                 # NOTE: There is no explicit dependency for the lib32
    133                 # and lib64 directories created in the PRODUCT_DIR.
    134                 # They are created as a side-effect of NMF creation.
    135                 'outputs': ['>(nmf_glibc)'],
    136                 'action': [
    137                   'python',
    138                   '>@(_inputs)',
    139                   '--objdump=>(nacl_objdump)',
    140                   '--output=>(nmf_glibc)',
    141                   '--path-prefix=>(nexe_target)_libs',
    142                   '--stage-dependencies=<(nacl_glibc_out_dir)',
    143                 ],
    144                 'target_conditions': [
    145                   ['enable_x86_64==1', {
    146                     'inputs': ['>(out_glibc64)'],
    147                     'action': [
    148                       '--library-path=>(libdir_glibc64)',
    149                       '--library-path=>(tc_lib_dir_glibc64)',
    150                     ],
    151                   }],
    152                   ['enable_x86_32==1', {
    153                     'inputs': ['>(out_glibc32)'],
    154                     'action': [
    155                       '--library-path=>(libdir_glibc32)',
    156                       '--library-path=>(tc_lib_dir_glibc32)',
    157                     ],
    158                   }],
    159                   # TODO(ncbray) handle arm case.  We don't have ARM glibc yet.
    160                 ],
    161               },
    162             ],
    163           }],
    164           ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0', {
    165             'actions': [
    166               {
    167                 'action_name': 'Generate PNACL NEWLIB NMF',
    168                 # NOTE: create_nmf must be first, it is the script python
    169                 # executes below.
    170                 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'],
    171                 'outputs': ['>(nmf_pnacl_newlib)'],
    172                 'action': [
    173                   'python',
    174                   '>@(_inputs)',
    175                   '--output=>(nmf_pnacl_newlib)',
    176                 ],
    177               },
    178             ],
    179           }],
    180         ],
    181       }],
    182     ],
    183   },
    184 }
    185