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 + '/staging/irt.nexe ', | |
bradn
2011/10/24 19:20:07
>80
| |
185 '-o', nexe | |
186 ] | |
187 else: | |
188 cmd = [ | |
189 '../native_client/toolchain/' + cplatform + '_x86_newlib/bin/' + | |
175 platform2 + '-nacl-strip', | 190 platform2 + '-nacl-strip', |
176 '--strip-debug', | 191 '--strip-debug', |
177 '../native_client/scons-out/nacl_irt-' + platform + '/staging/irt.nexe', | 192 '../native_client/scons-out/nacl_irt-' + platform + '/staging/irt.nexe ', |
bradn
2011/10/24 19:20:07
>80
| |
178 '-o', nexe | 193 '-o', nexe |
179 ] | 194 ] |
180 print 'Running: ' + ' '.join(cmd) | 195 print 'Running: ' + ' '.join(cmd) |
181 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) | 196 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) |
182 p.wait() | 197 p.wait() |
183 if p.returncode != 0: | 198 if p.returncode != 0: |
184 sys.exit(4) | 199 sys.exit(4) |
185 | 200 |
186 | 201 |
187 def Main(argv): | 202 def Main(argv): |
188 parser = optparse.OptionParser() | 203 parser = optparse.OptionParser() |
189 parser.add_option('--inputs', dest='inputs', default=False, | 204 parser.add_option('--inputs', dest='inputs', default=False, |
(...skipping 11 matching lines...) Expand all Loading... | |
201 sys.exit(1) | 216 sys.exit(1) |
202 | 217 |
203 if options.inputs: | 218 if options.inputs: |
204 PrintInputs(options.platforms) | 219 PrintInputs(options.platforms) |
205 else: | 220 else: |
206 BuildIRT(options.platforms, options.outdir) | 221 BuildIRT(options.platforms, options.outdir) |
207 | 222 |
208 | 223 |
209 if __name__ == '__main__': | 224 if __name__ == '__main__': |
210 Main(sys.argv) | 225 Main(sys.argv) |
OLD | NEW |