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 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 devnull = open(os.devnull, 'r') | 156 devnull = open(os.devnull, 'r') |
157 else: | 157 else: |
158 devnull = None | 158 devnull = None |
159 p = subprocess.Popen(cmd, cwd=NACL_DIR, stdin=devnull) | 159 p = subprocess.Popen(cmd, cwd=NACL_DIR, stdin=devnull) |
160 p.wait() | 160 p.wait() |
161 if p.returncode != 0: | 161 if p.returncode != 0: |
162 sys.exit(3) | 162 sys.exit(3) |
163 # Copy out each platform after stripping. | 163 # Copy out each platform after stripping. |
164 for platform in platforms: | 164 for platform in platforms: |
165 uplatform = platform.replace('-', '_') | 165 uplatform = platform.replace('-', '_') |
166 platform2 = {'x86-32': 'i686', 'x86-64': 'x86_64'}.get(platform, platform) | 166 # NaCl Trusted code is in thumb2 mode in CrOS, but as yet, |
| 167 # untrusted code is still in classic ARM mode |
| 168 # arm-thumb2 is for the future when untrusted code is in thumb2 as well |
| 169 platform2 = {'arm': 'pnacl', |
| 170 'arm-thumb2' : 'pnacl', |
| 171 'x86-32': 'i686', |
| 172 'x86-64': 'x86_64'}.get(platform, platform) |
167 cplatform = { | 173 cplatform = { |
168 'win32': 'win', | 174 'win32': 'win', |
169 'cygwin': 'win', | 175 'cygwin': 'win', |
170 'darwin': 'mac', | 176 'darwin': 'mac', |
171 }.get(sys.platform, 'linux') | 177 }.get(sys.platform, 'linux') |
172 nexe = os.path.join(out_dir, 'nacl_irt_' + uplatform + '.nexe') | 178 nexe = os.path.join(out_dir, 'nacl_irt_' + uplatform + '.nexe') |
173 cmd = [ | 179 if platform in ['arm', 'arm-thumb2']: |
174 '../native_client/toolchain/' + cplatform + '_x86_newlib/bin/' + | 180 cmd = [ |
| 181 '../native_client/toolchain/pnacl_linux_x86_64_newlib/bin/' + |
| 182 platform2 + '-strip', |
| 183 '--strip-debug', |
| 184 '../native_client/scons-out/nacl_irt-' + platform \ |
| 185 + '/staging/irt.nexe', |
| 186 '-o', nexe |
| 187 ] |
| 188 else: |
| 189 cmd = [ |
| 190 '../native_client/toolchain/' + cplatform + '_x86_newlib/bin/' + |
175 platform2 + '-nacl-strip', | 191 platform2 + '-nacl-strip', |
176 '--strip-debug', | 192 '--strip-debug', |
177 '../native_client/scons-out/nacl_irt-' + platform + '/staging/irt.nexe', | 193 '../native_client/scons-out/nacl_irt-' + platform \ |
178 '-o', nexe | 194 + '/staging/irt.nexe', |
179 ] | 195 '-o', nexe |
| 196 ] |
180 print 'Running: ' + ' '.join(cmd) | 197 print 'Running: ' + ' '.join(cmd) |
181 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) | 198 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) |
182 p.wait() | 199 p.wait() |
183 if p.returncode != 0: | 200 if p.returncode != 0: |
184 sys.exit(4) | 201 sys.exit(4) |
185 | 202 |
186 | 203 |
187 def Main(argv): | 204 def Main(argv): |
188 parser = optparse.OptionParser() | 205 parser = optparse.OptionParser() |
189 parser.add_option('--inputs', dest='inputs', default=False, | 206 parser.add_option('--inputs', dest='inputs', default=False, |
(...skipping 11 matching lines...) Expand all Loading... |
201 sys.exit(1) | 218 sys.exit(1) |
202 | 219 |
203 if options.inputs: | 220 if options.inputs: |
204 PrintInputs(options.platforms) | 221 PrintInputs(options.platforms) |
205 else: | 222 else: |
206 BuildIRT(options.platforms, options.outdir) | 223 BuildIRT(options.platforms, options.outdir) |
207 | 224 |
208 | 225 |
209 if __name__ == '__main__': | 226 if __name__ == '__main__': |
210 Main(sys.argv) | 227 Main(sys.argv) |
OLD | NEW |