SConstruct (6120:4dcea6c903fa) SConstruct (6121:18aff7f548c1)
1# -*- mode:python -*-
2
3# Copyright (c) 2009 The Hewlett-Packard Development Company
4# Copyright (c) 2004-2005 The Regents of The University of Michigan
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are

--- 144 unchanged lines hidden (view full) ---

153 if n1 > n2: return 1
154 # all corresponding values are equal... see if one has extra values
155 if len(v1) < len(v2): return -1
156 if len(v1) > len(v2): return 1
157 return 0
158
159########################################################################
160#
1# -*- mode:python -*-
2
3# Copyright (c) 2009 The Hewlett-Packard Development Company
4# Copyright (c) 2004-2005 The Regents of The University of Michigan
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are

--- 144 unchanged lines hidden (view full) ---

153 if n1 > n2: return 1
154 # all corresponding values are equal... see if one has extra values
155 if len(v1) < len(v2): return -1
156 if len(v1) > len(v2): return 1
157 return 0
158
159########################################################################
160#
161# Set up the base build environment.
161# Set up the main build environment.
162#
163########################################################################
164use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 'PATH',
165 'RANLIB' ])
166
167use_env = {}
168for key,val in os.environ.iteritems():
169 if key in use_vars or key.startswith("M5"):
170 use_env[key] = val
171
162#
163########################################################################
164use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 'PATH',
165 'RANLIB' ])
166
167use_env = {}
168for key,val in os.environ.iteritems():
169 if key in use_vars or key.startswith("M5"):
170 use_env[key] = val
171
172env = Environment(ENV=use_env)
173env.root = Dir(".") # The current directory (where this file lives).
174env.srcdir = Dir("src") # The source directory
172main = Environment(ENV=use_env)
173main.root = Dir(".") # The current directory (where this file lives).
174main.srcdir = Dir("src") # The source directory
175
176########################################################################
177#
178# Mercurial Stuff.
179#
180# If the M5 directory is a mercurial repository, we should do some
181# extra things.
182#
183########################################################################
184
175
176########################################################################
177#
178# Mercurial Stuff.
179#
180# If the M5 directory is a mercurial repository, we should do some
181# extra things.
182#
183########################################################################
184
185hgdir = env.root.Dir(".hg")
185hgdir = main.root.Dir(".hg")
186
187mercurial_style_message = """
188You're missing the M5 style hook.
189Please install the hook so we can ensure that all code fits a common style.
190
191All you'd need to do is add the following lines to your repository .hg/hgrc
192or your personal .hgrc
193----------------
194
195[extensions]
196style = %s/util/style.py
197
198[hooks]
199pretxncommit.style = python:style.check_whitespace
186
187mercurial_style_message = """
188You're missing the M5 style hook.
189Please install the hook so we can ensure that all code fits a common style.
190
191All you'd need to do is add the following lines to your repository .hg/hgrc
192or your personal .hgrc
193----------------
194
195[extensions]
196style = %s/util/style.py
197
198[hooks]
199pretxncommit.style = python:style.check_whitespace
200""" % (env.root)
200""" % (main.root)
201
202mercurial_bin_not_found = """
203Mercurial binary cannot be found, unfortunately this means that we
204cannot easily determine the version of M5 that you are running and
205this makes error messages more difficult to collect. Please consider
206installing mercurial if you choose to post an error message
207"""
208
209mercurial_lib_not_found = """
210Mercurial libraries cannot be found, ignoring style hook
211If you are actually a M5 developer, please fix this and
212run the style hook. It is important.
213"""
214
215hg_info = "Unknown"
216if hgdir.exists():
217 # 1) Grab repository revision if we know it.
218 cmd = "hg id -n -i -t -b"
219 try:
201
202mercurial_bin_not_found = """
203Mercurial binary cannot be found, unfortunately this means that we
204cannot easily determine the version of M5 that you are running and
205this makes error messages more difficult to collect. Please consider
206installing mercurial if you choose to post an error message
207"""
208
209mercurial_lib_not_found = """
210Mercurial libraries cannot be found, ignoring style hook
211If you are actually a M5 developer, please fix this and
212run the style hook. It is important.
213"""
214
215hg_info = "Unknown"
216if hgdir.exists():
217 # 1) Grab repository revision if we know it.
218 cmd = "hg id -n -i -t -b"
219 try:
220 hg_info = read_command(cmd, cwd=env.root.abspath).strip()
220 hg_info = read_command(cmd, cwd=main.root.abspath).strip()
221 except OSError:
222 print mercurial_bin_not_found
223
224 # 2) Ensure that the style hook is in place.
225 try:
226 ui = None
227 if ARGUMENTS.get('IGNORE_STYLE') != 'True':
228 from mercurial import ui

