Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/strip_nacl_irt.py

Issue 8539039: Fix size regression due to missing strip. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python
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
4 # found in the LICENSE file.
5
6 import optparse
7 import os
8 import re
9 import shutil
10 import subprocess
11 import sys
12
13
14 # Where things are in relation to this script.
15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
16 SRC_DIR = os.path.dirname(SCRIPT_DIR)
17 NACL_DIR = os.path.join(SRC_DIR, 'native_client')
18
19
20 def StripIRT(platforms, src, dst):
21 """Build the IRT for several platforms.
22
23 Arguments:
24 platforms: list of platform names to build for.
25 out_dir: directory to output the IRT to.
26 """
27 uplatform = platform.replace('-', '_')
28 # NaCl Trusted code is in thumb2 mode in CrOS, but as yet,
29 # untrusted code is still in classic ARM mode
30 # arm-thumb2 is for the future when untrusted code is in thumb2 as well
31 platform2 = {'arm': 'pnacl',
32 'arm-thumb2' : 'pnacl',
33 'x86-32': 'i686',
34 'x86-64': 'x86_64'}.get(platform, platform)
35 cplatform = {
36 'win32': 'win',
37 'cygwin': 'win',
38 'darwin': 'mac',
39 }.get(sys.platform, 'linux')
40 if platform in ['arm', 'arm-thumb2']:
41 cmd = [
42 '../native_client/toolchain/pnacl_linux_x86_64_newlib/bin/' +
43 platform2 + '-strip',
44 '--strip-debug', src, '-o', dst
45 ]
46 else:
47 cmd = [
48 '../native_client/toolchain/' + cplatform + '_x86_newlib/bin/' +
49 platform2 + '-nacl-strip',
50 '--strip-debug', src, '-o', dst
51 ]
52 print 'Running: ' + ' '.join(cmd)
53 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR)
54 p.wait()
55 if p.returncode != 0:
56 sys.exit(4)
57
58
59 def Main(argv):
60 parser = optparse.OptionParser()
61 parser.add_option('--platform', dest='platforms',
62 help='select a platform to strip')
63 parser.add_option('--src', dest='from',
64 help='source IRT file')
65 parser.add_option('--dst', dest='from',
66 help='destination IRT file')
67 (options, args) = parser.parse_args(argv[1:])
68 if args or not options.platforms:
69 parser.print_help()
70 sys.exit(1)
71
72 StripIRT(options.platforms, options.src, options.dst)
73
74
75 if __name__ == '__main__':
76 Main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | ppapi/native_client/native_client.gyp » ('j') | ppapi/native_client/native_client.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698