Index: pydir/build-pnacl-ir.py |
diff --git a/pydir/build-pnacl-ir.py b/pydir/build-pnacl-ir.py |
index 9395fc7f5777a5dfc25aabcc5e750efce3f30b08..89273f895874fadccfb6864b15ab02da48aae0d6 100755 |
--- a/pydir/build-pnacl-ir.py |
+++ b/pydir/build-pnacl-ir.py |
@@ -2,7 +2,6 @@ |
import argparse |
import os |
-import sys |
import tempfile |
from utils import shellcmd |
@@ -10,27 +9,19 @@ if __name__ == '__main__': |
argparser = argparse.ArgumentParser() |
argparser.add_argument('cfile', nargs='+', type=str, |
help='C file(s) to convert') |
- argparser.add_argument('--nacl_sdk_root', nargs='?', type=str, |
- help='Path to NACL_SDK_ROOT') |
argparser.add_argument('--dir', nargs='?', type=str, default='.', |
help='Output directory') |
argparser.add_argument('--disable-verify', action='store_true') |
args = argparser.parse_args() |
- nacl_sdk_root = os.environ.get('NACL_SDK_ROOT', None) |
- if args.nacl_sdk_root: |
- nacl_sdk_root = os.path.expanduser(args.nacl_sdk_root) |
- |
- if not nacl_sdk_root or not os.path.exists(nacl_sdk_root): |
- print '''\ |
-Please set the NACL_SDK_ROOT environment variable or pass the path through |
---nacl_sdk_root to point to a valid Native Client SDK installation.''' |
- sys.exit(1) |
- |
- includes_path = os.path.join(nacl_sdk_root, 'include') |
- toolchain_path = os.path.join(nacl_sdk_root, 'toolchain', 'linux_pnacl') |
- clang_path = os.path.join(toolchain_path, 'bin64', 'pnacl-clang') |
- opt_path = os.path.join(toolchain_path, 'host_x86_64', 'bin', 'opt') |
+ # TODO(stichnot): Find a better way of getting to the top-level |
+ # native_client directory. |
+ nacl_root = '../../../..' |
+ # Prepend bin and host_x86_32/bin to $PATH. |
+ os.environ['PATH'] = \ |
+ nacl_root + '/toolchain/linux_x86/pnacl_newlib/bin' + os.pathsep + \ |
+ nacl_root + '/toolchain/linux_x86/pnacl_newlib/host_x86_32/bin' + \ |
+ os.pathsep + os.environ['PATH'] |
tempdir = tempfile.mkdtemp() |
@@ -40,10 +31,8 @@ Please set the NACL_SDK_ROOT environment variable or pass the path through |
pnaclname = basename + '.pnacl.ll' |
pnaclname = os.path.join(args.dir, pnaclname) |
- shellcmd(clang_path + ' -O2 -I{0} -c {1} -o {2}'.format( |
- includes_path, cname, llname)) |
- shellcmd(opt_path + |
- ' -pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' + |
+ shellcmd('pnacl-clang -O2 -c {0} -o {1}'.format(cname, llname)) |
+ shellcmd('opt -pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' + |
jvoung (off chromium)
2014/09/02 16:59:47
You might be able to just invoke 'pnacl-opt' and
Jim Stichnoth
2014/09/02 18:30:34
Good point, done. FWIW, crosstest.py was already
|
('' if args.disable_verify else |
' -verify-pnaclabi-module -verify-pnaclabi-functions') + |
' -pnaclabi-allow-debug-metadata -disable-simplify-libcalls' |