Lumiera  0.pre.03
»edit your freedom«
ToolDistCC.py
1 # coding: utf-8
2 
5 
6 # Copyright (C) Lumiera.org and FreeOrion.org
7 # 2008, Hermann Vosseler <Ichthyostega@web.de>
8 #
9 # **Lumiera** is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the
11 # Free Software Foundation; either version 2 of the License, or (at your
12 # option) any later version. See the file COPYING for further details.
13 
14 
15 # This SCons builder was extracted from http://www.freeorion.org/
16 # FreeOrion is an open-source platform-independent galactic conquest game
17 #
18 # history: 12/2008 adapted for Lumiera build system
19 
20 
21 import os
22 from Buildhelper import *
23 
24 
25 def generate(env):
26  """ Modify the environment such as to redirect any
27  C/C++ compiler invocations through DistCC. Additionally
28  pull in the environment config variables used by DistCC
29  """
30  if not exists(env): return
31 
32  assert env['DISTCC']
33  if not env['DISTCC'] in env['CC']:
34  env['CC'] = env.subst('$DISTCC $CC')
35  if not env['DISTCC'] in env['CXX']:
36  env['CXX'] = env.subst('$DISTCC $CXX')
37  print env.subst("* Build using $DISTCC")
38  for i in ['HOME'
39  ,'DISTCC_HOSTS'
40  ,'DISTCC_VERBOSE'
41  ,'DISTCC_FALLBACK'
42  ,'DISTCC_LOG'
43  ,'DISTCC_MMAP'
44  ,'DISTCC_SAVE_TEMPS'
45  ,'DISTCC_TCP_CORK'
46  ,'DISTCC_SSH'
47  ]:
48  if os.environ.has_key(i) and not env.has_key(i):
49  env['ENV'][i] = os.environ[i]
50 
51 
52 def exists(env):
53  """ Ensure DistCC exists.
54  """
55  return checkCommandOption(env, 'DISTCC', cmdName='distcc')
56