Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: SConstruct

Issue 9979025: [MIPS] Adding validator for MIPS architecture. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Changes after second code review. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pnacl/build.sh » ('j') | pnacl/build.sh » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 #. 887 #.
888 # We have "build" and "target" platforms for the non nacl environments 888 # We have "build" and "target" platforms for the non nacl environments
889 # which govern service runtime, validator, etc. 889 # which govern service runtime, validator, etc.
890 # 890 #
891 # "build" means the platform the code is running on 891 # "build" means the platform the code is running on
892 # "target" means the platform the validator is checking for. 892 # "target" means the platform the validator is checking for.
893 # Typically they are the same but testing it useful to have flexibility. 893 # Typically they are the same but testing it useful to have flexibility.
894 # 894 #
895 # Various variables in the scons environment are related to this, e.g. 895 # Various variables in the scons environment are related to this, e.g.
896 # 896 #
897 # BUILD_ARCH: (arm, x86) 897 # BUILD_ARCH: (arm, mips, x86)
898 # BUILD_SUBARCH: (32, 64) 898 # BUILD_SUBARCH: (32, 64)
899 # 899 #
900 # The settings can be controlled using scons command line variables: 900 # The settings can be controlled using scons command line variables:
901 # 901 #
902 # 902 #
903 # buildplatform=: controls the build platform 903 # buildplatform=: controls the build platform
904 # targetplatform=: controls the target platform 904 # targetplatform=: controls the target platform
905 # platform=: controls both 905 # platform=: controls both
906 # 906 #
907 # This dictionary is used to translate from a platform name to a 907 # This dictionary is used to translate from a platform name to a
908 # (arch, subarch) pair 908 # (arch, subarch) pair
909 AVAILABLE_PLATFORMS = { 909 AVAILABLE_PLATFORMS = {
910 'x86-32' : { 'arch' : 'x86' , 'subarch' : '32' }, 910 'x86-32' : { 'arch' : 'x86' , 'subarch' : '32' },
911 'x86-64' : { 'arch' : 'x86' , 'subarch' : '64' }, 911 'x86-64' : { 'arch' : 'x86' , 'subarch' : '64' },
912 'mips32' : { 'arch' : 'mips', 'subarch' : '32' },
912 'arm' : { 'arch' : 'arm' , 'subarch' : '32' }, 913 'arm' : { 'arch' : 'arm' , 'subarch' : '32' },
913 'arm-thumb2' : { 'arch' : 'arm' , 'subarch' : '32' } 914 'arm-thumb2' : { 'arch' : 'arm' , 'subarch' : '32' }
914 } 915 }
915 916
916 # Look up the platform name from the command line arguments, 917 # Look up the platform name from the command line arguments,
917 # defaulting to 'platform' if needed. 918 # defaulting to 'platform' if needed.
918 def GetPlatform(name): 919 def GetPlatform(name):
919 platform = ARGUMENTS.get(name) 920 platform = ARGUMENTS.get(name)
920 if platform is None: 921 if platform is None:
921 return ARGUMENTS.get('platform', 'x86-32') 922 return ARGUMENTS.get('platform', 'x86-32')
922 elif ARGUMENTS.get('platform') is None: 923 elif ARGUMENTS.get('platform') is None:
923 return platform 924 return platform
924 else: 925 else:
925 raise Exception('Can\'t specify both %s and %s on the command line' 926 raise Exception('Can\'t specify both %s and %s on the command line'
926 % ('platform', name)) 927 % ('platform', name))
927 928
928 929
929 # Decode platform into list [ ARCHITECTURE , EXEC_MODE ]. 930 # Decode platform into list [ ARCHITECTURE , EXEC_MODE ].
930 def DecodePlatform(platform): 931 def DecodePlatform(platform):
931 if platform in AVAILABLE_PLATFORMS: 932 if platform in AVAILABLE_PLATFORMS:
932 return AVAILABLE_PLATFORMS[platform] 933 return AVAILABLE_PLATFORMS[platform]
933 raise Exception('Unrecognized platform: %s' % platform) 934 raise Exception('Unrecognized platform: %s' % platform)
934 935
935 936
936 DeclareBit('build_x86_32', 'Building binaries for the x86-32 architecture', 937 DeclareBit('build_x86_32', 'Building binaries for the x86-32 architecture',
937 exclusive_groups='build_arch') 938 exclusive_groups='build_arch')
938 DeclareBit('build_x86_64', 'Building binaries for the x86-64 architecture', 939 DeclareBit('build_x86_64', 'Building binaries for the x86-64 architecture',
939 exclusive_groups='build_arch') 940 exclusive_groups='build_arch')
941 DeclareBit('build_mips32', 'Building binaries for the MIPS architecture',
942 exclusive_groups='build_arch')
940 DeclareBit('build_arm_arm', 'Building binaries for the ARM architecture', 943 DeclareBit('build_arm_arm', 'Building binaries for the ARM architecture',
941 exclusive_groups='build_arch') 944 exclusive_groups='build_arch')
942 DeclareBit('build_arm_thumb2', 945 DeclareBit('build_arm_thumb2',
943 'Building binaries for the ARM architecture (thumb2 ISA)', 946 'Building binaries for the ARM architecture (thumb2 ISA)',
944 exclusive_groups='build_arch') 947 exclusive_groups='build_arch')
945 DeclareBit('target_x86_32', 'Tools being built will process x86-32 binaries', 948 DeclareBit('target_x86_32', 'Tools being built will process x86-32 binaries',
946 exclusive_groups='target_arch') 949 exclusive_groups='target_arch')
947 DeclareBit('target_x86_64', 'Tools being built will process x86-36 binaries', 950 DeclareBit('target_x86_64', 'Tools being built will process x86-36 binaries',
948 exclusive_groups='target_arch') 951 exclusive_groups='target_arch')
952 DeclareBit('target_mips32', 'Tools being built will process MIPS binaries',
953 exclusive_groups='target_arch')
949 DeclareBit('target_arm_arm', 'Tools being built will process ARM binaries', 954 DeclareBit('target_arm_arm', 'Tools being built will process ARM binaries',
950 exclusive_groups='target_arch') 955 exclusive_groups='target_arch')
951 DeclareBit('target_arm_thumb2', 956 DeclareBit('target_arm_thumb2',
952 'Tools being built will process ARM binaries (thumb2 ISA)', 957 'Tools being built will process ARM binaries (thumb2 ISA)',
953 exclusive_groups='target_arch') 958 exclusive_groups='target_arch')
954 959
955 # Shorthand for either the 32 or 64 bit version of x86. 960 # Shorthand for either the 32 or 64 bit version of x86.
956 DeclareBit('build_x86', 'Building binaries for the x86 architecture') 961 DeclareBit('build_x86', 'Building binaries for the x86 architecture')
957 DeclareBit('target_x86', 'Tools being built will process x86 binaries') 962 DeclareBit('target_x86', 'Tools being built will process x86 binaries')
958 963
(...skipping 26 matching lines...) Expand all
985 if env.Bit('build_arm_arm') or env.Bit('build_arm_thumb2'): 990 if env.Bit('build_arm_arm') or env.Bit('build_arm_thumb2'):
986 env.SetBits('build_arm') 991 env.SetBits('build_arm')
987 992
988 if env.Bit('target_x86_32') or env.Bit('target_x86_64'): 993 if env.Bit('target_x86_32') or env.Bit('target_x86_64'):
989 env.SetBits('target_x86') 994 env.SetBits('target_x86')
990 if env.Bit('target_arm_arm') or env.Bit('target_arm_thumb2'): 995 if env.Bit('target_arm_arm') or env.Bit('target_arm_thumb2'):
991 env.SetBits('target_arm') 996 env.SetBits('target_arm')
992 997
993 env.Replace(BUILD_ISA_NAME=GetPlatform('buildplatform')) 998 env.Replace(BUILD_ISA_NAME=GetPlatform('buildplatform'))
994 999
995 if env.Bit('target_arm') and not env.Bit('bitcode'): 1000 if env.Bit('target_arm') or env.Bit('target_mips32'):
996 # This has always been a silent default on ARM. 1001 if not env.Bit('bitcode'):
997 env.SetBits('bitcode') 1002 # This is a silent default on ARM and MIPS.
1003 env.SetBits('bitcode')
998 1004
999 # Determine where the object files go 1005 # Determine where the object files go
1000 if BUILD_NAME == TARGET_NAME: 1006 if BUILD_NAME == TARGET_NAME:
1001 BUILD_TARGET_NAME = TARGET_NAME 1007 BUILD_TARGET_NAME = TARGET_NAME
1002 else: 1008 else:
1003 BUILD_TARGET_NAME = '%s-to-%s' % (BUILD_NAME, TARGET_NAME) 1009 BUILD_TARGET_NAME = '%s-to-%s' % (BUILD_NAME, TARGET_NAME)
1004 env.Replace(BUILD_TARGET_NAME=BUILD_TARGET_NAME) 1010 env.Replace(BUILD_TARGET_NAME=BUILD_TARGET_NAME)
1005 # This may be changed later; see target_variant_map, below. 1011 # This may be changed later; see target_variant_map, below.
1006 env.Replace(TARGET_VARIANT='') 1012 env.Replace(TARGET_VARIANT='')
1007 env.Replace(TARGET_ROOT= 1013 env.Replace(TARGET_ROOT=
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1140
1135 1141
1136 def GetValidator(env, validator): 1142 def GetValidator(env, validator):
1137 # NOTE: that the variable TRUSTED_ENV is set by ExportSpecialFamilyVars() 1143 # NOTE: that the variable TRUSTED_ENV is set by ExportSpecialFamilyVars()
1138 if 'TRUSTED_ENV' not in env: 1144 if 'TRUSTED_ENV' not in env:
1139 return None 1145 return None
1140 1146
1141 if validator is None: 1147 if validator is None:
1142 if env.Bit('build_arm'): 1148 if env.Bit('build_arm'):
1143 validator = 'arm-ncval-core' 1149 validator = 'arm-ncval-core'
1150 elif env.Bit('build_mips32'):
1151 validator = 'mips-ncval-core'
1144 else: 1152 else:
1145 validator = 'ncval' 1153 validator = 'ncval'
1146 1154
1147 trusted_env = env['TRUSTED_ENV'] 1155 trusted_env = env['TRUSTED_ENV']
1148 return trusted_env.File('${STAGING_DIR}/${PROGPREFIX}%s${PROGSUFFIX}' % 1156 return trusted_env.File('${STAGING_DIR}/${PROGPREFIX}%s${PROGSUFFIX}' %
1149 validator) 1157 validator)
1150 1158
1151 1159
1152 # Perform os.path.abspath rooted at the directory SConstruct resides in. 1160 # Perform os.path.abspath rooted at the directory SConstruct resides in.
1153 def SConstructAbsPath(env, path): 1161 def SConstructAbsPath(env, path):
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 if not env.Bit('do_not_run_tests'): 1709 if not env.Bit('do_not_run_tests'):
1702 for action in post_actions: 1710 for action in post_actions:
1703 env.AddPostAction(node, action) 1711 env.AddPostAction(node, action)
1704 return node 1712 return node
1705 1713
1706 pre_base_env.AddMethod(PPAPIBrowserTester) 1714 pre_base_env.AddMethod(PPAPIBrowserTester)
1707 1715
1708 1716
1709 # Disabled for ARM because Chrome binaries for ARM are not available. 1717 # Disabled for ARM because Chrome binaries for ARM are not available.
1710 def PPAPIBrowserTesterIsBroken(env): 1718 def PPAPIBrowserTesterIsBroken(env):
1711 return env.Bit('target_arm') or env.Bit('target_arm_thumb2') 1719 return (env.Bit('target_arm') or env.Bit('target_arm_thumb2')
1720 or env.Bit('target_mips32'))
1712 1721
1713 pre_base_env.AddMethod(PPAPIBrowserTesterIsBroken) 1722 pre_base_env.AddMethod(PPAPIBrowserTesterIsBroken)
1714 1723
1715 # 3D is disabled everywhere 1724 # 3D is disabled everywhere
1716 def PPAPIGraphics3DIsBroken(env): 1725 def PPAPIGraphics3DIsBroken(env):
1717 return True 1726 return True
1718 1727
1719 pre_base_env.AddMethod(PPAPIGraphics3DIsBroken) 1728 pre_base_env.AddMethod(PPAPIGraphics3DIsBroken)
1720 1729
1721 1730
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 # TODO(mseaborn): Fix by retrying the connection or by adding an 1922 # TODO(mseaborn): Fix by retrying the connection or by adding an
1914 # option to ld.so to disable its argv-over-IPC feature. 1923 # option to ld.so to disable its argv-over-IPC feature.
1915 if env.Bit('nacl_glibc') and not env.Bit('nacl_static_link'): 1924 if env.Bit('nacl_glibc') and not env.Bit('nacl_static_link'):
1916 return [] 1925 return []
1917 1926
1918 if sel_universal_flags is None: 1927 if sel_universal_flags is None:
1919 sel_universal_flags = [] 1928 sel_universal_flags = []
1920 1929
1921 # When run under qemu, sel_universal must sneak in qemu to the execv 1930 # When run under qemu, sel_universal must sneak in qemu to the execv
1922 # call that spawns sel_ldr. 1931 # call that spawns sel_ldr.
1923 if env.Bit('target_arm') and env.UsingEmulator(): 1932 if env.UsingEmulator():
1924 sel_universal_flags.append('--command_prefix') 1933 sel_universal_flags.append('--command_prefix')
1925 sel_universal_flags.append(GetEmulator(env)) 1934 sel_universal_flags.append(GetEmulator(env))
1926 1935
1927 if 'TRUSTED_ENV' not in env: 1936 if 'TRUSTED_ENV' not in env:
1928 return [] 1937 return []
1929 sel_universal = env['TRUSTED_ENV'].File( 1938 sel_universal = env['TRUSTED_ENV'].File(
1930 '${STAGING_DIR}/${PROGPREFIX}sel_universal${PROGSUFFIX}') 1939 '${STAGING_DIR}/${PROGPREFIX}sel_universal${PROGSUFFIX}')
1931 1940
1932 # Point to sel_ldr using an environment variable. 1941 # Point to sel_ldr using an environment variable.
1933 sel_ldr = GetSelLdr(env) 1942 sel_ldr = GetSelLdr(env)
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 'tests/unittests/shared/platform/build.scons', 2515 'tests/unittests/shared/platform/build.scons',
2507 'tests/unittests/trusted/asan/build.scons', 2516 'tests/unittests/trusted/asan/build.scons',
2508 'tests/unittests/trusted/platform_qualify/build.scons', 2517 'tests/unittests/trusted/platform_qualify/build.scons',
2509 'tests/unittests/trusted/service_runtime/build.scons', 2518 'tests/unittests/trusted/service_runtime/build.scons',
2510 'installer/build.scons' 2519 'installer/build.scons'
2511 ], ppapi_scons_files['trusted_scons_files']) 2520 ], ppapi_scons_files['trusted_scons_files'])
2512 ) 2521 )
2513 2522
2514 base_env.AddMethod(SDKInstallBin) 2523 base_env.AddMethod(SDKInstallBin)
2515 2524
2516 # The ARM validator can be built for any target that doesn't use ELFCLASS64. 2525 # The ARM and MIPS validators can be built for any target that doesn't use
2526 # ELFCLASS64.
2517 if not base_env.Bit('target_x86_64'): 2527 if not base_env.Bit('target_x86_64'):
2518 base_env.Append( 2528 base_env.Append(
2519 BUILD_SCONSCRIPTS = [ 2529 BUILD_SCONSCRIPTS = [
2520 'src/trusted/validator_arm/build.scons', 2530 'src/trusted/validator_arm/build.scons',
2531 'src/trusted/validator_mips/build.scons',
2521 ]) 2532 ])
2522 2533
2523 base_env.Replace( 2534 base_env.Replace(
2524 NACL_BUILD_FAMILY = 'TRUSTED', 2535 NACL_BUILD_FAMILY = 'TRUSTED',
2525 ) 2536 )
2526 2537
2527 # Add optional scons files if present in the directory tree. 2538 # Add optional scons files if present in the directory tree.
2528 if os.path.exists(pre_base_env.subst('${MAIN_DIR}/supplement/build.scons')): 2539 if os.path.exists(pre_base_env.subst('${MAIN_DIR}/supplement/build.scons')):
2529 base_env.Append(BUILD_SCONSCRIPTS=['${MAIN_DIR}/supplement/build.scons']) 2540 base_env.Append(BUILD_SCONSCRIPTS=['${MAIN_DIR}/supplement/build.scons'])
2530 2541
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 '-isystem', 2903 '-isystem',
2893 jail + '/usr/include', 2904 jail + '/usr/include',
2894 ]) 2905 ])
2895 # /usr/lib makes sense for most configuration except this one 2906 # /usr/lib makes sense for most configuration except this one
2896 # No ARM compatible libs can be found there. 2907 # No ARM compatible libs can be found there.
2897 # So this just makes the command lines longer and sometimes results 2908 # So this just makes the command lines longer and sometimes results
2898 # in linker warnings referring to this directory. 2909 # in linker warnings referring to this directory.
2899 linux_env.FilterOut(LIBPATH=['/usr/lib']) 2910 linux_env.FilterOut(LIBPATH=['/usr/lib'])
2900 # This appears to be needed for sel_universal 2911 # This appears to be needed for sel_universal
2901 linux_env.Append(LIBS=['dl']) 2912 linux_env.Append(LIBS=['dl'])
2913 elif linux_env.Bit('build_mips32'):
2914 pass
Nick Bray (chromium) 2012/04/27 19:41:33 Nit: are there TODOs?
2902 else: 2915 else:
2903 Banner('Strange platform: %s' % BUILD_NAME) 2916 Banner('Strange platform: %s' % BUILD_NAME)
2904 2917
2905 # These are desireable options for every Linux platform: 2918 # These are desireable options for every Linux platform:
2906 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions 2919 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions
2907 # -fPIE/-pie: create a position-independent executable 2920 # -fPIE/-pie: create a position-independent executable
2908 # relro/now: "hardening" options for linking 2921 # relro/now: "hardening" options for linking
2909 # noexecstack: ensure that the executable does not get a PT_GNU_STACK 2922 # noexecstack: ensure that the executable does not get a PT_GNU_STACK
2910 # header that causes the kernel to set the READ_IMPLIES_EXEC 2923 # header that causes the kernel to set the READ_IMPLIES_EXEC
2911 # personality flag, which disables NX page protection. 2924 # personality flag, which disables NX page protection.
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 nacl_env.ValidateSdk() 3800 nacl_env.ValidateSdk()
3788 3801
3789 if BROKEN_TEST_COUNT > 0: 3802 if BROKEN_TEST_COUNT > 0:
3790 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3803 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3791 if GetOption('brief_comstr'): 3804 if GetOption('brief_comstr'):
3792 msg += " Add --verbose to the command line for more information." 3805 msg += " Add --verbose to the command line for more information."
3793 print msg 3806 print msg
3794 3807
3795 # separate warnings from actual build output 3808 # separate warnings from actual build output
3796 Banner('B U I L D - O U T P U T:') 3809 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | pnacl/build.sh » ('j') | pnacl/build.sh » ('J')

Powered by Google App Engine
This is Rietveld 408576698