Author: esr
Date: Thu Mar 20 03:30:42 2008
New Revision: 24886

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24886&view=rev
Log:
Actually build a config.h.

Modified:
    trunk/SConstruct

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=24886&r1=24885&r2=24886&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Thu Mar 20 03:30:42 2008
@@ -255,6 +255,26 @@
     envdict["desktopdir"] = os.path.join(envdict["datadir"], "applicationa")
 configsyms["APP_ENTRY"] = envdict["desktopdir"]
 
+def config_build(target, source, env):
+    # Build a config.h file from configsyms
+    assert(str(source[0]) == "SConstruct")
+    wfp = open(str(target[0]), "w")
+    wfp.write("// This file is geneated by an scons recipe.  Do not 
hand-hack!\n")
+    for (sym, val) in configsyms.items():
+        if type(val) == type(""):
+            wfp.write('#define %s      "%s"\n' % (sym, val))
+        elif val == True:
+            wfp.write("#define %s      1\n" % sym)
+        elif val == False:
+            wfp.write("#undef %s\n" % sym)
+        else:
+            wfp.write("#define %s      %s\n" % (sym, val))
+    wfp.close()
+    return None
+config_builder = Builder(action = config_build)
+env.Append(BUILDERS = {'Config' : config_builder})
+env.Config("src/config.h", "SConstruct")
+
 #
 # How to build the Wesnoth configuration file
 #


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to