--- 5 unchanged lines hidden (view full) ---

234 ui.readconfig(hgdir.File('hgrc').abspath)
235 style_hook = ui.config('hooks', 'pretxncommit.style', None)
236
237 if not style_hook:
238 print mercurial_style_message
239 sys.exit(1)
240else:
241 print ".hg directory not found"
221 except OSError:
222 print mercurial_bin_not_found
223
224 # 2) Ensure that the style hook is in place.
225 try:
226 ui = None
227 if ARGUMENTS.get('IGNORE_STYLE') != 'True':
228 from mercurial import ui

--- 5 unchanged lines hidden (view full) ---

234 ui.readconfig(hgdir.File('hgrc').abspath)
235 style_hook = ui.config('hooks', 'pretxncommit.style', None)
236
237 if not style_hook:
238 print mercurial_style_message
239 sys.exit(1)
240else:
241 print ".hg directory not found"
242env['HG_INFO'] = hg_info
243
242
243main['HG_INFO'] = hg_info
244
244###################################################
245#
246# Figure out which configurations to set up based on the path(s) of
247# the target(s).
248#
249###################################################
250
251# Find default configuration & binary.

--- 16 unchanged lines hidden (view full) ---

268if COMMAND_LINE_TARGETS:
269 # Ask SCons which directory it was invoked from
270 launch_dir = GetLaunchDir()
271 # Make targets relative to invocation directory
272 abs_targets = [ normpath(joinpath(launch_dir, str(x))) for x in \
273 COMMAND_LINE_TARGETS]
274else:
275 # Default targets are relative to root of tree
245###################################################
246#
247# Figure out which configurations to set up based on the path(s) of
248# the target(s).
249#
250###################################################
251
252# Find default configuration & binary.

--- 16 unchanged lines hidden (view full) ---

269if COMMAND_LINE_TARGETS:
270 # Ask SCons which directory it was invoked from
271 launch_dir = GetLaunchDir()
272 # Make targets relative to invocation directory
273 abs_targets = [ normpath(joinpath(launch_dir, str(x))) for x in \
274 COMMAND_LINE_TARGETS]
275else:
276 # Default targets are relative to root of tree
276 abs_targets = [ normpath(joinpath(env.root.abspath, str(x))) for x in \
277 abs_targets = [ normpath(joinpath(main.root.abspath, str(x))) for x in \
277 DEFAULT_TARGETS]
278
279
280# Generate a list of the unique build roots and configs that the
281# collected targets reference.
282variant_paths = []
283build_root = None
284for t in abs_targets:

--- 14 unchanged lines hidden (view full) ---

299 variant_path = joinpath('/',*path_dirs[:build_top+2])
300 if variant_path not in variant_paths:
301 variant_paths.append(variant_path)
302
303# Make sure build_root exists (might not if this is the first build there)
304if not isdir(build_root):
305 mkdir(build_root)
306
278 DEFAULT_TARGETS]
279
280
281# Generate a list of the unique build roots and configs that the
282# collected targets reference.
283variant_paths = []
284build_root = None
285for t in abs_targets:

--- 14 unchanged lines hidden (view full) ---

