Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to webmaster@scons.org. Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).

Alternate Proposal for configuring platforms and tools

This is based on PlatformToolConfig by Greg Noel. This is partly an extension of the ideas in that page and partly an exploration of a different direction to see where it leads. Like PlatformToolConfig, it's quite preliminary and exploratory. Comments welcomed!

Starting with a gnu-style config-vendor-os triple is a fine idea. Some tools won't care about parts of that triple, so a function to match with wildcards will be handy.

In my experience, trying to set up tables and complex rules for configuring tools never works that well. There are too many exceptions and special cases. What I advocate here is just a hierarchy of lists of functions, each of which can be overridden by the user. Customizability is the key. SCons should have a default set of these function lists per known platform, and users should be able to override them by name (in a site_scons/site_init.py file).

Here's a sample for explicitness:

   1 class AboutPlatformAndTools:
   2   def __init__(self, platform):
   3     if platform == 'i686-pc-linux-gnu':
   4       AllTools={CC_Toolchain, Fortran_Toolchain, 'latex', 'm4' }
   5       CC_Toolchain = {ToolRequired(ToolAlternate('intelc', 'gcc'))}
   6       Fortran_Toolchain = {ToolAlternate(...)}

The idea is that the tool lists contain either other lists (which are recursed into) or strings, which are traditional tool names. ToolAlternate creates a callable class that looks like a tool that picks the first existing tool from its arguments. ToolRequired makes a tool "required" by raising an error if its tool argument is missing (exists() returns 0). Normally, missing tools are silently ignored. The Environment constructor just goes through AllTools and applies each tool found to the environment using its generate() method (or just calling the function if it's a TOOL_XXX(env) function rather than a string, I guess -- functions like this should be assumed to always exist.)

The toolchain names defined in AboutPlatformAndTools are standardized and documented, so if a user wants a definite C compiler and some additional tools, they just override in their site_init.py:

   1 if platform == 'win32': # what's the gnu string for this?
   2   AboutPlatformAndTools.CC_Toolchain = {'mingw', 'fail'}
   3 AboutPlatformAndTools.AllTools.append('java')

Some notes:


Comments here:

PlatformToolConfigAlt (last edited 2008-03-12 02:46:58 by localhost)