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 22 matching lines...) Expand all Loading... |
33 'arm-thumb2' : 'pnacl', | 33 'arm-thumb2' : 'pnacl', |
34 'x86-32': 'i686', | 34 'x86-32': 'i686', |
35 'x86-64': 'x86_64'}.get(platform, uplatform) | 35 'x86-64': 'x86_64'}.get(platform, uplatform) |
36 cplatform = { | 36 cplatform = { |
37 'win32': 'win', | 37 'win32': 'win', |
38 'cygwin': 'win', | 38 'cygwin': 'win', |
39 'darwin': 'mac', | 39 'darwin': 'mac', |
40 }.get(sys.platform, 'linux') | 40 }.get(sys.platform, 'linux') |
41 if platform in ['arm', 'arm-thumb2']: | 41 if platform in ['arm', 'arm-thumb2']: |
42 cmd = [ | 42 cmd = [ |
43 os.path.join(SRC_DIR, 'native_client', 'toolchain', | 43 '../native_client/toolchain/pnacl_linux_x86_64_newlib/bin/' + |
44 'pnacl_linux_x86_64_newlib', 'bin', | 44 platform2 + '-strip', |
45 platform2 + '-strip'), | |
46 '--strip-debug', src, '-o', dst | 45 '--strip-debug', src, '-o', dst |
47 ] | 46 ] |
48 else: | 47 else: |
49 cmd = [ | 48 cmd = [ |
50 os.path.join(SRC_DIR, 'native_client', 'toolchain', | 49 '../native_client/toolchain/' + cplatform + '_x86_newlib/bin/' + |
51 cplatform + '_x86_newlib', 'bin', | 50 platform2 + '-nacl-strip', |
52 platform2 + '-nacl-strip'), | |
53 '--strip-debug', src, '-o', dst | 51 '--strip-debug', src, '-o', dst |
54 ] | 52 ] |
55 print 'Running: ' + ' '.join(cmd) | 53 print 'Running: ' + ' '.join(cmd) |
56 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) | 54 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) |
57 p.wait() | 55 p.wait() |
58 if p.returncode != 0: | 56 if p.returncode != 0: |
59 sys.exit(4) | 57 sys.exit(4) |
60 | 58 |
61 | 59 |
62 def Main(argv): | 60 def Main(argv): |
63 parser = optparse.OptionParser() | 61 parser = optparse.OptionParser() |
64 parser.add_option('--platform', dest='platforms', | 62 parser.add_option('--platform', dest='platforms', |
65 help='select a platform to strip') | 63 help='select a platform to strip') |
66 parser.add_option('--src', dest='src', | 64 parser.add_option('--src', dest='src', |
67 help='source IRT file') | 65 help='source IRT file') |
68 parser.add_option('--dst', dest='dst', | 66 parser.add_option('--dst', dest='dst', |
69 help='destination IRT file') | 67 help='destination IRT file') |
70 (options, args) = parser.parse_args(argv[1:]) | 68 (options, args) = parser.parse_args(argv[1:]) |
71 if args or not options.platforms: | 69 if args or not options.platforms: |
72 parser.print_help() | 70 parser.print_help() |
73 sys.exit(1) | 71 sys.exit(1) |
74 | 72 |
75 StripIRT(options.platforms, options.src, options.dst) | 73 StripIRT(options.platforms, options.src, options.dst) |
76 | 74 |
77 | 75 |
78 if __name__ == '__main__': | 76 if __name__ == '__main__': |
79 Main(sys.argv) | 77 Main(sys.argv) |
OLD | NEW |