300 variant_path = joinpath('/',*path_dirs[:build_top+2])
301 if variant_path not in variant_paths:
302 variant_paths.append(variant_path)
303
304# Make sure build_root exists (might not if this is the first build there)
305if not isdir(build_root):
306 mkdir(build_root)
307
307Export('env')
308Export('main')
308
309
309env.SConsignFile(joinpath(build_root, "sconsign"))
310main.SConsignFile(joinpath(build_root, "sconsign"))
310
311# Default duplicate option is to use hard links, but this messes up
312# when you use emacs to edit a file in the target dir, as emacs moves
313# file to file~ then copies to file, breaking the link. Symbolic
314# (soft) links work better.
311
312# Default duplicate option is to use hard links, but this messes up
313# when you use emacs to edit a file in the target dir, as emacs moves
314# file to file~ then copies to file, breaking the link. Symbolic
315# (soft) links work better.
315env.SetOption('duplicate', 'soft-copy')
316main.SetOption('duplicate', 'soft-copy')
316
317#
318# Set up global sticky variables... these are common to an entire build
319# tree (not specific to a particular build like ALPHA_SE)
320#
321
322# Variable validators & converters for global sticky variables
323def PathListMakeAbsolute(val):

--- 10 unchanged lines hidden (view full) ---

334 if not isdir(path):
335 raise SCons.Errors.UserError("Path does not exist: '%s'" % path)
336
337global_sticky_vars_file = joinpath(build_root, 'variables.global')
338
339global_sticky_vars = Variables(global_sticky_vars_file, args=ARGUMENTS)
340
341global_sticky_vars.AddVariables(
317
318#
319# Set up global sticky variables... these are common to an entire build
320# tree (not specific to a particular build like ALPHA_SE)
321#
322
323# Variable validators & converters for global sticky variables
324def PathListMakeAbsolute(val):

--- 10 unchanged lines hidden (view full) ---

335 if not isdir(path):
336 raise SCons.Errors.UserError("Path does not exist: '%s'" % path)
337
338global_sticky_vars_file = joinpath(build_root, 'variables.global')
339
340global_sticky_vars = Variables(global_sticky_vars_file, args=ARGUMENTS)
341
342global_sticky_vars.AddVariables(
342 ('CC', 'C compiler', environ.get('CC', env['CC'])),
343 ('CXX', 'C++ compiler', environ.get('CXX', env['CXX'])),
343 ('CC', 'C compiler', environ.get('CC', main['CC'])),
344 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
344 ('BATCH', 'Use batch pool for build and tests', False),
345 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
346 ('EXTRAS', 'Add Extra directories to the compilation', '',
347 PathListAllExist, PathListMakeAbsolute)
348 )
349
350# base help text
351help_text = '''
352Usage: scons [scons options] [build options] [target(s)]
353
354Global sticky options:
355'''
356
345 ('BATCH', 'Use batch pool for build and tests', False),
346 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
347 ('EXTRAS', 'Add Extra directories to the compilation', '',
348 PathListAllExist, PathListMakeAbsolute)
349 )
350
351# base help text
352help_text = '''
353Usage: scons [scons options] [build options] [target(s)]
354
355Global sticky options:
356'''
357
357help_text += global_sticky_vars.GenerateHelpText(env)
358help_text += global_sticky_vars.GenerateHelpText(main)
358
359
359# Update env with values from ARGUMENTS & file global_sticky_vars_file
360global_sticky_vars.Update(env)
360# Update main environment with values from ARGUMENTS & global_sticky_vars_file
361global_sticky_vars.Update(main)
361
362# Save sticky variable settings back to current variables file
362
363# Save sticky variable settings back to current variables file
363global_sticky_vars.Save(global_sticky_vars_file, env)
364global_sticky_vars.Save(global_sticky_vars_file, main)
364
365# Parse EXTRAS variable to build list of all directories where we're
366# look for sources etc. This list is exported as base_dir_list.
365
366# Parse EXTRAS variable to build list of all directories where we're
367# look for sources etc. This list is exported as base_dir_list.
367base_dir = env.srcdir.abspath
368if env['EXTRAS']:
369 extras_dir_list = env['EXTRAS'].split(':')
368base_dir = main.srcdir.abspath
369if main['EXTRAS']:
370 extras_dir_list = main['EXTRAS'].split(':')
370else:
371 extras_dir_list = []
372
373Export('base_dir')
374Export('extras_dir_list')
375
376# the ext directory should be on the #includes path
371else:
372 extras_dir_list = []
373
374Export('base_dir')
375Export('extras_dir_list')
376
377# the ext directory should be on the #includes path
377env.Append(CPPPATH=[Dir('ext')])
378main.Append(CPPPATH=[Dir('ext')])
378
379# M5_PLY is used by isa_parser.py to find the PLY package.
379
380# M5_PLY is used by isa_parser.py to find the PLY package.
380env.Append(ENV = { 'M5_PLY' : Dir('ext/ply').abspath })
381main.Append(ENV = { 'M5_PLY' : Dir('ext/ply').abspath })
381
382
382CXX_version = read_command([env['CXX'],'--version'], exception=False)
383CXX_V = read_command([env['CXX'],'-V'], exception=False)
383CXX_version = read_command([main['CXX'],'--version'], exception=False)
384CXX_V = read_command([main['CXX'],'-V'], exception=False)
384
385
385env['GCC'] = CXX_version and CXX_version.find('g++') >= 0
386env['SUNCC'] = CXX_V and CXX_V.find('Sun C++') >= 0
387env['ICC'] = CXX_V and CXX_V.find('Intel') >= 0
388if env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
386main['GCC'] = CXX_version and CXX_version.find('g++') >= 0
387main['SUNCC'] = CXX_V and CXX_V.find('Sun C++') >= 0
388main['ICC'] = CXX_V and CXX_V.find('Intel') >= 0
389if main['GCC'] + main['SUNCC'] + main['ICC'] > 1:
389 print 'Error: How can we have two at the same time?'
390 Exit(1)
391
392# Set up default C++ compiler flags
390 print 'Error: How can we have two at the same time?'
391 Exit(1)
392
393# Set up default C++ compiler flags
393if env['GCC']:
394 env.Append(CCFLAGS='-pipe')
395 env.Append(CCFLAGS='-fno-strict-aliasing')
396 env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
397 env.Append(CXXFLAGS='-Wno-deprecated')
398elif env['ICC']:
394if main['GCC']:
395 main.Append(CCFLAGS='-pipe')
396 main.Append(CCFLAGS='-fno-strict-aliasing')
397 main.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
398 main.Append(CXXFLAGS='-Wno-deprecated')
399elif main['ICC']:
399 pass #Fix me... add warning flags once we clean up icc warnings
400 pass #Fix me... add warning flags once we clean up icc warnings
400elif env['SUNCC']:
401 env.Append(CCFLAGS='-Qoption ccfe')
402 env.Append(CCFLAGS='-features=gcc')
403 env.Append(CCFLAGS='-features=extensions')
404 env.Append(CCFLAGS='-library=stlport4')
405 env.Append(CCFLAGS='-xar')
406 #env.Append(CCFLAGS='-instances=semiexplicit')
401elif main['SUNCC']:
402 main.Append(CCFLAGS='-Qoption ccfe')
403 main.Append(CCFLAGS='-features=gcc')
404 main.Append(CCFLAGS='-features=extensions')
405 main.Append(CCFLAGS='-library=stlport4')
406 main.Append(CCFLAGS='-xar')
407 #main.Append(CCFLAGS='-instances=semiexplicit')
407else:
408 print 'Error: Don\'t know what compiler options to use for your compiler.'
409 print ' Please fix SConstruct and src/SConscript and try again.'
410 Exit(1)
411
412# Do this after we save setting back, or else we'll tack on an
413# extra 'qdo' every time we run scons.
408else:
409 print 'Error: Don\'t know what compiler options to use for your compiler.'
410 print ' Please fix SConstruct and src/SConscript and try again.'
411 Exit(1)
412
413# Do this after we save setting back, or else we'll tack on an
414# extra 'qdo' every time we run scons.
414if env['BATCH']:
415 env['CC'] = env['BATCH_CMD'] + ' ' + env['CC']
416 env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
417 env['AS'] = env['BATCH_CMD'] + ' ' + env['AS']
418 env['AR'] = env['BATCH_CMD'] + ' ' + env['AR']
419 env['RANLIB'] = env['BATCH_CMD'] + ' ' + env['RANLIB']
415if main['BATCH']:
416 main['CC'] = main['BATCH_CMD'] + ' ' + main['CC']
417 main['CXX'] = main['BATCH_CMD'] + ' ' + main['CXX']
418 main['AS'] = main['BATCH_CMD'] + ' ' + main['AS']
419 main['AR'] = main['BATCH_CMD'] + ' ' + main['AR']
420 main['RANLIB'] = main['BATCH_CMD'] + ' ' + main['RANLIB']
420
421if sys.platform == 'cygwin':
422 # cygwin has some header file issues...
421
422if sys.platform == 'cygwin':
423 # cygwin has some header file issues...
423 env.Append(CCFLAGS=Split("-Wno-uninitialized"))
424 main.Append(CCFLAGS=Split("-Wno-uninitialized"))
424
425# Check for SWIG
425
426# Check for SWIG
426if not env.has_key('SWIG'):
427if not main.has_key('SWIG'):
427 print 'Error: SWIG utility not found.'
428 print ' Please install (see http://www.swig.org) and retry.'
429 Exit(1)
430
431# Check for appropriate SWIG version
432swig_version = read_command(('swig', '-version'), exception='').split()
433# First 3 words should be "SWIG Version x.y.z"
434if len(swig_version) < 3 or \

