[Clam-devel] distributed compiler

Pau Arumi parumi at iua.upf.edu
Mon Apr 2 11:33:33 PDT 2007


En/na Hernán Ordiales ha escrit:
>> > On 3/30/07, Pau Arumi <parumi at iua.upf.edu> wrote:
>> >> interesting indeed.
>> >> but i think i'd prefere a more high-level scons option and easier
>> >> to document.
>> >> what about a unique option like this?
>> >> scons use_distcc_hosts="host1 host2"
>> >> and scons --help would explain what it does.
>> > yes could be, but personally i prefer in that way because i can set up
>> > it once and then forget about it, only type "scons" every time...
>> but this is done automatically for any scons option. i mean, you set
>> that option the first time (or edit clam.conf) and then only "scons".
> 
> good, then i like me too :-)
> new to me, just i'm learning scons tricks and python
> (previous this i thought that maybe you were suggesting something like
> that, but i noticed it after my last mail)
> 
> well, i remade it (please see the patch attached):
> 
> now, if you run it with something like: scons distcc_hosts='host1 host2 
> host3'
> you setup and enable it, then you can run only "scons" and you'll
> compiling with this conf
> 
> if you want to disable it: scons distcc_hosts=''
> (builds again only with g++)

agree.

> help also works as you said:
> scons --help
> ...
> distcc_hosts: distcc compiler hosts
>    default:
>    actual: host1 host2 host3

good. can you think on a more verbose help? maybe specifying which
compiler will be run...

some comments about the patch:

> Index: CLAM/scons/libs/SConstruct
> ===================================================================
> --- CLAM/scons/libs/SConstruct	(revisión: 9909)
> +++ CLAM/scons/libs/SConstruct	(copia de trabajo)
> @@ -3,6 +3,7 @@
>  import os
>  import shelve
>  import copy
> +import string

not really needed.
in python you can do thinks like
 > print "one two three".split()
 > 3

>  # tools for build configuration
>  from buildtools.custom_builders import * 
>  from buildtools.tool_checks import *
> @@ -207,6 +208,8 @@
>  		opts.Add( PathOption( 'qt_includes', 'Path to the directory where qt includes are located', 'G:\projects\qt\include' ) )
>  		opts.Add( PathOption( 'qt_libs', 'Path to the directory where qt binaries are located', 'G:\projects\qt\lib' ) )
>  
> +	opts.Add( 'distcc_hosts', 'distcc compiler hosts', '')
> +	
>  	opts.Update(env)
>  	opts.Save('clam.conf', env) # Save, so user doesn't have to 
>  		 		  				# specify PREFIX every time
> @@ -271,10 +274,16 @@
>  clam_env = Environment( ENV=os.environ, tools=['default'])
>  clam_env.SConsignFile()
>  
> +clam_env['distcc_hosts'] = ARGUMENTS.get('distcc_hosts', '')

last line is not needed. options are already copied into the
environment, so clam_env['distcc_hosts'] should be already usable. check 
it with a print, though.

>  setup_build_options( clam_env )
>  
>  clam_env.Append( CPPFLAGS = '' )
>  
> +if clam_env['distcc_hosts'] :
> +	clam_env['CXX'] = 'distcc g++'
> +	clam_env['ENV']['DISTCC_HOSTS'] = clam_env['distcc_hosts']
> +	SetOption('num_jobs', len(string.split(clam_env['distcc_hosts'])))

without string:
len( clam_env['distcc_hosts'].split() )


thanks!

pau




More information about the clam-devel mailing list