OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import re | 8 import re |
9 import shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
11 import sys | 11 import sys |
12 | 12 |
13 | 13 |
14 # Where things are in relation to this script. | 14 # Where things are in relation to this script. |
15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
16 SRC_DIR = os.path.dirname(SCRIPT_DIR) | 16 SRC_DIR = os.path.dirname(SCRIPT_DIR) |
17 NACL_DIR = os.path.join(SRC_DIR, 'native_client') | 17 NACL_DIR = os.path.join(SRC_DIR, 'native_client') |
18 | 18 |
19 # Pathing to the two command_buffer directories (relative to native_client). | 19 # Pathing to the two command_buffer directories (relative to native_client). |
20 NACL_CMD_BUFFER_DIR = os.path.join('src', 'shared', | 20 NACL_CMD_BUFFER_DIR = os.path.join('src', 'shared', |
21 'ppapi_proxy', 'command_buffer') | 21 'ppapi_proxy', 'command_buffer') |
22 GPU_CMD_BUFFER_DIR = os.path.join('..', 'gpu', 'command_buffer') | 22 GPU_CMD_BUFFER_DIR = os.path.join('..', 'gpu', 'command_buffer') |
23 | 23 |
| 24 # Pathing to mirror of nacl tree in ppapi. |
| 25 PPAPI_NACL_DIR = os.path.join(SRC_DIR, 'ppapi', 'native_client') |
| 26 |
24 | 27 |
25 def RelativePath(path, base): | 28 def RelativePath(path, base): |
26 """Find the relative path. | 29 """Find the relative path. |
27 | 30 |
28 Arguments: | 31 Arguments: |
29 path: path we want a relative path to. | 32 path: path we want a relative path to. |
30 base: path we want a relative path from. | 33 base: path we want a relative path from. |
31 Returns: | 34 Returns: |
32 The relative path from base to path. | 35 The relative path from base to path. |
33 """ | 36 """ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 filename = m.group(1) | 90 filename = m.group(1) |
88 if '[' in filename: | 91 if '[' in filename: |
89 continue | 92 continue |
90 if filename.startswith('scons-out'): | 93 if filename.startswith('scons-out'): |
91 continue | 94 continue |
92 if filename.endswith('.nexe'): | 95 if filename.endswith('.nexe'): |
93 continue | 96 continue |
94 # Apply the underlay of gpu/command_buffer (to match scons). | 97 # Apply the underlay of gpu/command_buffer (to match scons). |
95 if filename.startswith(NACL_CMD_BUFFER_DIR + os.sep): | 98 if filename.startswith(NACL_CMD_BUFFER_DIR + os.sep): |
96 filename = GPU_CMD_BUFFER_DIR + filename[len(NACL_CMD_BUFFER_DIR):] | 99 filename = GPU_CMD_BUFFER_DIR + filename[len(NACL_CMD_BUFFER_DIR):] |
| 100 # Apply the underlay of ppapi (to match scons). |
| 101 if (not os.path.exists(os.path.join(NACL_DIR, filename)) and |
| 102 os.path.exists(os.path.join(PPAPI_NACL_DIR, filename))): |
| 103 filename = '../ppapi/native_client/' + filename |
97 inputs.add(filename) | 104 inputs.add(filename) |
98 # Check that everything exists and make it script relative. | 105 # Check that everything exists and make it script relative. |
99 # Exclude things above SRC_DIR. | 106 # Exclude things above SRC_DIR. |
100 rel_inputs = set() | 107 rel_inputs = set() |
101 for f in inputs: | 108 for f in inputs: |
102 nf = os.path.join(NACL_DIR, f) | 109 nf = os.path.join(NACL_DIR, f) |
103 if not os.path.exists(nf): | 110 if not os.path.exists(nf): |
104 raise Exception('missing input file "%s"' % nf) | 111 raise Exception('missing input file "%s"' % nf) |
105 # If the relative path from SRC_DIR to the file starts with ../ ignore it. | 112 # If the relative path from SRC_DIR to the file starts with ../ ignore it. |
106 # (i.e. the file is outside the client). | 113 # (i.e. the file is outside the client). |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 sys.exit(1) | 201 sys.exit(1) |
195 | 202 |
196 if options.inputs: | 203 if options.inputs: |
197 PrintInputs(options.platforms) | 204 PrintInputs(options.platforms) |
198 else: | 205 else: |
199 BuildIRT(options.platforms, options.outdir) | 206 BuildIRT(options.platforms, options.outdir) |
200 | 207 |
201 | 208 |
202 if __name__ == '__main__': | 209 if __name__ == '__main__': |
203 Main(sys.argv) | 210 Main(sys.argv) |
OLD | NEW |