OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client 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 """Recipes for NativeClient toolchain packages. | 6 """Recipes for NativeClient toolchain packages. |
7 | 7 |
8 The real entry plumbing is in toolchain_main.py. | 8 The real entry plumbing is in toolchain_main.py. |
9 """ | 9 """ |
10 | 10 |
11 import fnmatch | 11 import fnmatch |
12 import platform | 12 import platform |
13 import os | 13 import os |
14 import re | 14 import re |
15 import sys | 15 import sys |
16 | 16 |
17 import command | 17 import command |
18 import toolchain_main | 18 import toolchain_main |
19 | 19 |
20 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 20 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
21 NACL_DIR = os.path.dirname(SCRIPT_DIR) | 21 NACL_DIR = os.path.dirname(SCRIPT_DIR) |
22 | 22 |
23 GIT_REVISIONS = { | 23 GIT_REVISIONS = { |
24 'binutils': '38dbda270a4248ab5b7facc012b9c8d8527f6fb2', | 24 'binutils': '38dbda270a4248ab5b7facc012b9c8d8527f6fb2', |
25 'gcc': '145a627d95b98f54915d037dddbcbb0f7b283494', | 25 'gcc': '145a627d95b98f54915d037dddbcbb0f7b283494', |
26 'newlib': '9f95ad0b4875d153b9d138090e61ac4c24e9a87d', | 26 'newlib': 'cc9ce45891a45ecfbc671f4a6f1b06ba60a55ad9', |
27 } | 27 } |
28 | 28 |
29 TAR_FILES = { | 29 TAR_FILES = { |
30 'gmp': command.path.join('gmp', 'gmp-5.1.3.tar.bz2'), | 30 'gmp': command.path.join('gmp', 'gmp-5.1.3.tar.bz2'), |
31 'mpfr': command.path.join('mpfr', 'mpfr-3.1.2.tar.bz2'), | 31 'mpfr': command.path.join('mpfr', 'mpfr-3.1.2.tar.bz2'), |
32 'mpc': command.path.join('mpc', 'mpc-1.0.2.tar.gz'), | 32 'mpc': command.path.join('mpc', 'mpc-1.0.2.tar.gz'), |
33 'isl': command.path.join('cloog', 'isl-0.12.1.tar.bz2'), | 33 'isl': command.path.join('cloog', 'isl-0.12.1.tar.bz2'), |
34 'cloog': command.path.join('cloog', 'cloog-0.18.1.tar.gz'), | 34 'cloog': command.path.join('cloog', 'cloog-0.18.1.tar.gz'), |
35 } | 35 } |
36 | 36 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 608 |
609 # configure defaults to -g -O2 but passing an explicit option overrides that. | 609 # configure defaults to -g -O2 but passing an explicit option overrides that. |
610 # So we have to list -g -O2 explicitly since we need to add -mtp=soft. | 610 # So we have to list -g -O2 explicitly since we need to add -mtp=soft. |
611 def CommonTargetCflags(target): | 611 def CommonTargetCflags(target): |
612 options = ['-g', '-O2'] | 612 options = ['-g', '-O2'] |
613 if target == 'arm': | 613 if target == 'arm': |
614 options.append('-mtp=soft') | 614 options.append('-mtp=soft') |
615 return options | 615 return options |
616 | 616 |
617 | 617 |
618 def NewlibTargetCflags(target): | |
619 options = CommonTargetCflags(target) + [ | |
620 '-D_I386MACH_ALLOW_HW_INTERRUPTS', | |
621 ] | |
622 return ' '.join(options) | |
623 | |
624 | |
625 def TargetCommands(host, target, command_list): | 618 def TargetCommands(host, target, command_list): |
626 # First we have to copy the host tools into a common directory. | 619 # First we have to copy the host tools into a common directory. |
627 # We can't just have both directories in our PATH, because the | 620 # We can't just have both directories in our PATH, because the |
628 # compiler looks for the assembler and linker relative to itself. | 621 # compiler looks for the assembler and linker relative to itself. |
629 commands = PopulateDeps(['%(' + ForHost('binutils_' + target, host) + ')s', | 622 commands = PopulateDeps(['%(' + ForHost('binutils_' + target, host) + ')s', |
630 '%(' + ForHost('gcc_' + target, host) + ')s']) | 623 '%(' + ForHost('gcc_' + target, host) + ')s']) |
631 bindir = command.path.join('%(cwd)s', 'all_deps', 'bin') | 624 bindir = command.path.join('%(cwd)s', 'all_deps', 'bin') |
632 commands += [command.Command(cmd, path_dirs=[bindir]) | 625 commands += [command.Command(cmd, path_dirs=[bindir]) |
633 for cmd in command_list] | 626 for cmd in command_list] |
634 return commands | 627 return commands |
(...skipping 18 matching lines...) Expand all Loading... |
653 newlib_configure_args = [ | 646 newlib_configure_args = [ |
654 '--disable-libgloss', | 647 '--disable-libgloss', |
655 '--enable-newlib-iconv', | 648 '--enable-newlib-iconv', |
656 '--enable-newlib-iconv-from-encodings=' + iconv_encodings, | 649 '--enable-newlib-iconv-from-encodings=' + iconv_encodings, |
657 '--enable-newlib-iconv-to-encodings=' + iconv_encodings, | 650 '--enable-newlib-iconv-to-encodings=' + iconv_encodings, |
658 '--enable-newlib-io-long-long', | 651 '--enable-newlib-io-long-long', |
659 '--enable-newlib-io-long-double', | 652 '--enable-newlib-io-long-double', |
660 '--enable-newlib-io-c99-formats', | 653 '--enable-newlib-io-c99-formats', |
661 '--enable-newlib-mb', | 654 '--enable-newlib-mb', |
662 'CFLAGS=-O2', | 655 'CFLAGS=-O2', |
663 'CFLAGS_FOR_TARGET=' + NewlibTargetCflags(target), | 656 'CFLAGS_FOR_TARGET=' + ' '.join(CommonTargetCflags(target)), |
664 'INSTALL_DATA=' + newlib_install_data, | 657 'INSTALL_DATA=' + newlib_install_data, |
665 ] | 658 ] |
666 | 659 |
667 newlib_post_install = [ | 660 newlib_post_install = [ |
668 command.Rename(NewlibFile('lib', 'libc.a'), | 661 command.Rename(NewlibFile('lib', 'libc.a'), |
669 NewlibFile('lib', 'libcrt_common.a')), | 662 NewlibFile('lib', 'libcrt_common.a')), |
670 command.WriteData(NewlibLibcScript(target), | 663 command.WriteData(NewlibLibcScript(target), |
671 NewlibFile('lib', 'libc.a')), | 664 NewlibFile('lib', 'libc.a')), |
672 ] + [ | 665 ] + [ |
673 command.Copy( | 666 command.Copy( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 778 |
786 | 779 |
787 PACKAGES = CollectPackages(TARGET_LIST) | 780 PACKAGES = CollectPackages(TARGET_LIST) |
788 | 781 |
789 | 782 |
790 if __name__ == '__main__': | 783 if __name__ == '__main__': |
791 tb = toolchain_main.PackageBuilder(PACKAGES, sys.argv[1:]) | 784 tb = toolchain_main.PackageBuilder(PACKAGES, sys.argv[1:]) |
792 # TODO(mcgrathr): The bot ought to run some native_client tests | 785 # TODO(mcgrathr): The bot ought to run some native_client tests |
793 # using the new toolchain, like the old x86 toolchain bots do. | 786 # using the new toolchain, like the old x86 toolchain bots do. |
794 tb.Main() | 787 tb.Main() |
OLD | NEW |