--- 4 unchanged lines hidden (view full) ---

439min_swig_version = '1.3.28'
440if compare_versions(swig_version[2], min_swig_version) < 0:
441 print 'Error: SWIG version', min_swig_version, 'or newer required.'
442 print ' Installed version:', swig_version[2]
443 Exit(1)
444
445# Set up SWIG flags & scanner
446swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
428 print 'Error: SWIG utility not found.'
429 print ' Please install (see http://www.swig.org) and retry.'
430 Exit(1)
431
432# Check for appropriate SWIG version
433swig_version = read_command(('swig', '-version'), exception='').split()
434# First 3 words should be "SWIG Version x.y.z"
435if len(swig_version) < 3 or \

--- 4 unchanged lines hidden (view full) ---

440min_swig_version = '1.3.28'
441if compare_versions(swig_version[2], min_swig_version) < 0:
442 print 'Error: SWIG version', min_swig_version, 'or newer required.'
443 print ' Installed version:', swig_version[2]
444 Exit(1)
445
446# Set up SWIG flags & scanner
447swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
447env.Append(SWIGFLAGS=swig_flags)
448main.Append(SWIGFLAGS=swig_flags)
448
449# filter out all existing swig scanners, they mess up the dependency
450# stuff for some reason
451scanners = []
449
450# filter out all existing swig scanners, they mess up the dependency
451# stuff for some reason
452scanners = []
452for scanner in env['SCANNERS']:
453for scanner in main['SCANNERS']:
453 skeys = scanner.skeys
454 if skeys == '.i':
455 continue
456
457 if isinstance(skeys, (list, tuple)) and '.i' in skeys:
458 continue
459
460 scanners.append(scanner)
461
462# add the new swig scanner that we like better
463from SCons.Scanner import ClassicCPP as CPPScanner
464swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
465scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
466
467# replace the scanners list that has what we want
454 skeys = scanner.skeys
455 if skeys == '.i':
456 continue
457
458 if isinstance(skeys, (list, tuple)) and '.i' in skeys:
459 continue
460
461 scanners.append(scanner)
462
463# add the new swig scanner that we like better
464from SCons.Scanner import ClassicCPP as CPPScanner
465swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
466scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
467
468# replace the scanners list that has what we want
468env['SCANNERS'] = scanners
469main['SCANNERS'] = scanners
469
470# Add a custom Check function to the Configure context so that we can
471# figure out if the compiler adds leading underscores to global
472# variables. This is needed for the autogenerated asm files that we
473# use for embedding the python code.
474def CheckLeading(context):
475 context.Message("Checking for leading underscore in global variables...")
476 # 1) Define a global variable called x from asm so the C compiler

