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 'mips' : { 'arch' : 'mips', 'subarch' : '32' }, | |
|
Mark Seaborn
2012/04/04 21:04:22
Should this be called "mips32"?
| |
| 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_mips', '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_mips', '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_mips') and not env.Bit('bitcode'): | |
| 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_mips'): | |
| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1726 if not env.Bit('do_not_run_tests'): | 1737 if not env.Bit('do_not_run_tests'): |
| 1727 for action in post_actions: | 1738 for action in post_actions: |
| 1728 env.AddPostAction(node, action) | 1739 env.AddPostAction(node, action) |
| 1729 return node | 1740 return node |
| 1730 | 1741 |
| 1731 pre_base_env.AddMethod(PPAPIBrowserTester) | 1742 pre_base_env.AddMethod(PPAPIBrowserTester) |
| 1732 | 1743 |
| 1733 | 1744 |
| 1734 # Disabled for ARM because Chrome binaries for ARM are not available. | 1745 # Disabled for ARM because Chrome binaries for ARM are not available. |
| 1735 def PPAPIBrowserTesterIsBroken(env): | 1746 def PPAPIBrowserTesterIsBroken(env): |
| 1736 return env.Bit('target_arm') or env.Bit('target_arm_thumb2') | 1747 return (env.Bit('target_arm') or env.Bit('target_arm_thumb2') |
| 1748 or env.Bit('target_mips')) | |
|
Mark Seaborn
2012/04/04 21:04:22
Nit: Indent by 1 more to line up with '('
| |
| 1737 | 1749 |
| 1738 pre_base_env.AddMethod(PPAPIBrowserTesterIsBroken) | 1750 pre_base_env.AddMethod(PPAPIBrowserTesterIsBroken) |
| 1739 | 1751 |
| 1740 # 3D is disabled everywhere | 1752 # 3D is disabled everywhere |
| 1741 def PPAPIGraphics3DIsBroken(env): | 1753 def PPAPIGraphics3DIsBroken(env): |
| 1742 return True | 1754 return True |
| 1743 | 1755 |
| 1744 pre_base_env.AddMethod(PPAPIGraphics3DIsBroken) | 1756 pre_base_env.AddMethod(PPAPIGraphics3DIsBroken) |
| 1745 | 1757 |
| 1746 | 1758 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1939 | 1951 |
| 1940 if sel_universal_flags is None: | 1952 if sel_universal_flags is None: |
| 1941 sel_universal_flags = [] | 1953 sel_universal_flags = [] |
| 1942 | 1954 |
| 1943 # When run under qemu, sel_universal must sneak in qemu to the execv | 1955 # When run under qemu, sel_universal must sneak in qemu to the execv |
| 1944 # call that spawns sel_ldr. | 1956 # call that spawns sel_ldr. |
| 1945 if env.Bit('target_arm') and env.UsingEmulator(): | 1957 if env.Bit('target_arm') and env.UsingEmulator(): |
| 1946 sel_universal_flags.append('--command_prefix') | 1958 sel_universal_flags.append('--command_prefix') |
| 1947 sel_universal_flags.append(GetEmulator(env)) | 1959 sel_universal_flags.append(GetEmulator(env)) |
| 1948 | 1960 |
| 1961 if env.Bit('target_mips') and env.UsingEmulator(): | |
|
Mark Seaborn
2012/04/04 21:04:22
This is a duplicate of the previous block, right?
| |
| 1962 sel_universal_flags.append('--command_prefix') | |
| 1963 sel_universal_flags.append(GetEmulator(env)) | |
| 1964 | |
| 1949 if 'TRUSTED_ENV' not in env: | 1965 if 'TRUSTED_ENV' not in env: |
| 1950 return [] | 1966 return [] |
| 1951 sel_universal = env['TRUSTED_ENV'].File( | 1967 sel_universal = env['TRUSTED_ENV'].File( |
| 1952 '${STAGING_DIR}/${PROGPREFIX}sel_universal${PROGSUFFIX}') | 1968 '${STAGING_DIR}/${PROGPREFIX}sel_universal${PROGSUFFIX}') |
| 1953 | 1969 |
| 1954 # Point to sel_ldr using an environment variable. | 1970 # Point to sel_ldr using an environment variable. |
| 1955 sel_ldr = GetSelLdr(env) | 1971 sel_ldr = GetSelLdr(env) |
| 1956 if sel_ldr is None: | 1972 if sel_ldr is None: |
| 1957 print 'WARNING: no sel_ldr found. Skipping test %s' % name | 1973 print 'WARNING: no sel_ldr found. Skipping test %s' % name |
| 1958 return [] | 1974 return [] |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2540 ) | 2556 ) |
| 2541 | 2557 |
| 2542 base_env.AddMethod(SDKInstallBin) | 2558 base_env.AddMethod(SDKInstallBin) |
| 2543 | 2559 |
| 2544 # The ARM validator can be built for any target that doesn't use ELFCLASS64. | 2560 # The ARM validator can be built for any target that doesn't use ELFCLASS64. |
| 2545 if not base_env.Bit('target_x86_64'): | 2561 if not base_env.Bit('target_x86_64'): |
| 2546 base_env.Append( | 2562 base_env.Append( |
| 2547 BUILD_SCONSCRIPTS = [ | 2563 BUILD_SCONSCRIPTS = [ |
| 2548 'src/trusted/validator_arm/build.scons', | 2564 'src/trusted/validator_arm/build.scons', |
| 2549 ]) | 2565 ]) |
| 2566 if base_env.Bit('target_mips'): | |
|
Mark Seaborn
2012/04/04 21:04:22
Please make this unconditional: I want to ensure t
| |
| 2567 base_env.Append( | |
| 2568 BUILD_SCONSCRIPTS = [ | |
| 2569 'src/trusted/validator_mips/build.scons', | |
| 2570 ]) | |
| 2550 | 2571 |
| 2551 base_env.Replace( | 2572 base_env.Replace( |
| 2552 NACL_BUILD_FAMILY = 'TRUSTED', | 2573 NACL_BUILD_FAMILY = 'TRUSTED', |
| 2553 | 2574 |
| 2554 SDL_HERMETIC_LINUX_DIR='${MAIN_DIR}/../third_party/sdl/linux/v1_2_13', | 2575 SDL_HERMETIC_LINUX_DIR='${MAIN_DIR}/../third_party/sdl/linux/v1_2_13', |
| 2555 SDL_HERMETIC_MAC_DIR='${MAIN_DIR}/../third_party/sdl/osx/v1_2_13', | 2576 SDL_HERMETIC_MAC_DIR='${MAIN_DIR}/../third_party/sdl/osx/v1_2_13', |
| 2556 SDL_HERMETIC_WINDOWS_DIR='${MAIN_DIR}/../third_party/sdl/win/v1_2_13', | 2577 SDL_HERMETIC_WINDOWS_DIR='${MAIN_DIR}/../third_party/sdl/win/v1_2_13', |
| 2557 ) | 2578 ) |
| 2558 | 2579 |
| 2559 # Add optional scons files if present in the directory tree. | 2580 # Add optional scons files if present in the directory tree. |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2976 '-isystem', | 2997 '-isystem', |
| 2977 jail + '/usr/include', | 2998 jail + '/usr/include', |
| 2978 ]) | 2999 ]) |
| 2979 # /usr/lib makes sense for most configuration except this one | 3000 # /usr/lib makes sense for most configuration except this one |
| 2980 # No ARM compatible libs can be found there. | 3001 # No ARM compatible libs can be found there. |
| 2981 # So this just makes the command lines longer and sometimes results | 3002 # So this just makes the command lines longer and sometimes results |
| 2982 # in linker warnings referring to this directory. | 3003 # in linker warnings referring to this directory. |
| 2983 linux_env.FilterOut(LIBPATH=['/usr/lib']) | 3004 linux_env.FilterOut(LIBPATH=['/usr/lib']) |
| 2984 # This appears to be needed for sel_universal | 3005 # This appears to be needed for sel_universal |
| 2985 linux_env.Append(LIBS=['dl']) | 3006 linux_env.Append(LIBS=['dl']) |
| 3007 elif linux_env.Bit('build_mips'): | |
| 3008 print 'placeholder for MIPS' | |
|
Mark Seaborn
2012/04/04 21:04:22
You can just replace this with "pass". No need to
| |
| 2986 else: | 3009 else: |
| 2987 Banner('Strange platform: %s' % BUILD_NAME) | 3010 Banner('Strange platform: %s' % BUILD_NAME) |
| 2988 | 3011 |
| 2989 # These are desireable options for every Linux platform: | 3012 # These are desireable options for every Linux platform: |
| 2990 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions | 3013 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions |
| 2991 # -fPIE/-pie: create a position-independent executable | 3014 # -fPIE/-pie: create a position-independent executable |
| 2992 # relro/now: "hardening" options for linking | 3015 # relro/now: "hardening" options for linking |
| 2993 # noexecstack: ensure that the executable does not get a PT_GNU_STACK | 3016 # noexecstack: ensure that the executable does not get a PT_GNU_STACK |
| 2994 # header that causes the kernel to set the READ_IMPLIES_EXEC | 3017 # header that causes the kernel to set the READ_IMPLIES_EXEC |
| 2995 # personality flag, which disables NX page protection. | 3018 # personality flag, which disables NX page protection. |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3936 nacl_env.ValidateSdk() | 3959 nacl_env.ValidateSdk() |
| 3937 | 3960 |
| 3938 if BROKEN_TEST_COUNT > 0: | 3961 if BROKEN_TEST_COUNT > 0: |
| 3939 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3962 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
| 3940 if GetOption('brief_comstr'): | 3963 if GetOption('brief_comstr'): |
| 3941 msg += " Add --verbose to the command line for more information." | 3964 msg += " Add --verbose to the command line for more information." |
| 3942 print msg | 3965 print msg |
| 3943 | 3966 |
| 3944 # separate warnings from actual build output | 3967 # separate warnings from actual build output |
| 3945 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 |