Chromium Code Reviews| 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 |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 } | 613 } |
| 614 return host_gcc_libs | 614 return host_gcc_libs |
| 615 | 615 |
| 616 | 616 |
| 617 HOST_GCC_LIBS_DEPS = ['gmp', 'mpfr', 'mpc', 'isl', 'cloog'] | 617 HOST_GCC_LIBS_DEPS = ['gmp', 'mpfr', 'mpc', 'isl', 'cloog'] |
| 618 | 618 |
| 619 def HostGccLibsDeps(host): | 619 def HostGccLibsDeps(host): |
| 620 return [ForHost(package, host) for package in HOST_GCC_LIBS_DEPS] | 620 return [ForHost(package, host) for package in HOST_GCC_LIBS_DEPS] |
| 621 | 621 |
| 622 | 622 |
| 623 def SDKLibs(host, target): | 623 def SDKLibs(host, target, libc): |
| 624 def H(component_name): | 624 def H(component_name): |
| 625 return ForHost(component_name, host) | 625 return ForHost(component_name, host) |
| 626 components = ['newlib_%s' % target, | 626 |
| 627 'gcc_libs_%s' % target, | 627 if libc == 'newlib': |
| 628 H('binutils_%s' % target), | 628 libs_name = 'libs' |
| 629 H('gcc_%s' % target), | 629 else: |
| 630 ] | 630 libs_name = 'libs_' + libc |
| 631 sdk_compiler = { | 631 |
| 632 H('sdk_compiler_%s' % target): { | 632 host_components = [H('binutils_%s' % target), H('gcc_%s' % target)] |
| 633 target_components = [libc + '_' + target, 'gcc_' + libs_name + '_' + target] | |
| 634 components = host_components + target_components | |
| 635 | |
| 636 sdk_compiler = H('sdk_compiler_' + libc + '_' + target) | |
| 637 | |
| 638 builds = { | |
| 639 sdk_compiler: { | |
| 633 'type': 'work', | 640 'type': 'work', |
| 634 'dependencies': components, | 641 'dependencies': components, |
| 635 'commands': [command.CopyRecursive('%(' + item + ')s', '%(output)s') | 642 'commands': [command.CopyRecursive('%(' + item + ')s', '%(output)s') |
| 636 for item in components], | 643 for item in components], |
| 637 }, | 644 }, |
| 638 } | 645 |
| 639 sdk_libs = { | 646 'sdk_' + libs_name + '_' + target: { |
| 640 'sdk_libs_%s' % target: { | |
| 641 'type': 'build', | 647 'type': 'build', |
| 642 'dependencies': [H('sdk_compiler_%s' % target)], | 648 'dependencies': [sdk_compiler], |
| 643 'inputs': { | 649 'inputs': { |
| 644 'src_untrusted': os.path.join(NACL_DIR, 'src', 'untrusted'), | 650 'src_untrusted': os.path.join(NACL_DIR, 'src', 'untrusted'), |
| 645 'src_include': os.path.join(NACL_DIR, 'src', 'include'), | 651 'src_include': os.path.join(NACL_DIR, 'src', 'include'), |
| 646 'scons.py': os.path.join(NACL_DIR, 'scons.py'), | 652 'scons.py': os.path.join(NACL_DIR, 'scons.py'), |
| 647 'site_scons': os.path.join(NACL_DIR, 'site_scons'), | 653 'site_scons': os.path.join(NACL_DIR, 'site_scons'), |
| 648 }, | 654 }, |
| 649 'commands': [ | 655 'commands': [ |
| 650 command.Command( | 656 command.Command( |
| 651 [sys.executable, '%(scons.py)s', | 657 [sys.executable, '%(scons.py)s', |
| 652 '--verbose', 'MODE=nacl', '-j%(cores)s', 'naclsdk_validate=0', | 658 '--verbose', '--mode=nacl', '-j%(cores)s', 'naclsdk_validate=0', |
| 653 'platform=%s' % target, | 659 'platform=%s' % target, |
| 654 'nacl_newlib_dir=%(abs_' + H('sdk_compiler_%s' % target) + ')s', | 660 'nacl_' + libc + '_dir=%(abs_' + sdk_compiler + ')s', |
| 655 'DESTINATION_ROOT=%(work_dir)s', | 661 'DESTINATION_ROOT=%(work_dir)s', |
| 656 'includedir=' + command.path.join('%(output)s', | 662 'includedir=' + command.path.join('%(output)s', |
| 657 target + '-nacl', 'include'), | 663 target + '-nacl', 'include'), |
| 658 'libdir=' + command.path.join('%(output)s', | 664 'libdir=' + command.path.join('%(output)s', |
| 659 target + '-nacl', 'lib'), | 665 target + '-nacl', 'lib'), |
| 660 'install'], | 666 'install'], |
| 661 cwd=NACL_DIR), | 667 cwd=NACL_DIR), |
| 662 ], | 668 ], |
| 663 }, | 669 }, |
| 664 } | 670 } |
| 665 | 671 |
| 666 return dict(sdk_compiler.items() + sdk_libs.items()) | 672 return builds |
| 667 | 673 |
| 668 | 674 |
| 669 def ConfigureCommand(source_component): | 675 def ConfigureCommand(source_component): |
| 670 return [command % {'src': '%(' + source_component + ')s'} | 676 return [command % {'src': '%(' + source_component + ')s'} |
| 671 for command in CONFIGURE_CMD] | 677 for command in CONFIGURE_CMD] |
| 672 | 678 |
| 673 | 679 |
| 674 # When doing a Canadian cross, we need native-hosted cross components | 680 # When doing a Canadian cross, we need native-hosted cross components |
| 675 # to do the GCC build. | 681 # to do the GCC build. |
| 676 def GccDeps(host, target): | 682 def GccDeps(host, target): |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 695 ConfigureCommand(source_component) + | 701 ConfigureCommand(source_component) + |
| 696 ConfigureHostTool(host) + | 702 ConfigureHostTool(host) + |
| 697 ConfigureTargetArgs(target) + | 703 ConfigureTargetArgs(target) + |
| 698 TARGET_GCC_CONFIG.get(target, []) + [ | 704 TARGET_GCC_CONFIG.get(target, []) + [ |
| 699 '--with-gmp=%(abs_' + ForHost('gmp', host) + ')s', | 705 '--with-gmp=%(abs_' + ForHost('gmp', host) + ')s', |
| 700 '--with-mpfr=%(abs_' + ForHost('mpfr', host) + ')s', | 706 '--with-mpfr=%(abs_' + ForHost('mpfr', host) + ')s', |
| 701 '--with-mpc=%(abs_' + ForHost('mpc', host) + ')s', | 707 '--with-mpc=%(abs_' + ForHost('mpc', host) + ')s', |
| 702 '--with-isl=%(abs_' + ForHost('isl', host) + ')s', | 708 '--with-isl=%(abs_' + ForHost('isl', host) + ')s', |
| 703 '--with-cloog=%(abs_' + ForHost('cloog', host) + ')s', | 709 '--with-cloog=%(abs_' + ForHost('cloog', host) + ')s', |
| 704 '--enable-cloog-backend=isl', | 710 '--enable-cloog-backend=isl', |
| 705 '--disable-dlopen', | |
| 706 '--disable-shared', | |
| 707 '--with-newlib', | |
| 708 '--with-linker-hash-style=gnu', | 711 '--with-linker-hash-style=gnu', |
| 709 '--enable-linker-build-id', | 712 '--enable-linker-build-id', |
| 710 '--enable-languages=c,c++,lto', | 713 '--enable-languages=c,c++,lto', |
| 711 ] + extra_args) | 714 ] + extra_args) |
| 712 | 715 |
| 713 | 716 |
| 717 GCC_NEWLIB = [ | |
|
Derek Schuff
2015/04/23 19:48:09
how about calling this GCC_NEWLIB_CONFIGURE or or
| |
| 718 '--disable-dlopen', | |
| 719 '--disable-shared', | |
| 720 '--with-newlib', | |
| 721 ] | |
| 722 | |
| 714 | 723 |
| 715 def HostTools(host, target): | 724 def HostTools(host, target): |
| 716 def H(component_name): | 725 def H(component_name): |
| 717 return ForHost(component_name, host) | 726 return ForHost(component_name, host) |
| 718 | 727 |
| 719 def WindowsAlternate(if_windows, if_not_windows, if_mac=None): | 728 def WindowsAlternate(if_windows, if_not_windows, if_mac=None): |
| 720 if if_mac is not None and HostIsMac(host): | 729 if if_mac is not None and HostIsMac(host): |
| 721 return if_mac | 730 return if_mac |
| 722 elif HostIsWindows(host): | 731 elif HostIsWindows(host): |
| 723 return if_windows | 732 return if_windows |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 # that we don't want to include in the distribution. | 783 # that we don't want to include in the distribution. |
| 775 [command.RemoveDirectory(command.path.join('%(output)s', name)) | 784 [command.RemoveDirectory(command.path.join('%(output)s', name)) |
| 776 for name in ['lib', 'lib32', 'lib64']], | 785 for name in ['lib', 'lib32', 'lib64']], |
| 777 }, | 786 }, |
| 778 | 787 |
| 779 H('gcc_' + target): { | 788 H('gcc_' + target): { |
| 780 'type': 'build', | 789 'type': 'build', |
| 781 'dependencies': (['gcc'] + HostGccLibsDeps(host) + | 790 'dependencies': (['gcc'] + HostGccLibsDeps(host) + |
| 782 GccDeps(host, target)), | 791 GccDeps(host, target)), |
| 783 'commands': ConfigureTargetPrep(target) + [ | 792 'commands': ConfigureTargetPrep(target) + [ |
| 784 ConfigureGccCommand('gcc', host, target), | 793 ConfigureGccCommand('gcc', host, target, GCC_NEWLIB), |
| 785 # GCC's configure step writes configargs.h with some strings | 794 # GCC's configure step writes configargs.h with some strings |
| 786 # including the configure command line, which get embedded | 795 # including the configure command line, which get embedded |
| 787 # into the gcc driver binary. The build only works if we use | 796 # into the gcc driver binary. The build only works if we use |
| 788 # absolute paths in some of the configure switches, but | 797 # absolute paths in some of the configure switches, but |
| 789 # embedding those paths makes the output differ in repeated | 798 # embedding those paths makes the output differ in repeated |
| 790 # builds done in different directories, which we do not want. | 799 # builds done in different directories, which we do not want. |
| 791 # So force the generation of that file early and then edit it | 800 # So force the generation of that file early and then edit it |
| 792 # in place to replace the absolute paths with something that | 801 # in place to replace the absolute paths with something that |
| 793 # never varies. Note that the 'configure-gcc' target will | 802 # never varies. Note that the 'configure-gcc' target will |
| 794 # actually build some components before running gcc/configure. | 803 # actually build some components before running gcc/configure. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 return commands | 898 return commands |
| 890 | 899 |
| 891 | 900 |
| 892 def TargetLibs(host, target): | 901 def TargetLibs(host, target): |
| 893 lib_deps = [ForHost(component + '_' + target, host) | 902 lib_deps = [ForHost(component + '_' + target, host) |
| 894 for component in ['binutils', 'gcc']] | 903 for component in ['binutils', 'gcc']] |
| 895 | 904 |
| 896 def NewlibFile(subdir, name): | 905 def NewlibFile(subdir, name): |
| 897 return command.path.join('%(output)s', target + '-nacl', subdir, name) | 906 return command.path.join('%(output)s', target + '-nacl', subdir, name) |
| 898 | 907 |
| 899 newlib_sysroot = '%(abs_newlib_' + target + ')s' | |
| 900 newlib_tooldir = '%s/%s-nacl' % (newlib_sysroot, target) | |
| 901 | |
| 902 # See the comment at ConfigureTargetPrep, above. | 908 # See the comment at ConfigureTargetPrep, above. |
| 903 newlib_install_data = ' '.join(['STRIPPROG=%(cwd)s/strip_for_target', | 909 newlib_install_data = ' '.join(['STRIPPROG=%(cwd)s/strip_for_target', |
| 904 '%(abs_newlib)s/install-sh', | 910 '%(abs_newlib)s/install-sh', |
| 905 '-c', '-s', '-m', '644']) | 911 '-c', '-s', '-m', '644']) |
| 906 | 912 |
| 907 iconv_encodings = 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4' | 913 iconv_encodings = 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4' |
| 908 newlib_configure_args = [ | 914 newlib_configure_args = [ |
| 909 '--disable-libgloss', | 915 '--disable-libgloss', |
| 910 '--enable-newlib-iconv', | 916 '--enable-newlib-iconv', |
| 911 '--enable-newlib-iconv-from-encodings=' + iconv_encodings, | 917 '--enable-newlib-iconv-from-encodings=' + iconv_encodings, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 923 NewlibFile('lib', 'libcrt_common.a')), | 929 NewlibFile('lib', 'libcrt_common.a')), |
| 924 command.WriteData(NewlibLibcScript(target), | 930 command.WriteData(NewlibLibcScript(target), |
| 925 NewlibFile('lib', 'libc.a')), | 931 NewlibFile('lib', 'libc.a')), |
| 926 ] + [ | 932 ] + [ |
| 927 command.Copy( | 933 command.Copy( |
| 928 command.path.join('%(pthread_headers)s', header), | 934 command.path.join('%(pthread_headers)s', header), |
| 929 NewlibFile('include', header)) | 935 NewlibFile('include', header)) |
| 930 for header in ('pthread.h', 'semaphore.h') | 936 for header in ('pthread.h', 'semaphore.h') |
| 931 ] | 937 ] |
| 932 | 938 |
| 939 | |
| 940 def GccLibsTarget(libc, configure_args): | |
| 941 sysroot = '%(abs_' + libc + '_' + target + ')s' | |
| 942 tooldir = '%s/%s-nacl' % (sysroot, target) | |
| 943 package = { | |
| 944 'type': 'build', | |
| 945 'dependencies': (['gcc_libs'] + lib_deps + [libc + '_' + target] + | |
| 946 HostGccLibsDeps(host)), | |
| 947 # This actually builds the compiler again and uses that compiler | |
| 948 # to build the target libraries. That's by far the easiest thing | |
| 949 # to get going given the interdependencies of the target | |
| 950 # libraries (especially libgcc) on the gcc subdirectory, and | |
| 951 # building the compiler doesn't really take all that long in the | |
| 952 # grand scheme of things. | |
| 953 # TODO(mcgrathr): If upstream ever cleans up all their | |
| 954 # interdependencies better, unpack the compiler, configure with | |
| 955 # --disable-gcc, and just build all-target. | |
| 956 'commands': ConfigureTargetPrep(target) + [ | |
| 957 ConfigureGccCommand('gcc_libs', host, target, configure_args + [ | |
| 958 '--with-build-sysroot=' + tooldir, | |
| 959 ]), | |
| 960 GccCommand(host, target, | |
| 961 MakeCommand(host) + [ | |
| 962 'build_tooldir=' + tooldir, | |
| 963 'MAKEOVERRIDES=NATIVE_SYSTEM_HEADER_DIR=/include', | |
| 964 'all-target', | |
| 965 ]), | |
| 966 GccCommand(host, target, | |
| 967 MAKE_DESTDIR_CMD + ['install-strip-target']), | |
| 968 REMOVE_INFO_DIR, | |
| 969 ], | |
| 970 } | |
| 971 return package | |
| 972 | |
| 933 # The 'minisdk_<target>' component is a workalike subset of what the full | 973 # The 'minisdk_<target>' component is a workalike subset of what the full |
| 934 # NaCl SDK provides. The glibc build uses a handful of things from the | 974 # NaCl SDK provides. The glibc build uses a handful of things from the |
| 935 # SDK (ncval, sel_ldr, etc.), and expects them relative to $NACL_SDK_ROOT | 975 # SDK (ncval, sel_ldr, etc.), and expects them relative to $NACL_SDK_ROOT |
| 936 # in the layout that the SDK uses. We provide a small subset built here | 976 # in the layout that the SDK uses. We provide a small subset built here |
| 937 # using SCons (and explicit copying, below), containing only the things | 977 # using SCons (and explicit copying, below), containing only the things |
| 938 # the build actually needs. | 978 # the build actually needs. |
| 939 def SconsCommand(args): | 979 def SconsCommand(args): |
| 940 return command.Command([sys.executable, '%(scons.py)s', | 980 return command.Command([sys.executable, '%(scons.py)s', |
| 941 '--verbose', '-j%(cores)s', | 981 '--verbose', '-j%(cores)s', |
| 942 'DESTINATION_ROOT=%(abs_work_dir)s'] + args, | 982 'DESTINATION_ROOT=%(abs_work_dir)s'] + args, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 ConfigureHostTool(host) + | 1064 ConfigureHostTool(host) + |
| 1025 ConfigureTargetArgs(target) + | 1065 ConfigureTargetArgs(target) + |
| 1026 newlib_configure_args, | 1066 newlib_configure_args, |
| 1027 MakeCommand(host), | 1067 MakeCommand(host), |
| 1028 MAKE_DESTDIR_CMD + ['install-strip'], | 1068 MAKE_DESTDIR_CMD + ['install-strip'], |
| 1029 ]) + | 1069 ]) + |
| 1030 newlib_post_install + | 1070 newlib_post_install + |
| 1031 InstallDocFiles('newlib', ['COPYING.NEWLIB'])), | 1071 InstallDocFiles('newlib', ['COPYING.NEWLIB'])), |
| 1032 }, | 1072 }, |
| 1033 | 1073 |
| 1074 'gcc_libs_' + target: GccLibsTarget('newlib', GCC_NEWLIB), | |
| 1075 | |
| 1034 'glibc_' + target: { | 1076 'glibc_' + target: { |
| 1035 'type': 'build', | 1077 'type': 'build', |
| 1036 # The glibc build needs a libgcc.a (and the unwind.h header). | 1078 # The glibc build needs a libgcc.a (and the unwind.h header). |
| 1037 # For now, we just use the one built for the newlib toolchain | 1079 # For now, we just use the one built for the newlib toolchain |
| 1038 # and that seems to suffice. | 1080 # and that seems to suffice. |
| 1039 # TODO(mcgrathr): Eventually figure out a proper minimal build | 1081 # TODO(mcgrathr): Eventually figure out a proper minimal build |
| 1040 # of just the libgcc bits needed for the glibc build. | 1082 # of just the libgcc bits needed for the glibc build. |
| 1041 'dependencies': ['glibc', 'minisdk_' + target, | 1083 'dependencies': ['glibc', 'minisdk_' + target, |
| 1042 'gcc_libs_' + target] + lib_deps, | 1084 'gcc_libs_' + target] + lib_deps, |
| 1043 'commands': (ConfigureTargetPrep(target) + | 1085 'commands': (ConfigureTargetPrep(target) + |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1061 'install_root=%(abs_output)s/' + target + '-nacl', | 1103 'install_root=%(abs_output)s/' + target + '-nacl', |
| 1062 'inst_infodir=%(abs_output)s/share/info', | 1104 'inst_infodir=%(abs_output)s/share/info', |
| 1063 ], | 1105 ], |
| 1064 ], target_deps=['gcc_libs']) + | 1106 ], target_deps=['gcc_libs']) + |
| 1065 InstallDocFiles('glibc', ['COPYING.LIB']) + [ | 1107 InstallDocFiles('glibc', ['COPYING.LIB']) + [ |
| 1066 REMOVE_INFO_DIR, | 1108 REMOVE_INFO_DIR, |
| 1067 ] | 1109 ] |
| 1068 ), | 1110 ), |
| 1069 }, | 1111 }, |
| 1070 | 1112 |
| 1071 'gcc_libs_' + target: { | 1113 'gcc_libs_glibc_' + target: GccLibsTarget('glibc', []), |
| 1072 'type': 'build', | |
| 1073 'dependencies': (['gcc_libs'] + lib_deps + ['newlib_' + target] + | |
| 1074 HostGccLibsDeps(host)), | |
| 1075 # This actually builds the compiler again and uses that compiler | |
| 1076 # to build the target libraries. That's by far the easiest thing | |
| 1077 # to get going given the interdependencies of the target | |
| 1078 # libraries (especially libgcc) on the gcc subdirectory, and | |
| 1079 # building the compiler doesn't really take all that long in the | |
| 1080 # grand scheme of things. | |
| 1081 # TODO(mcgrathr): If upstream ever cleans up all their | |
| 1082 # interdependencies better, unpack the compiler, configure with | |
| 1083 # --disable-gcc, and just build all-target. | |
| 1084 'commands': ConfigureTargetPrep(target) + [ | |
| 1085 ConfigureGccCommand('gcc_libs', host, target, [ | |
| 1086 '--with-build-sysroot=' + newlib_sysroot, | |
| 1087 ]), | |
| 1088 GccCommand(host, target, | |
| 1089 MakeCommand(host) + [ | |
| 1090 'build_tooldir=' + newlib_tooldir, | |
| 1091 'all-target', | |
| 1092 ]), | |
| 1093 GccCommand(host, target, | |
| 1094 MAKE_DESTDIR_CMD + ['install-strip-target']), | |
| 1095 REMOVE_INFO_DIR, | |
| 1096 ], | |
| 1097 }, | |
| 1098 } | 1114 } |
| 1099 | 1115 |
| 1100 libs.update(support) | 1116 libs.update(support) |
| 1101 return libs | 1117 return libs |
| 1102 | 1118 |
| 1103 # Compute it once. | 1119 # Compute it once. |
| 1104 NATIVE_TUPLE = pynacl.platform.PlatformTriple() | 1120 NATIVE_TUPLE = pynacl.platform.PlatformTriple() |
| 1105 | 1121 |
| 1106 | 1122 |
| 1107 # For our purposes, "cross-compiling" means not literally that we are | 1123 # For our purposes, "cross-compiling" means not literally that we are |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1161 host_target.arch) | 1177 host_target.arch) |
| 1162 binutils_package = ForHost('binutils_%s' % target_arch, platform_triple) | 1178 binutils_package = ForHost('binutils_%s' % target_arch, platform_triple) |
| 1163 gcc_package = ForHost('gcc_%s' % target_arch, platform_triple) | 1179 gcc_package = ForHost('gcc_%s' % target_arch, platform_triple) |
| 1164 gdb_package = ForHost('gdb', platform_triple) | 1180 gdb_package = ForHost('gdb', platform_triple) |
| 1165 | 1181 |
| 1166 # Create a list of packages for a target. | 1182 # Create a list of packages for a target. |
| 1167 platform_packages = [binutils_package, gcc_package, gdb_package] | 1183 platform_packages = [binutils_package, gcc_package, gdb_package] |
| 1168 raw_packages = shared_packages + platform_packages | 1184 raw_packages = shared_packages + platform_packages |
| 1169 all_packages = raw_packages + sdk_lib_packages | 1185 all_packages = raw_packages + sdk_lib_packages |
| 1170 | 1186 |
| 1171 glibc_packages = platform_packages + ['glibc_' + target_arch] | 1187 glibc_raw_packages = platform_packages + ['glibc_' + target_arch] |
| 1188 glibc_all_packages = glibc_raw_packages + ['sdk_libs_glibc_' + | |
| 1189 target_arch] | |
| 1172 | 1190 |
| 1173 os_name = pynacl.platform.GetOS(host_target.os) | 1191 os_name = pynacl.platform.GetOS(host_target.os) |
| 1174 if host_target.differ3264: | 1192 if host_target.differ3264: |
| 1175 arch_name = pynacl.platform.GetArch3264(host_target.arch) | 1193 arch_name = pynacl.platform.GetArch3264(host_target.arch) |
| 1176 else: | 1194 else: |
| 1177 arch_name = pynacl.platform.GetArch(host_target.arch) | 1195 arch_name = pynacl.platform.GetArch(host_target.arch) |
| 1178 package_target = '%s_%s' % (os_name, arch_name) | 1196 package_target = '%s_%s' % (os_name, arch_name) |
| 1179 package_name = '%snacl_%s_newlib' % (package_prefix, | 1197 package_name = '%snacl_%s_newlib' % (package_prefix, |
| 1180 pynacl.platform.GetArch(target_arch)) | 1198 pynacl.platform.GetArch(target_arch)) |
| 1181 raw_package_name = package_name + '_raw' | 1199 raw_package_name = package_name + '_raw' |
| 1182 | 1200 |
| 1183 # Toolchains by default are "raw" unless they include the Core SDK | 1201 # Toolchains by default are "raw" unless they include the Core SDK |
| 1184 package_target_dict = package_targets.setdefault(package_target, {}) | 1202 package_target_dict = package_targets.setdefault(package_target, {}) |
| 1185 package_target_dict.setdefault(raw_package_name, []).extend(raw_packages) | 1203 package_target_dict.setdefault(raw_package_name, []).extend(raw_packages) |
| 1186 package_target_dict.setdefault(package_name, []).extend(all_packages) | 1204 package_target_dict.setdefault(package_name, []).extend(all_packages) |
| 1187 | 1205 |
| 1188 glibc_package_name = (package_prefix + | 1206 glibc_package_name = (package_prefix + |
| 1189 ('nacl_%s_glibc' % | 1207 ('nacl_%s_glibc' % |
| 1190 pynacl.platform.GetArch(target_arch))) | 1208 pynacl.platform.GetArch(target_arch))) |
| 1191 glibc_raw_package_name = glibc_package_name + '_raw' | 1209 glibc_raw_package_name = glibc_package_name + '_raw' |
| 1192 package_target_dict.setdefault(glibc_raw_package_name, | 1210 package_target_dict.setdefault(glibc_raw_package_name, |
| 1193 []).extend(glibc_packages) | 1211 []).extend(glibc_raw_packages) |
| 1212 package_target_dict.setdefault(glibc_package_name, | |
| 1213 []).extend(glibc_all_packages) | |
| 1194 | 1214 |
| 1195 # GDB is a special and shared, we will inject it into various other packages. | 1215 # GDB is a special and shared, we will inject it into various other packages. |
| 1196 for platform, arch in GDB_INJECT_HOSTS: | 1216 for platform, arch in GDB_INJECT_HOSTS: |
| 1197 platform_triple = pynacl.platform.PlatformTriple(platform, arch) | 1217 platform_triple = pynacl.platform.PlatformTriple(platform, arch) |
| 1198 os_name = pynacl.platform.GetOS(platform) | 1218 os_name = pynacl.platform.GetOS(platform) |
| 1199 arch_name = pynacl.platform.GetArch(arch) | 1219 arch_name = pynacl.platform.GetArch(arch) |
| 1200 | 1220 |
| 1201 gdb_packages = [ForHost('gdb', platform_triple)] | 1221 gdb_packages = [ForHost('gdb', platform_triple)] |
| 1202 package_target = '%s_%s' % (os_name, arch_name) | 1222 package_target = '%s_%s' % (os_name, arch_name) |
| 1203 | 1223 |
| 1204 for package_name, package_archives in GDB_INJECT_PACKAGES: | 1224 for package_name, package_archives in GDB_INJECT_PACKAGES: |
| 1205 combined_packages = package_archives + gdb_packages | 1225 combined_packages = package_archives + gdb_packages |
| 1206 package_target_dict = package_targets.setdefault(package_target, {}) | 1226 package_target_dict = package_targets.setdefault(package_target, {}) |
| 1207 package_target_dict.setdefault(package_name, []).extend(combined_packages) | 1227 package_target_dict.setdefault(package_name, []).extend(combined_packages) |
| 1208 | 1228 |
| 1209 return dict(package_targets) | 1229 return dict(package_targets) |
| 1210 | 1230 |
| 1211 | 1231 |
| 1212 def CollectPackagesForHost(host, targets): | 1232 def CollectPackagesForHost(host, targets): |
| 1213 packages = HostGccLibs(host).copy() | 1233 packages = HostGccLibs(host).copy() |
| 1214 for target in targets: | 1234 for target in targets: |
| 1215 packages.update(HostTools(host, target)) | 1235 packages.update(HostTools(host, target)) |
| 1216 if BuildTargetLibsOn(host): | 1236 if BuildTargetLibsOn(host): |
| 1217 packages.update(TargetLibs(host, target)) | 1237 packages.update(TargetLibs(host, target)) |
| 1218 packages.update(SDKLibs(host, target)) | 1238 packages.update(SDKLibs(host, target, 'newlib')) |
| 1239 packages.update(SDKLibs(host, target, 'glibc')) | |
| 1219 return packages | 1240 return packages |
| 1220 | 1241 |
| 1221 | 1242 |
| 1222 def CollectPackages(targets): | 1243 def CollectPackages(targets): |
| 1223 packages = CollectSources() | 1244 packages = CollectSources() |
| 1224 | 1245 |
| 1225 packages.update(CollectPackagesForHost(NATIVE_TUPLE, targets)) | 1246 packages.update(CollectPackagesForHost(NATIVE_TUPLE, targets)) |
| 1226 | 1247 |
| 1227 for host in EXTRA_HOSTS_MAP.get(NATIVE_TUPLE, []): | 1248 for host in EXTRA_HOSTS_MAP.get(NATIVE_TUPLE, []): |
| 1228 packages.update(CollectPackagesForHost(host, targets)) | 1249 packages.update(CollectPackagesForHost(host, targets)) |
| 1229 | 1250 |
| 1230 return packages | 1251 return packages |
| 1231 | 1252 |
| 1232 | 1253 |
| 1233 PACKAGES = CollectPackages(TARGET_LIST) | 1254 PACKAGES = CollectPackages(TARGET_LIST) |
| 1234 PACKAGE_TARGETS = GetPackageTargets() | 1255 PACKAGE_TARGETS = GetPackageTargets() |
| 1235 | 1256 |
| 1236 | 1257 |
| 1237 if __name__ == '__main__': | 1258 if __name__ == '__main__': |
| 1238 tb = toolchain_main.PackageBuilder(PACKAGES, PACKAGE_TARGETS, sys.argv[1:]) | 1259 tb = toolchain_main.PackageBuilder(PACKAGES, PACKAGE_TARGETS, sys.argv[1:]) |
| 1239 # TODO(mcgrathr): The bot ought to run some native_client tests | 1260 # TODO(mcgrathr): The bot ought to run some native_client tests |
| 1240 # using the new toolchain, like the old x86 toolchain bots do. | 1261 # using the new toolchain, like the old x86 toolchain bots do. |
| 1241 tb.Main() | 1262 tb.Main() |
| OLD | NEW |