]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - SConstruct
a8307a6e62459c337ff87c8caff908542ee461e3
[xonotic/netradiant.git] / SConstruct
1 # -*- mode: python -*-\r
2 # ZeroRadiant build scripts\r
3 # TTimo <ttimo@idsoftware.com>\r
4 # http://scons.sourceforge.net\r
5 \r
6 import sys, os, platform, cPickle\r
7 \r
8 import utils, config\r
9 \r
10 conf_filename = 'site.sconf'\r
11 \r
12 try:\r
13         sys.argv.index( '-h' )\r
14 except:\r
15         pass\r
16 else:\r
17         Help(\r
18 """\r
19 ======================================================================\r
20 ZeroRadiant build system quick help\r
21 \r
22 You need scons v0.97.0d20070918.r2446 or newer\r
23 \r
24 Default build (release), just run scons at the toplevel\r
25 \r
26 debug build:\r
27 $ scons config=debug\r
28 ======================================================================\r
29 """ )\r
30         Return()\r
31 \r
32 active_configs = []\r
33 \r
34 # load up configurations from the save file\r
35 if ( os.path.exists( conf_filename ) ):\r
36         f = open( conf_filename )\r
37         print 'reading saved configuration from site.conf'\r
38         try:\r
39                 while ( True ):\r
40                         c = cPickle.load( f )\r
41                         active_configs.append( c )\r
42         except:\r
43                 pass\r
44 \r
45 # read the command line and build configs\r
46 config_statements = sys.argv[1:]\r
47 active_configs = config.ConfigParser().parseStatements( active_configs, config_statements )\r
48 assert( len( active_configs ) >= 1 )\r
49 \r
50 # save the config\r
51 print 'saving updated configuration'\r
52 f = open( conf_filename, 'wb' )\r
53 for c in active_configs:\r
54         cPickle.dump( c, f, -1 )\r
55 \r
56 print 'emit build rules'\r
57 for c in active_configs:\r
58         print 'emit configuration: %s' % repr( c )\r
59         c.emit()\r