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

Side by Side Diff: pydir/build-pnacl-ir.py

Issue 1162903003: Subzero: Change pnacl_newlib ==> pnacl_newlib_raw in scripts. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « no previous file | pydir/crosstest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import errno 4 import errno
5 import os 5 import os
6 import shutil 6 import shutil
7 import tempfile 7 import tempfile
8 from utils import shellcmd 8 from utils import shellcmd
9 from utils import FindBaseNaCl 9 from utils import FindBaseNaCl
10 10
11 if __name__ == '__main__': 11 if __name__ == '__main__':
12 argparser = argparse.ArgumentParser() 12 argparser = argparse.ArgumentParser()
13 argparser.add_argument('cfile', nargs='+', type=str, 13 argparser.add_argument('cfile', nargs='+', type=str,
14 help='C file(s) to convert') 14 help='C file(s) to convert')
15 argparser.add_argument('--dir', nargs='?', type=str, default='.', 15 argparser.add_argument('--dir', nargs='?', type=str, default='.',
16 help='Output directory. Default "%(default)s".') 16 help='Output directory. Default "%(default)s".')
17 argparser.add_argument('--disable-verify', action='store_true') 17 argparser.add_argument('--disable-verify', action='store_true')
18 args = argparser.parse_args() 18 args = argparser.parse_args()
19 19
20 nacl_root = FindBaseNaCl() 20 nacl_root = FindBaseNaCl()
21 # Prepend bin to $PATH. 21 # Prepend bin to $PATH.
22 os.environ['PATH'] = ( 22 os.environ['PATH'] = (
23 nacl_root + '/toolchain/linux_x86/pnacl_newlib/bin' + os.pathsep + 23 nacl_root + '/toolchain/linux_x86/pnacl_newlib_raw/bin' + os.pathsep +
24 os.pathsep + os.environ['PATH']) 24 os.pathsep + os.environ['PATH'])
25 25
26 try: 26 try:
27 tempdir = tempfile.mkdtemp() 27 tempdir = tempfile.mkdtemp()
28 28
29 for cname in args.cfile: 29 for cname in args.cfile:
30 basename = os.path.splitext(cname)[0] 30 basename = os.path.splitext(cname)[0]
31 llname = os.path.join(tempdir, basename + '.ll') 31 llname = os.path.join(tempdir, basename + '.ll')
32 pnaclname = basename + '.pnacl.ll' 32 pnaclname = basename + '.pnacl.ll'
33 pnaclname = os.path.join(args.dir, pnaclname) 33 pnaclname = os.path.join(args.dir, pnaclname)
34 34
35 shellcmd('pnacl-clang -O2 -c {0} -o {1}'.format(cname, llname)) 35 shellcmd('pnacl-clang -O2 -c {0} -o {1}'.format(cname, llname))
36 shellcmd('pnacl-opt ' + 36 shellcmd('pnacl-opt ' +
37 '-pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' + 37 '-pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' +
38 ('' if args.disable_verify else 38 ('' if args.disable_verify else
39 ' -verify-pnaclabi-module -verify-pnaclabi-functions') + 39 ' -verify-pnaclabi-module -verify-pnaclabi-functions') +
40 ' -pnaclabi-allow-debug-metadata' 40 ' -pnaclabi-allow-debug-metadata'
41 ' {0} -S -o {1}'.format(llname, pnaclname)) 41 ' {0} -S -o {1}'.format(llname, pnaclname))
42 finally: 42 finally:
43 try: 43 try:
44 shutil.rmtree(tempdir) 44 shutil.rmtree(tempdir)
45 except OSError as exc: 45 except OSError as exc:
46 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory 46 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory
47 raise # re-raise exception 47 raise # re-raise exception
OLDNEW
« no previous file with comments | « no previous file | pydir/crosstest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698