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

Side by Side Diff: SConstruct

Issue 245733002: Added arguments to NaCl scons to allow custom toolchain directories. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Use abspath of environment instead of cwd since cwd can change per test Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | buildbot/buildbot_pnacl.sh » ('j') | no next file with comments »
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 json 7 import json
8 import os 8 import os
9 import platform 9 import platform
10 import re 10 import re
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 # the discussion of why this argument is needed. 141 # the discussion of why this argument is needed.
142 'memcheck_command', 142 'memcheck_command',
143 # If the replacement memcheck command only works for trusted code, 143 # If the replacement memcheck command only works for trusted code,
144 # set memcheck_trusted_only to non-zero. 144 # set memcheck_trusted_only to non-zero.
145 'memcheck_trusted_only', 145 'memcheck_trusted_only',
146 # colon-separated list of linker flags, e.g. "-lfoo:-Wl,-u,bar". 146 # colon-separated list of linker flags, e.g. "-lfoo:-Wl,-u,bar".
147 'nacl_linkflags', 147 'nacl_linkflags',
148 # colon-separated list of pnacl bcld flags, e.g. "-lfoo:-Wl,-u,bar". 148 # colon-separated list of pnacl bcld flags, e.g. "-lfoo:-Wl,-u,bar".
149 # Not using nacl_linkflags since that gets clobbered in some tests. 149 # Not using nacl_linkflags since that gets clobbered in some tests.
150 'pnacl_bcldflags', 150 'pnacl_bcldflags',
151 'naclsdk_mode',
152 'pnaclsdk_mode',
153 'platform', 151 'platform',
154 # Run tests under this tool (e.g. valgrind, tsan, strace, etc). 152 # Run tests under this tool (e.g. valgrind, tsan, strace, etc).
155 # If the tool has options, pass them after comma: 'tool,--opt1,--opt2'. 153 # If the tool has options, pass them after comma: 'tool,--opt1,--opt2'.
156 # NB: no way to use tools the names or the args of 154 # NB: no way to use tools the names or the args of
157 # which contains a comma. 155 # which contains a comma.
158 'run_under', 156 'run_under',
159 # More args for the tool. 157 # More args for the tool.
160 'run_under_extra_args', 158 'run_under_extra_args',
161 # Multiply timeout values by this number. 159 # Multiply timeout values by this number.
162 'scale_timeout', 160 'scale_timeout',
(...skipping 16 matching lines...) Expand all
179 # activates buildbot-specific presets 177 # activates buildbot-specific presets
180 'buildbot', 178 'buildbot',
181 # Where to install header files for public consumption. 179 # Where to install header files for public consumption.
182 'includedir', 180 'includedir',
183 # Where to install libraries for public consumption. 181 # Where to install libraries for public consumption.
184 'libdir', 182 'libdir',
185 # Where to install trusted-code binaries for public (SDK) consumption. 183 # Where to install trusted-code binaries for public (SDK) consumption.
186 'bindir', 184 'bindir',
187 # Where a Breakpad build output directory is for optional Breakpad testing. 185 # Where a Breakpad build output directory is for optional Breakpad testing.
188 'breakpad_tools_dir', 186 'breakpad_tools_dir',
189 # Allows overriding the toolchain to use. The default toolchain will be 187 # Allows overriding of the nacl newlib toolchain directory.
190 # a combination of the other arguments. Example toolchains: 188 'nacl_newlib_dir',
191 # NaCl (newlib): nacl_PLATFORM_newlib 189 # Allows override of the nacl glibc toolchain directory.
192 # NaCl (glibc): nacl_PLATFORM_glibc 190 'nacl_glibc_dir',
193 # pnacl: pnacl_PLATFORM 191 # Allows override of the pnacl newlib toolchain directory.
194 'toolchain', 192 'pnacl_newlib_dir',
195 # Allows overriding the version number in the toolchain's 193 # Allows overriding the version number in the toolchain's
196 # FEATURE_VERSION file. This is used for PNaCl ABI compatibility 194 # FEATURE_VERSION file. This is used for PNaCl ABI compatibility
197 # testing. 195 # testing.
198 'toolchain_feature_version', 196 'toolchain_feature_version',
199 ]) 197 ])
200 198
201 199
202 # Overly general to provide compatibility with existing build bots, etc. 200 # Overly general to provide compatibility with existing build bots, etc.
203 # In the future it might be worth restricting the values that are accepted. 201 # In the future it might be worth restricting the values that are accepted.
204 _TRUE_STRINGS = set(['1', 'true', 'yes']) 202 _TRUE_STRINGS = set(['1', 'true', 'yes'])
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 # Currently 32/64 share the same tool build target directory. When we have 1162 # Currently 32/64 share the same tool build target directory. When we have
1165 # separate toolchains for each the architectures will probably have to use 1163 # separate toolchains for each the architectures will probably have to use
1166 # the Arch3264() variant. 1164 # the Arch3264() variant.
1167 build_arch = pynacl.platform.GetArch(GetBuildPlatform()) 1165 build_arch = pynacl.platform.GetArch(GetBuildPlatform())
1168 1166
1169 return '%s_%s' % (os_name, build_arch) 1167 return '%s_%s' % (os_name, build_arch)
1170 1168
1171 pre_base_env.AddMethod(GetPlatformBuildTargetDir) 1169 pre_base_env.AddMethod(GetPlatformBuildTargetDir)
1172 1170
1173 1171
1174 def GetToolchainName(env, target_arch=None, is_pnacl=None, lib_name=None): 1172 def GetToolchainDir(env, platform_build_dir=None, toolchain_name=None,
1175 toolchain = ARGUMENTS.get('toolchain', None) 1173 target_arch=None, is_pnacl=None, lib_name=None):
1176 if toolchain is None: 1174 if platform_build_dir is None:
1175 platform_build_dir = env.GetPlatformBuildTargetDir()
1176
1177 if toolchain_name is None:
1178 # Fill in default arguments based on environment.
1177 if is_pnacl is None: 1179 if is_pnacl is None:
1178 is_pnacl = env.Bit('bitcode') 1180 is_pnacl = env.Bit('bitcode')
1179 if lib_name is None: 1181 if lib_name is None:
1180 if is_pnacl or not env.Bit('nacl_glibc'): 1182 if is_pnacl or not env.Bit('nacl_glibc'):
1181 lib_name = 'newlib' 1183 lib_name = 'newlib'
1182 else: 1184 else:
1183 lib_name = 'glibc' 1185 lib_name = 'glibc'
1184 1186
1185 build_arch = pynacl.platform.GetArch(GetBuildPlatform())
1186 if target_arch is None: 1187 if target_arch is None:
1187 target_arch = pynacl.platform.GetArch(GetTargetPlatform()) 1188 target_arch = pynacl.platform.GetArch(GetTargetPlatform())
1188 1189
1189 if is_pnacl: 1190 if is_pnacl:
1190 target_env = 'pnacl' 1191 target_env = 'pnacl'
1191 else: 1192 else:
1192 target_env = 'nacl_%s' % target_arch 1193 target_env = 'nacl_%s' % target_arch
1193 1194
1194 toolchain = '%s_%s' % (target_env, lib_name) 1195 # See if we have a custom toolchain directory set.
1196 if is_pnacl:
1197 toolchain_arg = 'pnacl_%s_dir' % lib_name
1198 else:
1199 toolchain_arg = 'nacl_%s_dir' % lib_name
1195 1200
1196 return toolchain 1201 custom_toolchain_dir = ARGUMENTS.get(toolchain_arg, None)
1202 if custom_toolchain_dir:
1203 return env.SConstructAbsPath(custom_toolchain_dir)
1197 1204
1198 pre_base_env.AddMethod(GetToolchainName) 1205 # Get the standard toolchain name since no directory custom was found.
1206 if is_pnacl:
1207 target_env = 'pnacl'
1208 else:
1209 target_env = 'nacl_%s' % target_arch
1210 toolchain_name = '%s_%s' % (target_env, lib_name)
1199 1211
1200 1212 # Get the absolute path for the platform build directory and toolchain.
1201 def GetToolchainDir(env, platform_build_dir=None, toolchain_name=None): 1213 toolchain_sub_dir = os.path.join('toolchain',
1202 if platform_build_dir is None: 1214 platform_build_dir,
1203 platform_build_dir = env.GetPlatformBuildTargetDir() 1215 toolchain_name)
1204 if toolchain_name is None:
1205 toolchain_name = env.GetToolchainName()
1206
1207 toolchain_sub_dir = os.path.join(
1208 'toolchain',
1209 platform_build_dir,
1210 toolchain_name
1211 )
1212 return env.SConstructAbsPath(toolchain_sub_dir) 1216 return env.SConstructAbsPath(toolchain_sub_dir)
1213 1217
1214 pre_base_env.AddMethod(GetToolchainDir) 1218 pre_base_env.AddMethod(GetToolchainDir)
1215 1219
1216 1220
1217 def GetSelLdr(env): 1221 def GetSelLdr(env):
1218 sel_ldr = ARGUMENTS.get('force_sel_ldr') 1222 sel_ldr = ARGUMENTS.get('force_sel_ldr')
1219 if sel_ldr: 1223 if sel_ldr:
1220 return env.File(env.SConstructAbsPath(sel_ldr)) 1224 return env.File(env.SConstructAbsPath(sel_ldr))
1221 1225
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 * build just libraries: scons build_lib 2239 * build just libraries: scons build_lib
2236 * install just headers: scons install_headers includedir=... 2240 * install just headers: scons install_headers includedir=...
2237 * install just libraries: scons install_lib libdir=... 2241 * install just libraries: scons install_lib libdir=...
2238 * install headers and libraries:scons install includedir=... libdir=... 2242 * install headers and libraries:scons install includedir=... libdir=...
2239 2243
2240 * dump system info: scons --mode=nacl,opt-linux dummy 2244 * dump system info: scons --mode=nacl,opt-linux dummy
2241 2245
2242 Options: 2246 Options:
2243 -------- 2247 --------
2244 2248
2245 naclsdk_mode=<mode> where <mode>:
2246
2247 'local': use locally installed sdk kit
2248 'download': use the download copy (default)
2249 'custom:<path>': use kit at <path>
2250 'manual': use settings from env vars NACL_SDK_xxx
2251
2252 pnaclsdk_mode=<mode> where <mode:
2253 'default': use the default (typically the downloaded copy)
2254 'custom:<path>': use kit from <path>
2255
2256 --prebuilt Do not build things, just do install steps 2249 --prebuilt Do not build things, just do install steps
2257 2250
2258 --verbose Full command line logging before command execution 2251 --verbose Full command line logging before command execution
2259 2252
2260 pp=1 Use command line pretty printing (more concise output) 2253 pp=1 Use command line pretty printing (more concise output)
2261 2254
2262 sysinfo=1 Verbose system info printing 2255 sysinfo=1 Verbose system info printing
2263 2256
2264 naclsdk_validate=0 Suppress presence check of sdk 2257 naclsdk_validate=0 Suppress presence check of sdk
2265 2258
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
3838 nacl_env.ValidateSdk() 3831 nacl_env.ValidateSdk()
3839 3832
3840 if BROKEN_TEST_COUNT > 0: 3833 if BROKEN_TEST_COUNT > 0:
3841 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3834 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3842 if GetOption('brief_comstr'): 3835 if GetOption('brief_comstr'):
3843 msg += " Add --verbose to the command line for more information." 3836 msg += " Add --verbose to the command line for more information."
3844 print msg 3837 print msg
3845 3838
3846 # separate warnings from actual build output 3839 # separate warnings from actual build output
3847 Banner('B U I L D - O U T P U T:') 3840 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | buildbot/buildbot_pnacl.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698