Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #! -*- python -*- | 1 #! -*- 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 import atexit | 6 import atexit |
| 7 import glob | 7 import glob |
| 8 import os | 8 import os |
| 9 import platform | 9 import platform |
| 10 import shutil | 10 import shutil |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 #. | 904 #. |
| 905 # We have "build" and "target" platforms for the non nacl environments | 905 # We have "build" and "target" platforms for the non nacl environments |
| 906 # which govern service runtime, validator, etc. | 906 # which govern service runtime, validator, etc. |
| 907 # | 907 # |
| 908 # "build" means the platform the code is running on | 908 # "build" means the platform the code is running on |
| 909 # "target" means the platform the validator is checking for. | 909 # "target" means the platform the validator is checking for. |
| 910 # Typically they are the same but testing it useful to have flexibility. | 910 # Typically they are the same but testing it useful to have flexibility. |
| 911 # | 911 # |
| 912 # Various variables in the scons environment are related to this, e.g. | 912 # Various variables in the scons environment are related to this, e.g. |
| 913 # | 913 # |
| 914 # BUILD_ARCH: (arm, x86) | 914 # BUILD_ARCH: (arm, mips, x86) |
| 915 # BUILD_SUBARCH: (32, 64) | 915 # BUILD_SUBARCH: (32, 64) |
| 916 # | 916 # |
| 917 # The settings can be controlled using scons command line variables: | 917 # The settings can be controlled using scons command line variables: |
| 918 # | 918 # |
| 919 # | 919 # |
| 920 # buildplatform=: controls the build platform | 920 # buildplatform=: controls the build platform |
| 921 # targetplatform=: controls the target platform | 921 # targetplatform=: controls the target platform |
| 922 # platform=: controls both | 922 # platform=: controls both |
| 923 # | 923 # |
| 924 # This dictionary is used to translate from a platform name to a | 924 # This dictionary is used to translate from a platform name to a |
| 925 # (arch, subarch) pair | 925 # (arch, subarch) pair |
| 926 AVAILABLE_PLATFORMS = { | 926 AVAILABLE_PLATFORMS = { |
| 927 'x86-32' : { 'arch' : 'x86' , 'subarch' : '32' }, | 927 'x86-32' : { 'arch' : 'x86' , 'subarch' : '32' }, |
| 928 'x86-64' : { 'arch' : 'x86' , 'subarch' : '64' }, | 928 'x86-64' : { 'arch' : 'x86' , 'subarch' : '64' }, |
| 929 'mips32' : { 'arch' : 'mips', 'subarch' : '32' }, | |
| 929 'arm' : { 'arch' : 'arm' , 'subarch' : '32' }, | 930 'arm' : { 'arch' : 'arm' , 'subarch' : '32' }, |
| 930 'arm-thumb2' : { 'arch' : 'arm' , 'subarch' : '32' } | 931 'arm-thumb2' : { 'arch' : 'arm' , 'subarch' : '32' } |
| 931 } | 932 } |
| 932 | 933 |
| 933 # Look up the platform name from the command line arguments, | 934 # Look up the platform name from the command line arguments, |
| 934 # defaulting to 'platform' if needed. | 935 # defaulting to 'platform' if needed. |
| 935 def GetPlatform(name): | 936 def GetPlatform(name): |
| 936 platform = ARGUMENTS.get(name) | 937 platform = ARGUMENTS.get(name) |
| 937 if platform is None: | 938 if platform is None: |
| 938 return ARGUMENTS.get('platform', 'x86-32') | 939 return ARGUMENTS.get('platform', 'x86-32') |
| 939 elif ARGUMENTS.get('platform') is None: | 940 elif ARGUMENTS.get('platform') is None: |
| 940 return platform | 941 return platform |
| 941 else: | 942 else: |
| 942 raise Exception('Can\'t specify both %s and %s on the command line' | 943 raise Exception('Can\'t specify both %s and %s on the command line' |
| 943 % ('platform', name)) | 944 % ('platform', name)) |
| 944 | 945 |
| 945 | 946 |
| 946 # Decode platform into list [ ARCHITECTURE , EXEC_MODE ]. | 947 # Decode platform into list [ ARCHITECTURE , EXEC_MODE ]. |
| 947 def DecodePlatform(platform): | 948 def DecodePlatform(platform): |
| 948 if platform in AVAILABLE_PLATFORMS: | 949 if platform in AVAILABLE_PLATFORMS: |
| 949 return AVAILABLE_PLATFORMS[platform] | 950 return AVAILABLE_PLATFORMS[platform] |
| 950 raise Exception('Unrecognized platform: %s' % platform) | 951 raise Exception('Unrecognized platform: %s' % platform) |
| 951 | 952 |
| 952 | 953 |
| 953 DeclareBit('build_x86_32', 'Building binaries for the x86-32 architecture', | 954 DeclareBit('build_x86_32', 'Building binaries for the x86-32 architecture', |
| 954 exclusive_groups='build_arch') | 955 exclusive_groups='build_arch') |
| 955 DeclareBit('build_x86_64', 'Building binaries for the x86-64 architecture', | 956 DeclareBit('build_x86_64', 'Building binaries for the x86-64 architecture', |
| 956 exclusive_groups='build_arch') | 957 exclusive_groups='build_arch') |
| 958 DeclareBit('build_mips32', 'Building binaries for the MIPS architecture', | |
| 959 exclusive_groups='build_arch') | |
| 957 DeclareBit('build_arm_arm', 'Building binaries for the ARM architecture', | 960 DeclareBit('build_arm_arm', 'Building binaries for the ARM architecture', |
| 958 exclusive_groups='build_arch') | 961 exclusive_groups='build_arch') |
| 959 DeclareBit('build_arm_thumb2', | 962 DeclareBit('build_arm_thumb2', |
| 960 'Building binaries for the ARM architecture (thumb2 ISA)', | 963 'Building binaries for the ARM architecture (thumb2 ISA)', |
| 961 exclusive_groups='build_arch') | 964 exclusive_groups='build_arch') |
| 962 DeclareBit('target_x86_32', 'Tools being built will process x86-32 binaries', | 965 DeclareBit('target_x86_32', 'Tools being built will process x86-32 binaries', |
| 963 exclusive_groups='target_arch') | 966 exclusive_groups='target_arch') |
| 964 DeclareBit('target_x86_64', 'Tools being built will process x86-36 binaries', | 967 DeclareBit('target_x86_64', 'Tools being built will process x86-36 binaries', |
| 965 exclusive_groups='target_arch') | 968 exclusive_groups='target_arch') |
| 969 DeclareBit('target_mips32', 'Tools being built will process MIPS binaries', | |
| 970 exclusive_groups='target_arch') | |
| 966 DeclareBit('target_arm_arm', 'Tools being built will process ARM binaries', | 971 DeclareBit('target_arm_arm', 'Tools being built will process ARM binaries', |
| 967 exclusive_groups='target_arch') | 972 exclusive_groups='target_arch') |
| 968 DeclareBit('target_arm_thumb2', | 973 DeclareBit('target_arm_thumb2', |
| 969 'Tools being built will process ARM binaries (thumb2 ISA)', | 974 'Tools being built will process ARM binaries (thumb2 ISA)', |
| 970 exclusive_groups='target_arch') | 975 exclusive_groups='target_arch') |
| 971 | 976 |
| 972 # Shorthand for either the 32 or 64 bit version of x86. | 977 # Shorthand for either the 32 or 64 bit version of x86. |
| 973 DeclareBit('build_x86', 'Building binaries for the x86 architecture') | 978 DeclareBit('build_x86', 'Building binaries for the x86 architecture') |
| 974 DeclareBit('target_x86', 'Tools being built will process x86 binaries') | 979 DeclareBit('target_x86', 'Tools being built will process x86 binaries') |
| 975 | 980 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1006 env.SetBits('target_x86') | 1011 env.SetBits('target_x86') |
| 1007 if env.Bit('target_arm_arm') or env.Bit('target_arm_thumb2'): | 1012 if env.Bit('target_arm_arm') or env.Bit('target_arm_thumb2'): |
| 1008 env.SetBits('target_arm') | 1013 env.SetBits('target_arm') |
| 1009 | 1014 |
| 1010 env.Replace(BUILD_ISA_NAME=GetPlatform('buildplatform')) | 1015 env.Replace(BUILD_ISA_NAME=GetPlatform('buildplatform')) |
| 1011 | 1016 |
| 1012 if env.Bit('target_arm') and not env.Bit('bitcode'): | 1017 if env.Bit('target_arm') and not env.Bit('bitcode'): |
| 1013 # This has always been a silent default on ARM. | 1018 # This has always been a silent default on ARM. |
| 1014 env.SetBits('bitcode') | 1019 env.SetBits('bitcode') |
| 1015 | 1020 |
| 1021 if env.Bit('target_mips32') and not env.Bit('bitcode'): | |
|
Nick Bray (chromium)
2012/04/13 20:25:26
Optional:
if env.Bit('target_arm') or env.Bit('ta
| |
| 1022 # This is a silent default on MIPS. | |
| 1023 env.SetBits('bitcode') | |
| 1024 | |
| 1016 # Determine where the object files go | 1025 # Determine where the object files go |
| 1017 if BUILD_NAME == TARGET_NAME: | 1026 if BUILD_NAME == TARGET_NAME: |
| 1018 BUILD_TARGET_NAME = TARGET_NAME | 1027 BUILD_TARGET_NAME = TARGET_NAME |
| 1019 else: | 1028 else: |
| 1020 BUILD_TARGET_NAME = '%s-to-%s' % (BUILD_NAME, TARGET_NAME) | 1029 BUILD_TARGET_NAME = '%s-to-%s' % (BUILD_NAME, TARGET_NAME) |
| 1021 env.Replace(BUILD_TARGET_NAME=BUILD_TARGET_NAME) | 1030 env.Replace(BUILD_TARGET_NAME=BUILD_TARGET_NAME) |
| 1022 # This may be changed later; see target_variant_map, below. | 1031 # This may be changed later; see target_variant_map, below. |
| 1023 env.Replace(TARGET_VARIANT='') | 1032 env.Replace(TARGET_VARIANT='') |
| 1024 env.Replace(TARGET_ROOT= | 1033 env.Replace(TARGET_ROOT= |
| 1025 '${DESTINATION_ROOT}/${BUILD_TYPE}-${BUILD_TARGET_NAME}${TARGET_VARIANT}') | 1034 '${DESTINATION_ROOT}/${BUILD_TYPE}-${BUILD_TARGET_NAME}${TARGET_VARIANT}') |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 | 1160 |
| 1152 | 1161 |
| 1153 def GetValidator(env, validator): | 1162 def GetValidator(env, validator): |
| 1154 # NOTE: that the variable TRUSTED_ENV is set by ExportSpecialFamilyVars() | 1163 # NOTE: that the variable TRUSTED_ENV is set by ExportSpecialFamilyVars() |
| 1155 if 'TRUSTED_ENV' not in env: | 1164 if 'TRUSTED_ENV' not in env: |
| 1156 return None | 1165 return None |
| 1157 | 1166 |
| 1158 if validator is None: | 1167 if validator is None: |
| 1159 if env.Bit('build_arm'): | 1168 if env.Bit('build_arm'): |
| 1160 validator = 'arm-ncval-core' | 1169 validator = 'arm-ncval-core' |
| 1170 elif env.Bit('build_mips32'): | |
| 1171 validator = 'mips-ncval-core' | |
| 1161 else: | 1172 else: |
| 1162 validator = 'ncval' | 1173 validator = 'ncval' |
| 1163 | 1174 |
| 1164 trusted_env = env['TRUSTED_ENV'] | 1175 trusted_env = env['TRUSTED_ENV'] |
| 1165 return trusted_env.File('${STAGING_DIR}/${PROGPREFIX}%s${PROGSUFFIX}' % | 1176 return trusted_env.File('${STAGING_DIR}/${PROGPREFIX}%s${PROGSUFFIX}' % |
| 1166 validator) | 1177 validator) |
| 1167 | 1178 |
| 1168 | 1179 |
| 1169 # Perform os.path.abspath rooted at the directory SConstruct resides in. | 1180 # Perform os.path.abspath rooted at the directory SConstruct resides in. |
| 1170 def SConstructAbsPath(env, path): | 1181 def SConstructAbsPath(env, path): |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1728 if not env.Bit('do_not_run_tests'): | 1739 if not env.Bit('do_not_run_tests'): |
| 1729 for action in post_actions: | 1740 for action in post_actions: |
| 1730 env.AddPostAction(node, action) | 1741 env.AddPostAction(node, action) |
| 1731 return node | 1742 return node |
| 1732 | 1743 |
| 1733 pre_base_env.AddMethod(PPAPIBrowserTester) | 1744 pre_base_env.AddMethod(PPAPIBrowserTester) |
| 1734 | 1745 |
| 1735 | 1746 |
| 1736 # Disabled for ARM because Chrome binaries for ARM are not available. | 1747 # Disabled for ARM because Chrome binaries for ARM are not available. |
| 1737 def PPAPIBrowserTesterIsBroken(env): | 1748 def PPAPIBrowserTesterIsBroken(env): |
| 1738 return env.Bit('target_arm') or env.Bit('target_arm_thumb2') | 1749 return (env.Bit('target_arm') or env.Bit('target_arm_thumb2') |
| 1750 or env.Bit('target_mips32')) | |
| 1739 | 1751 |
| 1740 pre_base_env.AddMethod(PPAPIBrowserTesterIsBroken) | 1752 pre_base_env.AddMethod(PPAPIBrowserTesterIsBroken) |
| 1741 | 1753 |
| 1742 # 3D is disabled everywhere | 1754 # 3D is disabled everywhere |
| 1743 def PPAPIGraphics3DIsBroken(env): | 1755 def PPAPIGraphics3DIsBroken(env): |
| 1744 return True | 1756 return True |
| 1745 | 1757 |
| 1746 pre_base_env.AddMethod(PPAPIGraphics3DIsBroken) | 1758 pre_base_env.AddMethod(PPAPIGraphics3DIsBroken) |
| 1747 | 1759 |
| 1748 | 1760 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1940 # TODO(mseaborn): Fix by retrying the connection or by adding an | 1952 # TODO(mseaborn): Fix by retrying the connection or by adding an |
| 1941 # option to ld.so to disable its argv-over-IPC feature. | 1953 # option to ld.so to disable its argv-over-IPC feature. |
| 1942 if env.Bit('nacl_glibc') and not env.Bit('nacl_static_link'): | 1954 if env.Bit('nacl_glibc') and not env.Bit('nacl_static_link'): |
| 1943 return [] | 1955 return [] |
| 1944 | 1956 |
| 1945 if sel_universal_flags is None: | 1957 if sel_universal_flags is None: |
| 1946 sel_universal_flags = [] | 1958 sel_universal_flags = [] |
| 1947 | 1959 |
| 1948 # When run under qemu, sel_universal must sneak in qemu to the execv | 1960 # When run under qemu, sel_universal must sneak in qemu to the execv |
| 1949 # call that spawns sel_ldr. | 1961 # call that spawns sel_ldr. |
| 1950 if env.Bit('target_arm') and env.UsingEmulator(): | 1962 if env.UsingEmulator(): |
|
Brad Chen
2012/04/12 00:51:34
Have you determined that the env.Bit('target_arm')
petarj
2012/04/12 13:21:01
This has been changed per Mark's comment in the pr
| |
| 1951 sel_universal_flags.append('--command_prefix') | 1963 sel_universal_flags.append('--command_prefix') |
| 1952 sel_universal_flags.append(GetEmulator(env)) | 1964 sel_universal_flags.append(GetEmulator(env)) |
| 1953 | 1965 |
| 1954 if 'TRUSTED_ENV' not in env: | 1966 if 'TRUSTED_ENV' not in env: |
| 1955 return [] | 1967 return [] |
| 1956 sel_universal = env['TRUSTED_ENV'].File( | 1968 sel_universal = env['TRUSTED_ENV'].File( |
| 1957 '${STAGING_DIR}/${PROGPREFIX}sel_universal${PROGSUFFIX}') | 1969 '${STAGING_DIR}/${PROGPREFIX}sel_universal${PROGSUFFIX}') |
| 1958 | 1970 |
| 1959 # Point to sel_ldr using an environment variable. | 1971 # Point to sel_ldr using an environment variable. |
| 1960 sel_ldr = GetSelLdr(env) | 1972 sel_ldr = GetSelLdr(env) |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2540 'tests/unittests/shared/platform/build.scons', | 2552 'tests/unittests/shared/platform/build.scons', |
| 2541 'tests/unittests/trusted/asan/build.scons', | 2553 'tests/unittests/trusted/asan/build.scons', |
| 2542 'tests/unittests/trusted/platform_qualify/build.scons', | 2554 'tests/unittests/trusted/platform_qualify/build.scons', |
| 2543 'tests/unittests/trusted/service_runtime/build.scons', | 2555 'tests/unittests/trusted/service_runtime/build.scons', |
| 2544 'installer/build.scons' | 2556 'installer/build.scons' |
| 2545 ], | 2557 ], |
| 2546 ) | 2558 ) |
| 2547 | 2559 |
| 2548 base_env.AddMethod(SDKInstallBin) | 2560 base_env.AddMethod(SDKInstallBin) |
| 2549 | 2561 |
| 2550 # The ARM validator can be built for any target that doesn't use ELFCLASS64. | 2562 # The ARM and MIPS validators can be built for any target that doesn't use |
| 2563 # ELFCLASS64. | |
| 2551 if not base_env.Bit('target_x86_64'): | 2564 if not base_env.Bit('target_x86_64'): |
| 2552 base_env.Append( | 2565 base_env.Append( |
| 2553 BUILD_SCONSCRIPTS = [ | 2566 BUILD_SCONSCRIPTS = [ |
| 2554 'src/trusted/validator_arm/build.scons', | 2567 'src/trusted/validator_arm/build.scons', |
| 2568 'src/trusted/validator_mips/build.scons', | |
| 2555 ]) | 2569 ]) |
| 2556 | 2570 |
| 2557 base_env.Replace( | 2571 base_env.Replace( |
| 2558 NACL_BUILD_FAMILY = 'TRUSTED', | 2572 NACL_BUILD_FAMILY = 'TRUSTED', |
| 2559 | 2573 |
| 2560 SDL_HERMETIC_LINUX_DIR='${MAIN_DIR}/../third_party/sdl/linux/v1_2_13', | 2574 SDL_HERMETIC_LINUX_DIR='${MAIN_DIR}/../third_party/sdl/linux/v1_2_13', |
| 2561 SDL_HERMETIC_MAC_DIR='${MAIN_DIR}/../third_party/sdl/osx/v1_2_13', | 2575 SDL_HERMETIC_MAC_DIR='${MAIN_DIR}/../third_party/sdl/osx/v1_2_13', |
| 2562 SDL_HERMETIC_WINDOWS_DIR='${MAIN_DIR}/../third_party/sdl/win/v1_2_13', | 2576 SDL_HERMETIC_WINDOWS_DIR='${MAIN_DIR}/../third_party/sdl/win/v1_2_13', |
| 2563 ) | 2577 ) |
| 2564 | 2578 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2981 '-isystem', | 2995 '-isystem', |
| 2982 jail + '/usr/include', | 2996 jail + '/usr/include', |
| 2983 ]) | 2997 ]) |
| 2984 # /usr/lib makes sense for most configuration except this one | 2998 # /usr/lib makes sense for most configuration except this one |
| 2985 # No ARM compatible libs can be found there. | 2999 # No ARM compatible libs can be found there. |
| 2986 # So this just makes the command lines longer and sometimes results | 3000 # So this just makes the command lines longer and sometimes results |
| 2987 # in linker warnings referring to this directory. | 3001 # in linker warnings referring to this directory. |
| 2988 linux_env.FilterOut(LIBPATH=['/usr/lib']) | 3002 linux_env.FilterOut(LIBPATH=['/usr/lib']) |
| 2989 # This appears to be needed for sel_universal | 3003 # This appears to be needed for sel_universal |
| 2990 linux_env.Append(LIBS=['dl']) | 3004 linux_env.Append(LIBS=['dl']) |
| 3005 elif linux_env.Bit('build_mips32'): | |
| 3006 pass | |
| 2991 else: | 3007 else: |
| 2992 Banner('Strange platform: %s' % BUILD_NAME) | 3008 Banner('Strange platform: %s' % BUILD_NAME) |
| 2993 | 3009 |
| 2994 # These are desireable options for every Linux platform: | 3010 # These are desireable options for every Linux platform: |
| 2995 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions | 3011 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions |
| 2996 # -fPIE/-pie: create a position-independent executable | 3012 # -fPIE/-pie: create a position-independent executable |
| 2997 # relro/now: "hardening" options for linking | 3013 # relro/now: "hardening" options for linking |
| 2998 # noexecstack: ensure that the executable does not get a PT_GNU_STACK | 3014 # noexecstack: ensure that the executable does not get a PT_GNU_STACK |
| 2999 # header that causes the kernel to set the READ_IMPLIES_EXEC | 3015 # header that causes the kernel to set the READ_IMPLIES_EXEC |
| 3000 # personality flag, which disables NX page protection. | 3016 # personality flag, which disables NX page protection. |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3943 nacl_env.ValidateSdk() | 3959 nacl_env.ValidateSdk() |
| 3944 | 3960 |
| 3945 if BROKEN_TEST_COUNT > 0: | 3961 if BROKEN_TEST_COUNT > 0: |
| 3946 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3962 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
| 3947 if GetOption('brief_comstr'): | 3963 if GetOption('brief_comstr'): |
| 3948 msg += " Add --verbose to the command line for more information." | 3964 msg += " Add --verbose to the command line for more information." |
| 3949 print msg | 3965 print msg |
| 3950 | 3966 |
| 3951 # separate warnings from actual build output | 3967 # separate warnings from actual build output |
| 3952 Banner('B U I L D - O U T P U T:') | 3968 Banner('B U I L D - O U T P U T:') |
| OLD | NEW |