2007-09-30 19:39:29 +00:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# ZeroRadiant build scripts
|
|
|
|
# TTimo <ttimo@idsoftware.com>
|
2007-09-12 18:54:28 +00:00
|
|
|
# http://scons.sourceforge.net
|
|
|
|
|
2007-09-30 19:39:29 +00:00
|
|
|
import sys, os, platform, cPickle
|
2007-09-12 18:54:28 +00:00
|
|
|
|
2007-09-30 19:39:29 +00:00
|
|
|
import utils, config
|
2007-09-12 18:54:28 +00:00
|
|
|
|
2007-09-30 19:39:29 +00:00
|
|
|
conf_filename = 'site.sconf'
|
2007-09-12 18:54:28 +00:00
|
|
|
|
2007-09-30 19:39:29 +00:00
|
|
|
try:
|
|
|
|
sys.argv.index( '-h' )
|
|
|
|
except:
|
|
|
|
pass
|
2007-09-12 18:54:28 +00:00
|
|
|
else:
|
2007-09-30 19:39:29 +00:00
|
|
|
Help(
|
|
|
|
"""
|
|
|
|
======================================================================
|
|
|
|
ZeroRadiant build system quick help
|
|
|
|
|
|
|
|
You need scons v0.97.0d20070918.r2446 or newer
|
|
|
|
|
|
|
|
Default build (release), just run scons at the toplevel
|
|
|
|
|
|
|
|
debug build:
|
|
|
|
$ scons config=debug
|
|
|
|
======================================================================
|
|
|
|
""" )
|
|
|
|
Return()
|
|
|
|
|
|
|
|
active_configs = []
|
|
|
|
|
|
|
|
# load up configurations from the save file
|
|
|
|
if ( os.path.exists( conf_filename ) ):
|
|
|
|
f = open( conf_filename )
|
|
|
|
print 'reading saved configuration from site.conf'
|
|
|
|
try:
|
|
|
|
while ( True ):
|
|
|
|
c = cPickle.load( f )
|
|
|
|
active_configs.append( c )
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
# read the command line and build configs
|
|
|
|
config_statements = sys.argv[1:]
|
|
|
|
active_configs = config.ConfigParser().parseStatements( active_configs, config_statements )
|
|
|
|
assert( len( active_configs ) >= 1 )
|
|
|
|
|
|
|
|
# save the config
|
|
|
|
print 'saving updated configuration'
|
|
|
|
f = open( conf_filename, 'wb' )
|
|
|
|
for c in active_configs:
|
|
|
|
cPickle.dump( c, f, -1 )
|
|
|
|
|
|
|
|
print 'emit build rules'
|
|
|
|
for c in active_configs:
|
|
|
|
print 'emit configuration: %s' % repr( c )
|
|
|
|
c.emit()
|