--- 13 unchanged lines hidden (view full) ---

490 int main() { return x; }
491 ''', extension=".c")
492 context.env.Append(LEADING_UNDERSCORE=ret)
493 context.Result(ret)
494 return ret
495
496# Platform-specific configuration. Note again that we assume that all
497# builds under a given build root run on the same host platform.
470
471# Add a custom Check function to the Configure context so that we can
472# figure out if the compiler adds leading underscores to global
473# variables. This is needed for the autogenerated asm files that we
474# use for embedding the python code.
475def CheckLeading(context):
476 context.Message("Checking for leading underscore in global variables...")
477 # 1) Define a global variable called x from asm so the C compiler

--- 13 unchanged lines hidden (view full) ---

491 int main() { return x; }
492 ''', extension=".c")
493 context.env.Append(LEADING_UNDERSCORE=ret)
494 context.Result(ret)
495 return ret
496
497# Platform-specific configuration. Note again that we assume that all
498# builds under a given build root run on the same host platform.
498conf = Configure(env,
499conf = Configure(main,
499 conf_dir = joinpath(build_root, '.scons_config'),
500 log_file = joinpath(build_root, 'scons_config.log'),
501 custom_tests = { 'CheckLeading' : CheckLeading })
502
503# Check for leading underscores. Don't really need to worry either
504# way so don't need to check the return code.
505conf.CheckLeading()
506
507# Check if we should compile a 64 bit binary on Mac OS X/Darwin
508try:
509 import platform
510 uname = platform.uname()
511 if uname[0] == 'Darwin' and compare_versions(uname[2], '9.0.0') >= 0:
512 if int(read_command('sysctl -n hw.cpu64bit_capable')[0]):
500 conf_dir = joinpath(build_root, '.scons_config'),
501 log_file = joinpath(build_root, 'scons_config.log'),
502 custom_tests = { 'CheckLeading' : CheckLeading })
503
504# Check for leading underscores. Don't really need to worry either
505# way so don't need to check the return code.
506conf.CheckLeading()
507
508# Check if we should compile a 64 bit binary on Mac OS X/Darwin
509try:
510 import platform
511 uname = platform.uname()
512 if uname[0] == 'Darwin' and compare_versions(uname[2], '9.0.0') >= 0:
513 if int(read_command('sysctl -n hw.cpu64bit_capable')[0]):
513 env.Append(CCFLAGS='-arch x86_64')
514 env.Append(CFLAGS='-arch x86_64')
515 env.Append(LINKFLAGS='-arch x86_64')
516 env.Append(ASFLAGS='-arch x86_64')
514 main.Append(CCFLAGS='-arch x86_64')
515 main.Append(CFLAGS='-arch x86_64')
516 main.Append(LINKFLAGS='-arch x86_64')
517 main.Append(ASFLAGS='-arch x86_64')
517except:
518 pass
519
520# Recent versions of scons substitute a "Null" object for Configure()
521# when configuration isn't necessary, e.g., if the "--help" option is
522# present. Unfortuantely this Null object always returns false,
523# breaking all our configuration checks. We replace it with our own
524# more optimistic null object that returns True instead.

