OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Tool for automatically creating .nmf files from .nexe/.pexe/.bc executables. | 6 """Tool for automatically creating .nmf files from .nexe/.pexe/.bc executables. |
7 | 7 |
8 As well as creating the nmf file this tool can also find and stage | 8 As well as creating the nmf file this tool can also find and stage |
9 any shared libraries dependencies that the executables might have. | 9 any shared libraries dependencies that the executables might have. |
10 """ | 10 """ |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 # naclports installed libraries | 521 # naclports installed libraries |
522 'toolchain/%s_x86_glibc/x86_64-nacl/usr/lib' % osname, | 522 'toolchain/%s_x86_glibc/x86_64-nacl/usr/lib' % osname, |
523 'toolchain/%s_x86_glibc/i686-nacl/usr/lib' % osname, | 523 'toolchain/%s_x86_glibc/i686-nacl/usr/lib' % osname, |
524 # SDK bundle libraries | 524 # SDK bundle libraries |
525 'lib/glibc_x86_32/%s' % config, | 525 'lib/glibc_x86_32/%s' % config, |
526 'lib/glibc_x86_64/%s' % config, | 526 'lib/glibc_x86_64/%s' % config, |
527 # naclports bundle libraries | 527 # naclports bundle libraries |
528 'ports/lib/glibc_x86_32/%s' % config, | 528 'ports/lib/glibc_x86_32/%s' % config, |
529 'ports/lib/glibc_x86_64/%s' % config, | 529 'ports/lib/glibc_x86_64/%s' % config, |
530 ] | 530 ] |
531 | |
532 bionic_dir = 'toolchain/%s_arm_bionic' % osname | |
533 if os.path.isdir(os.path.join(sdk_root, bionic_dir)): | |
534 libpath = [ | |
535 '%s/arm-nacl/lib' % bionic_dir, | |
536 '%s/arm-nacl/usr/lib' % bionic_dir, | |
537 'lib/bionic_arm/%s' % config, | |
538 ] + libpath | |
binji
2014/04/07 20:16:56
Wouldn't it be safer to include the bionic search
Sam Clegg
2014/04/07 20:41:35
Done.
| |
531 libpath = [os.path.normpath(p) for p in libpath] | 539 libpath = [os.path.normpath(p) for p in libpath] |
532 libpath = [os.path.join(sdk_root, p) for p in libpath] | 540 libpath = [os.path.join(sdk_root, p) for p in libpath] |
533 return libpath | 541 return libpath |
534 | 542 |
535 | 543 |
536 def main(argv): | 544 def main(argv): |
537 parser = optparse.OptionParser( | 545 parser = optparse.OptionParser( |
538 usage='Usage: %prog [options] nexe [extra_libs...]', description=__doc__) | 546 usage='Usage: %prog [options] nexe [extra_libs...]', description=__doc__) |
539 parser.add_option('-o', '--output', dest='output', | 547 parser.add_option('-o', '--output', dest='output', |
540 help='Write manifest file to FILE (default is stdout)', | 548 help='Write manifest file to FILE (default is stdout)', |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 for libpath in options.lib_path: | 634 for libpath in options.lib_path: |
627 if not os.path.exists(libpath): | 635 if not os.path.exists(libpath): |
628 sys.stderr.write('Specified library path does not exist: %s\n' % libpath) | 636 sys.stderr.write('Specified library path does not exist: %s\n' % libpath) |
629 elif not os.path.isdir(libpath): | 637 elif not os.path.isdir(libpath): |
630 sys.stderr.write('Specified library is not a directory: %s\n' % libpath) | 638 sys.stderr.write('Specified library is not a directory: %s\n' % libpath) |
631 | 639 |
632 if not options.no_default_libpath: | 640 if not options.no_default_libpath: |
633 # Add default libraries paths to the end of the search path. | 641 # Add default libraries paths to the end of the search path. |
634 config = options.debug_libs and 'Debug' or 'Release' | 642 config = options.debug_libs and 'Debug' or 'Release' |
635 options.lib_path += GetDefaultLibPath(config) | 643 options.lib_path += GetDefaultLibPath(config) |
644 for path in options.lib_path: | |
645 Trace('libpath: %s' % path) | |
636 | 646 |
637 pnacl_optlevel = None | 647 pnacl_optlevel = None |
638 if options.pnacl_optlevel is not None: | 648 if options.pnacl_optlevel is not None: |
639 pnacl_optlevel = int(options.pnacl_optlevel) | 649 pnacl_optlevel = int(options.pnacl_optlevel) |
640 if pnacl_optlevel < 0 or pnacl_optlevel > 3: | 650 if pnacl_optlevel < 0 or pnacl_optlevel > 3: |
641 sys.stderr.write( | 651 sys.stderr.write( |
642 'warning: PNaCl optlevel %d is unsupported (< 0 or > 3)\n' % | 652 'warning: PNaCl optlevel %d is unsupported (< 0 or > 3)\n' % |
643 pnacl_optlevel) | 653 pnacl_optlevel) |
644 if options.pnacl_debug_optlevel is not None: | 654 if options.pnacl_debug_optlevel is not None: |
645 pnacl_debug_optlevel = int(options.pnacl_debug_optlevel) | 655 pnacl_debug_optlevel = int(options.pnacl_debug_optlevel) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 if __name__ == '__main__': | 688 if __name__ == '__main__': |
679 try: | 689 try: |
680 rtn = main(sys.argv[1:]) | 690 rtn = main(sys.argv[1:]) |
681 except Error, e: | 691 except Error, e: |
682 sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e)) | 692 sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e)) |
683 rtn = 1 | 693 rtn = 1 |
684 except KeyboardInterrupt: | 694 except KeyboardInterrupt: |
685 sys.stderr.write('%s: interrupted\n' % os.path.basename(__file__)) | 695 sys.stderr.write('%s: interrupted\n' % os.path.basename(__file__)) |
686 rtn = 1 | 696 rtn = 1 |
687 sys.exit(rtn) | 697 sys.exit(rtn) |
OLD | NEW |