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 CONFIGURE_GCC_FOR_NEWLIB = [ |
| 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, |
| 794 CONFIGURE_GCC_FOR_NEWLIB), |
785 # GCC's configure step writes configargs.h with some strings | 795 # GCC's configure step writes configargs.h with some strings |
786 # including the configure command line, which get embedded | 796 # including the configure command line, which get embedded |
787 # into the gcc driver binary. The build only works if we use | 797 # into the gcc driver binary. The build only works if we use |
788 # absolute paths in some of the configure switches, but | 798 # absolute paths in some of the configure switches, but |
789 # embedding those paths makes the output differ in repeated | 799 # embedding those paths makes the output differ in repeated |
790 # builds done in different directories, which we do not want. | 800 # builds done in different directories, which we do not want. |
791 # So force the generation of that file early and then edit it | 801 # So force the generation of that file early and then edit it |
792 # in place to replace the absolute paths with something that | 802 # in place to replace the absolute paths with something that |
793 # never varies. Note that the 'configure-gcc' target will | 803 # never varies. Note that the 'configure-gcc' target will |
794 # actually build some components before running gcc/configure. | 804 # actually build some components before running gcc/configure. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 return commands | 899 return commands |
890 | 900 |
891 | 901 |
892 def TargetLibs(host, target): | 902 def TargetLibs(host, target): |
893 lib_deps = [ForHost(component + '_' + target, host) | 903 lib_deps = [ForHost(component + '_' + target, host) |
894 for component in ['binutils', 'gcc']] | 904 for component in ['binutils', 'gcc']] |
895 | 905 |
896 def NewlibFile(subdir, name): | 906 def NewlibFile(subdir, name): |
897 return command.path.join('%(output)s', target + '-nacl', subdir, name) | 907 return command.path.join('%(output)s', target + '-nacl', subdir, name) |
898 | 908 |
899 newlib_sysroot = '%(abs_newlib_' + target + ')s' | |
900 newlib_tooldir = '%s/%s-nacl' % (newlib_sysroot, target) | |
901 | |
902 # See the comment at ConfigureTargetPrep, above. | 909 # See the comment at ConfigureTargetPrep, above. |
903 newlib_install_data = ' '.join(['STRIPPROG=%(cwd)s/strip_for_target', | 910 newlib_install_data = ' '.join(['STRIPPROG=%(cwd)s/strip_for_target', |
904 '%(abs_newlib)s/install-sh', | 911 '%(abs_newlib)s/install-sh', |
905 '-c', '-s', '-m', '644']) | 912 '-c', '-s', '-m', '644']) |
906 | 913 |
907 iconv_encodings = 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4' | 914 iconv_encodings = 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4' |
908 newlib_configure_args = [ | 915 newlib_configure_args = [ |
909 '--disable-libgloss', | 916 '--disable-libgloss', |
910 '--enable-newlib-iconv', | 917 '--enable-newlib-iconv', |
911 '--enable-newlib-iconv-from-encodings=' + iconv_encodings, | 918 '--enable-newlib-iconv-from-encodings=' + iconv_encodings, |
(...skipping 11 matching lines...) Expand all Loading... |
923 NewlibFile('lib', 'libcrt_common.a')), | 930 NewlibFile('lib', 'libcrt_common.a')), |
924 command.WriteData(NewlibLibcScript(target), | 931 command.WriteData(NewlibLibcScript(target), |
925 NewlibFile('lib', 'libc.a')), | 932 NewlibFile('lib', 'libc.a')), |
926 ] + [ | 933 ] + [ |
927 command.Copy( | 934 command.Copy( |
928 command.path.join('%(pthread_headers)s', header), | 935 command.path.join('%(pthread_headers)s', header), |
929 NewlibFile('include', header)) | 936 NewlibFile('include', header)) |
930 for header in ('pthread.h', 'semaphore.h') | 937 for header in ('pthread.h', 'semaphore.h') |
931 ] | 938 ] |
932 | 939 |
| 940 |
| 941 def GccLibsTarget(libc, configure_args): |
| 942 sysroot = '%(abs_' + libc + '_' + target + ')s' |
| 943 tooldir = '%s/%s-nacl' % (sysroot, target) |
| 944 package = { |
| 945 'type': 'build', |
| 946 'dependencies': (['gcc_libs'] + lib_deps + [libc + '_' + target] + |
| 947 HostGccLibsDeps(host)), |
| 948 # This actually builds the compiler again and uses that compiler |
| 949 # to build the target libraries. That's by far the easiest thing |
| 950 # to get going given the interdependencies of the target |
| 951 # libraries (especially libgcc) on the gcc subdirectory, and |
| 952 # building the compiler doesn't really take all that long in the |
| 953 # grand scheme of things. |
| 954 # TODO(mcgrathr): If upstream ever cleans up all their |
| 955 # interdependencies better, unpack the compiler, configure with |
| 956 # --disable-gcc, and just build all-target. |
| 957 'commands': ConfigureTargetPrep(target) + [ |
| 958 ConfigureGccCommand('gcc_libs', host, target, configure_args + [ |
| 959 '--with-build-sysroot=' + tooldir, |
| 960 ]), |
| 961 GccCommand(host, target, |
| 962 MakeCommand(host) + [ |
| 963 'build_tooldir=' + tooldir, |
| 964 'MAKEOVERRIDES=NATIVE_SYSTEM_HEADER_DIR=/include', |
| 965 'all-target', |
| 966 ]), |
| 967 GccCommand(host, target, |
| 968 MAKE_DESTDIR_CMD + ['install-strip-target']), |
| 969 REMOVE_INFO_DIR, |
| 970 ], |
| 971 } |
| 972 return package |
| 973 |
933 # The 'minisdk_<target>' component is a workalike subset of what the full | 974 # 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 | 975 # 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 | 976 # 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 | 977 # 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 | 978 # using SCons (and explicit copying, below), containing only the things |
938 # the build actually needs. | 979 # the build actually needs. |
939 def SconsCommand(args): | 980 def SconsCommand(args): |
940 return command.Command([sys.executable, '%(scons.py)s', | 981 return command.Command([sys.executable, '%(scons.py)s', |
941 '--verbose', '-j%(cores)s', | 982 '--verbose', '-j%(cores)s', |
942 'DESTINATION_ROOT=%(abs_work_dir)s'] + args, | 983 'DESTINATION_ROOT=%(abs_work_dir)s'] + args, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 ConfigureHostTool(host) + | 1065 ConfigureHostTool(host) + |
1025 ConfigureTargetArgs(target) + | 1066 ConfigureTargetArgs(target) + |
1026 newlib_configure_args, | 1067 newlib_configure_args, |
1027 MakeCommand(host), | 1068 MakeCommand(host), |
1028 MAKE_DESTDIR_CMD + ['install-strip'], | 1069 MAKE_DESTDIR_CMD + ['install-strip'], |
1029 ]) + | 1070 ]) + |
1030 newlib_post_install + | 1071 newlib_post_install + |
1031 InstallDocFiles('newlib', ['COPYING.NEWLIB'])), | 1072 InstallDocFiles('newlib', ['COPYING.NEWLIB'])), |
1032 }, | 1073 }, |
1033 | 1074 |
| 1075 'gcc_libs_' + target: GccLibsTarget('newlib', CONFIGURE_GCC_FOR_NEWLIB), |
| 1076 |
1034 'glibc_' + target: { | 1077 'glibc_' + target: { |
1035 'type': 'build', | 1078 'type': 'build', |
1036 # The glibc build needs a libgcc.a (and the unwind.h header). | 1079 # 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 | 1080 # For now, we just use the one built for the newlib toolchain |
1038 # and that seems to suffice. | 1081 # and that seems to suffice. |
1039 # TODO(mcgrathr): Eventually figure out a proper minimal build | 1082 # TODO(mcgrathr): Eventually figure out a proper minimal build |
1040 # of just the libgcc bits needed for the glibc build. | 1083 # of just the libgcc bits needed for the glibc build. |
1041 'dependencies': ['glibc', 'minisdk_' + target, | 1084 'dependencies': ['glibc', 'minisdk_' + target, |
1042 'gcc_libs_' + target] + lib_deps, | 1085 'gcc_libs_' + target] + lib_deps, |
1043 'commands': (ConfigureTargetPrep(target) + | 1086 'commands': (ConfigureTargetPrep(target) + |
(...skipping 17 matching lines...) Expand all Loading... |
1061 'install_root=%(abs_output)s/' + target + '-nacl', | 1104 'install_root=%(abs_output)s/' + target + '-nacl', |
1062 'inst_infodir=%(abs_output)s/share/info', | 1105 'inst_infodir=%(abs_output)s/share/info', |
1063 ], | 1106 ], |
1064 ], target_deps=['gcc_libs']) + | 1107 ], target_deps=['gcc_libs']) + |
1065 InstallDocFiles('glibc', ['COPYING.LIB']) + [ | 1108 InstallDocFiles('glibc', ['COPYING.LIB']) + [ |
1066 REMOVE_INFO_DIR, | 1109 REMOVE_INFO_DIR, |
1067 ] | 1110 ] |
1068 ), | 1111 ), |
1069 }, | 1112 }, |
1070 | 1113 |
1071 'gcc_libs_' + target: { | 1114 '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 } | 1115 } |
1099 | 1116 |
1100 libs.update(support) | 1117 libs.update(support) |
1101 return libs | 1118 return libs |
1102 | 1119 |
1103 # Compute it once. | 1120 # Compute it once. |
1104 NATIVE_TUPLE = pynacl.platform.PlatformTriple() | 1121 NATIVE_TUPLE = pynacl.platform.PlatformTriple() |
1105 | 1122 |
1106 | 1123 |
1107 # For our purposes, "cross-compiling" means not literally that we are | 1124 # 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) | 1178 host_target.arch) |
1162 binutils_package = ForHost('binutils_%s' % target_arch, platform_triple) | 1179 binutils_package = ForHost('binutils_%s' % target_arch, platform_triple) |
1163 gcc_package = ForHost('gcc_%s' % target_arch, platform_triple) | 1180 gcc_package = ForHost('gcc_%s' % target_arch, platform_triple) |
1164 gdb_package = ForHost('gdb', platform_triple) | 1181 gdb_package = ForHost('gdb', platform_triple) |
1165 | 1182 |
1166 # Create a list of packages for a target. | 1183 # Create a list of packages for a target. |
1167 platform_packages = [binutils_package, gcc_package, gdb_package] | 1184 platform_packages = [binutils_package, gcc_package, gdb_package] |
1168 raw_packages = shared_packages + platform_packages | 1185 raw_packages = shared_packages + platform_packages |
1169 all_packages = raw_packages + sdk_lib_packages | 1186 all_packages = raw_packages + sdk_lib_packages |
1170 | 1187 |
1171 glibc_packages = platform_packages + ['glibc_' + target_arch] | 1188 glibc_raw_packages = platform_packages + ['glibc_' + target_arch] |
| 1189 glibc_all_packages = glibc_raw_packages + ['sdk_libs_glibc_' + |
| 1190 target_arch] |
1172 | 1191 |
1173 os_name = pynacl.platform.GetOS(host_target.os) | 1192 os_name = pynacl.platform.GetOS(host_target.os) |
1174 if host_target.differ3264: | 1193 if host_target.differ3264: |
1175 arch_name = pynacl.platform.GetArch3264(host_target.arch) | 1194 arch_name = pynacl.platform.GetArch3264(host_target.arch) |
1176 else: | 1195 else: |
1177 arch_name = pynacl.platform.GetArch(host_target.arch) | 1196 arch_name = pynacl.platform.GetArch(host_target.arch) |
1178 package_target = '%s_%s' % (os_name, arch_name) | 1197 package_target = '%s_%s' % (os_name, arch_name) |
1179 package_name = '%snacl_%s_newlib' % (package_prefix, | 1198 package_name = '%snacl_%s_newlib' % (package_prefix, |
1180 pynacl.platform.GetArch(target_arch)) | 1199 pynacl.platform.GetArch(target_arch)) |
1181 raw_package_name = package_name + '_raw' | 1200 raw_package_name = package_name + '_raw' |
1182 | 1201 |
1183 # Toolchains by default are "raw" unless they include the Core SDK | 1202 # Toolchains by default are "raw" unless they include the Core SDK |
1184 package_target_dict = package_targets.setdefault(package_target, {}) | 1203 package_target_dict = package_targets.setdefault(package_target, {}) |
1185 package_target_dict.setdefault(raw_package_name, []).extend(raw_packages) | 1204 package_target_dict.setdefault(raw_package_name, []).extend(raw_packages) |
1186 package_target_dict.setdefault(package_name, []).extend(all_packages) | 1205 package_target_dict.setdefault(package_name, []).extend(all_packages) |
1187 | 1206 |
1188 glibc_package_name = (package_prefix + | 1207 glibc_package_name = (package_prefix + |
1189 ('nacl_%s_glibc' % | 1208 ('nacl_%s_glibc' % |
1190 pynacl.platform.GetArch(target_arch))) | 1209 pynacl.platform.GetArch(target_arch))) |
1191 glibc_raw_package_name = glibc_package_name + '_raw' | 1210 glibc_raw_package_name = glibc_package_name + '_raw' |
1192 package_target_dict.setdefault(glibc_raw_package_name, | 1211 package_target_dict.setdefault(glibc_raw_package_name, |
1193 []).extend(glibc_packages) | 1212 []).extend(glibc_raw_packages) |
| 1213 package_target_dict.setdefault(glibc_package_name, |
| 1214 []).extend(glibc_all_packages) |
1194 | 1215 |
1195 # GDB is a special and shared, we will inject it into various other packages. | 1216 # GDB is a special and shared, we will inject it into various other packages. |
1196 for platform, arch in GDB_INJECT_HOSTS: | 1217 for platform, arch in GDB_INJECT_HOSTS: |
1197 platform_triple = pynacl.platform.PlatformTriple(platform, arch) | 1218 platform_triple = pynacl.platform.PlatformTriple(platform, arch) |
1198 os_name = pynacl.platform.GetOS(platform) | 1219 os_name = pynacl.platform.GetOS(platform) |
1199 arch_name = pynacl.platform.GetArch(arch) | 1220 arch_name = pynacl.platform.GetArch(arch) |
1200 | 1221 |
1201 gdb_packages = [ForHost('gdb', platform_triple)] | 1222 gdb_packages = [ForHost('gdb', platform_triple)] |
1202 package_target = '%s_%s' % (os_name, arch_name) | 1223 package_target = '%s_%s' % (os_name, arch_name) |
1203 | 1224 |
1204 for package_name, package_archives in GDB_INJECT_PACKAGES: | 1225 for package_name, package_archives in GDB_INJECT_PACKAGES: |
1205 combined_packages = package_archives + gdb_packages | 1226 combined_packages = package_archives + gdb_packages |
1206 package_target_dict = package_targets.setdefault(package_target, {}) | 1227 package_target_dict = package_targets.setdefault(package_target, {}) |
1207 package_target_dict.setdefault(package_name, []).extend(combined_packages) | 1228 package_target_dict.setdefault(package_name, []).extend(combined_packages) |
1208 | 1229 |
1209 return dict(package_targets) | 1230 return dict(package_targets) |
1210 | 1231 |
1211 | 1232 |
1212 def CollectPackagesForHost(host, targets): | 1233 def CollectPackagesForHost(host, targets): |
1213 packages = HostGccLibs(host).copy() | 1234 packages = HostGccLibs(host).copy() |
1214 for target in targets: | 1235 for target in targets: |
1215 packages.update(HostTools(host, target)) | 1236 packages.update(HostTools(host, target)) |
1216 if BuildTargetLibsOn(host): | 1237 if BuildTargetLibsOn(host): |
1217 packages.update(TargetLibs(host, target)) | 1238 packages.update(TargetLibs(host, target)) |
1218 packages.update(SDKLibs(host, target)) | 1239 packages.update(SDKLibs(host, target, 'newlib')) |
| 1240 packages.update(SDKLibs(host, target, 'glibc')) |
1219 return packages | 1241 return packages |
1220 | 1242 |
1221 | 1243 |
1222 def CollectPackages(targets): | 1244 def CollectPackages(targets): |
1223 packages = CollectSources() | 1245 packages = CollectSources() |
1224 | 1246 |
1225 packages.update(CollectPackagesForHost(NATIVE_TUPLE, targets)) | 1247 packages.update(CollectPackagesForHost(NATIVE_TUPLE, targets)) |
1226 | 1248 |
1227 for host in EXTRA_HOSTS_MAP.get(NATIVE_TUPLE, []): | 1249 for host in EXTRA_HOSTS_MAP.get(NATIVE_TUPLE, []): |
1228 packages.update(CollectPackagesForHost(host, targets)) | 1250 packages.update(CollectPackagesForHost(host, targets)) |
1229 | 1251 |
1230 return packages | 1252 return packages |
1231 | 1253 |
1232 | 1254 |
1233 PACKAGES = CollectPackages(TARGET_LIST) | 1255 PACKAGES = CollectPackages(TARGET_LIST) |
1234 PACKAGE_TARGETS = GetPackageTargets() | 1256 PACKAGE_TARGETS = GetPackageTargets() |
1235 | 1257 |
1236 | 1258 |
1237 if __name__ == '__main__': | 1259 if __name__ == '__main__': |
1238 tb = toolchain_main.PackageBuilder(PACKAGES, PACKAGE_TARGETS, sys.argv[1:]) | 1260 tb = toolchain_main.PackageBuilder(PACKAGES, PACKAGE_TARGETS, sys.argv[1:]) |
1239 # TODO(mcgrathr): The bot ought to run some native_client tests | 1261 # TODO(mcgrathr): The bot ought to run some native_client tests |
1240 # using the new toolchain, like the old x86 toolchain bots do. | 1262 # using the new toolchain, like the old x86 toolchain bots do. |
1241 tb.Main() | 1263 tb.Main() |
OLD | NEW |