--- 4 unchanged lines hidden (view full) ---

529 class NullConf:
530 def __init__(self, env):
531 self.env = env
532 def Finish(self):
533 return self.env
534 def __getattr__(self, mname):
535 return NullCheck
536
518except:
519 pass
520
521# Recent versions of scons substitute a "Null" object for Configure()
522# when configuration isn't necessary, e.g., if the "--help" option is
523# present. Unfortuantely this Null object always returns false,
524# breaking all our configuration checks. We replace it with our own
525# more optimistic null object that returns True instead.

--- 4 unchanged lines hidden (view full) ---

530 class NullConf:
531 def __init__(self, env):
532 self.env = env
533 def Finish(self):
534 return self.env
535 def __getattr__(self, mname):
536 return NullCheck
537
537 conf = NullConf(env)
538 conf = NullConf(main)
538
539# Find Python include and library directories for embedding the
540# interpreter. For consistency, we will use the same Python
541# installation used to run scons (and thus this script). If you want
542# to link in an alternate version, see above for instructions on how
543# to invoke scons with a different copy of the Python interpreter.
544from distutils import sysconfig
545

--- 16 unchanged lines hidden (view full) ---

562py_libs = []
563for lib in py_getvar('LIBS').split() + py_getvar('SYSLIBS').split():
564 assert lib.startswith('-l')
565 lib = lib[2:]
566 if lib not in py_libs:
567 py_libs.append(lib)
568py_libs.append(py_version)
569
539
540# Find Python include and library directories for embedding the
541# interpreter. For consistency, we will use the same Python
542# installation used to run scons (and thus this script). If you want
543# to link in an alternate version, see above for instructions on how
544# to invoke scons with a different copy of the Python interpreter.
545from distutils import sysconfig
546

