OLD | NEW |
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 | 2 |
3 import argparse | 3 import argparse |
4 import os | 4 import os |
5 import shutil | 5 import shutil |
6 import tempfile | 6 import tempfile |
7 from utils import shellcmd | 7 from utils import shellcmd |
8 from utils import FindBaseNaCl | 8 from utils import FindBaseNaCl |
9 | 9 |
10 def Translate(ll_files, extra_args, obj, verbose): | 10 def Translate(ll_files, extra_args, obj, verbose): |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 def main(): | 31 def main(): |
32 """Build the Subzero runtime support library for all architectures. | 32 """Build the Subzero runtime support library for all architectures. |
33 """ | 33 """ |
34 argparser = argparse.ArgumentParser( | 34 argparser = argparse.ArgumentParser( |
35 description=' ' + main.__doc__, | 35 description=' ' + main.__doc__, |
36 formatter_class=argparse.RawTextHelpFormatter) | 36 formatter_class=argparse.RawTextHelpFormatter) |
37 argparser.add_argument('--verbose', '-v', dest='verbose', | 37 argparser.add_argument('--verbose', '-v', dest='verbose', |
38 action='store_true', | 38 action='store_true', |
39 help='Display some extra debugging output') | 39 help='Display some extra debugging output') |
| 40 argparser.add_argument('--pnacl-root', dest='pnacl_root', |
| 41 help='Path to PNaCl toolchain binaries.') |
40 args = argparser.parse_args() | 42 args = argparser.parse_args() |
41 nacl_root = FindBaseNaCl() | 43 nacl_root = FindBaseNaCl() |
42 os.environ['PATH'] = ( | 44 os.environ['PATH'] = ('{root}/bin{sep}{path}' |
43 '{root}/toolchain/linux_x86/pnacl_newlib/bin{sep}' + | 45 ).format(root=args.pnacl_root, sep=os.pathsep, path=os.environ['PATH']) |
44 '{path}' | |
45 ).format(root=nacl_root, sep=os.pathsep, path=os.environ['PATH']) | |
46 srcdir = ( | 46 srcdir = ( |
47 '{root}/toolchain_build/src/subzero/runtime' | 47 '{root}/toolchain_build/src/subzero/runtime' |
48 ).format(root=nacl_root) | 48 ).format(root=nacl_root) |
49 rtdir = ( | 49 rtdir = ( |
50 '{root}/toolchain_build/src/subzero/build/runtime' | 50 '{root}/toolchain_build/src/subzero/build/runtime' |
51 ).format(root=nacl_root) | 51 ).format(root=nacl_root) |
52 try: | 52 try: |
53 tempdir = tempfile.mkdtemp() | 53 tempdir = tempfile.mkdtemp() |
54 if os.path.exists(rtdir) and not os.path.isdir(rtdir): | 54 if os.path.exists(rtdir) and not os.path.isdir(rtdir): |
55 os.remove(rtdir) | 55 os.remove(rtdir) |
(...skipping 28 matching lines...) Expand all Loading... |
84 args.verbose) | 84 args.verbose) |
85 finally: | 85 finally: |
86 try: | 86 try: |
87 shutil.rmtree(tempdir) | 87 shutil.rmtree(tempdir) |
88 except OSError as exc: | 88 except OSError as exc: |
89 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory | 89 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory |
90 raise # re-raise exception | 90 raise # re-raise exception |
91 | 91 |
92 if __name__ == '__main__': | 92 if __name__ == '__main__': |
93 main() | 93 main() |
OLD | NEW |