--- 16 unchanged lines hidden (view full) ---

563py_libs = []
564for lib in py_getvar('LIBS').split() + py_getvar('SYSLIBS').split():
565 assert lib.startswith('-l')
566 lib = lib[2:]
567 if lib not in py_libs:
568 py_libs.append(lib)
569py_libs.append(py_version)
570
570env.Append(CPPPATH=py_includes)
571env.Append(LIBPATH=py_lib_path)
571main.Append(CPPPATH=py_includes)
572main.Append(LIBPATH=py_lib_path)
572
573# verify that this stuff works
574if not conf.CheckHeader('Python.h', '<>'):
575 print "Error: can't find Python.h header in", py_includes
576 Exit(1)
577
578for lib in py_libs:
579 if not conf.CheckLib(lib):

--- 45 unchanged lines hidden (view full) ---

625 mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
626 # This seems to work in all versions
627 mysql_config_libs = mysql_config + ' --libs'
628
629######################################################################
630#
631# Finish the configuration
632#
573
574# verify that this stuff works
575if not conf.CheckHeader('Python.h', '<>'):
576 print "Error: can't find Python.h header in", py_includes
577 Exit(1)
578
579for lib in py_libs:
580 if not conf.CheckLib(lib):

--- 45 unchanged lines hidden (view full) ---

626 mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
627 # This seems to work in all versions
628 mysql_config_libs = mysql_config + ' --libs'
629
630######################################################################
631#
632# Finish the configuration
633#
633env = conf.Finish()
634main = conf.Finish()
634
635######################################################################
636#
637# Collect all non-global variables
638#
639
635
636######################################################################
637#
638# Collect all non-global variables
639#
640
640Export('env')
641
642# Define the universe of supported ISAs
643all_isa_list = [ ]
644Export('all_isa_list')
645
646# Define the universe of supported CPU models
647all_cpu_list = [ ]
648default_cpus = [ ]
649Export('all_cpu_list', 'default_cpus')

--- 95 unchanged lines hidden (view full) ---

745 elif isinstance(val, str):
746 val = '"' + val + '"'
747
748 # Sources are variable name & value (packaged in SCons Value nodes)
749 return ([target], [Value(variable), Value(val)])
750
751config_builder = Builder(emitter = config_emitter, action = config_action)
752
641# Define the universe of supported ISAs
642all_isa_list = [ ]
643Export('all_isa_list')
644
645# Define the universe of supported CPU models
646all_cpu_list = [ ]
647default_cpus = [ ]
648Export('all_cpu_list', 'default_cpus')

--- 95 unchanged lines hidden (view full) ---

744 elif isinstance(val, str):
745 val = '"' + val + '"'
746
747 # Sources are variable name & value (packaged in SCons Value nodes)
748 return ([target], [Value(variable), Value(val)])
749
750config_builder = Builder(emitter = config_emitter, action = config_action)
751
753env.Append(BUILDERS = { 'ConfigFile' : config_builder })
752main.Append(BUILDERS = { 'ConfigFile' : config_builder })
754
755# libelf build is shared across all configs in the build root.
753
754# libelf build is shared across all configs in the build root.
756env.SConscript('ext/libelf/SConscript',
757 variant_dir = joinpath(build_root, 'libelf'))
755main.SConscript('ext/libelf/SConscript',
756 variant_dir = joinpath(build_root, 'libelf'))
758
759# gzstream build is shared across all configs in the build root.
757
758# gzstream build is shared across all configs in the build root.
760env.SConscript('ext/gzstream/SConscript',
761 variant_dir = joinpath(build_root, 'gzstream'))
759main.SConscript('ext/gzstream/SConscript',
760 variant_dir = joinpath(build_root, 'gzstream'))
762
763###################################################
764#
765# This function is used to set up a directory with switching headers
766#
767###################################################
768
761
762###################################################
763#
764# This function is used to set up a directory with switching headers
765#
766###################################################
767
769env['ALL_ISA_LIST'] = all_isa_list
768main['ALL_ISA_LIST'] = all_isa_list
770def make_switching_dir(dname, switch_headers, env):
771 # Generate the header. target[0] is the full path of the output
772 # header to generate. 'source' is a dummy variable, since we get the
773 # list of ISAs from env['ALL_ISA_LIST'].
774 def gen_switch_hdr(target, source, env):
775 fname = str(target[0])
776 bname = basename(fname)
777 f = open(fname, 'w')

--- 23 unchanged lines hidden (view full) ---

801Export('make_switching_dir')
802
803###################################################
804#
805# Define build environments for selected configurations.
806#
807###################################################
808
769def make_switching_dir(dname, switch_headers, env):
770 # Generate the header. target[0] is the full path of the output
771 # header to generate. 'source' is a dummy variable, since we get the
772 # list of ISAs from env['ALL_ISA_LIST'].
773 def gen_switch_hdr(target, source, env):
774 fname = str(target[0])
775 bname = basename(fname)
776 f = open(fname, 'w')

--- 23 unchanged lines hidden (view full) ---

800Export('make_switching_dir')
801
802###################################################
803#
804# Define build environments for selected configurations.
805#
806###################################################
807
809# rename base env
810base_env = env
811
812for variant_path in variant_paths:
813 print "Building in", variant_path
814
815 # Make a copy of the build-root environment to use for this config.
808for variant_path in variant_paths:
809 print "Building in", variant_path
810
811 # Make a copy of the build-root environment to use for this config.
816 env = base_env.Clone()
812 env = main.Clone()
817 env['BUILDDIR'] = variant_path
818
819 # variant_dir is the tail component of build path, and is used to
820 # determine the build parameters (e.g., 'ALPHA_SE')
821 (build_root, variant_dir) = splitpath(variant_path)
822
823 # Set env variables according to the build directory config.
824 sticky_vars.files = []

--- 81 unchanged lines hidden ---
813 env['BUILDDIR'] = variant_path
814
815 # variant_dir is the tail component of build path, and is used to
816 # determine the build parameters (e.g., 'ALPHA_SE')
817 (build_root, variant_dir) = splitpath(variant_path)
818
819 # Set env variables according to the build directory config.
820 sticky_vars.files = []

--- 81 unchanged lines hidden ---