From 34eb7f55fbdd1566ee117738f3a423354ce1b45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 28 Nov 2010 10:48:01 +0100 Subject: Replace slightly-too-magic MergeFlags by our own UseFlags. diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index 31d74fa..bdb7d48 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -47,7 +47,7 @@ vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccep # Set up default build & configure environment ################################################################################ -env = Environment(CPPPATH = "#", ENV = { +env = Environment(CPPPATH = ["#"], ENV = { 'PATH' : os.environ['PATH'], 'LD_LIBRARY_PATH' : os.environ.get("LD_LIBRARY_PATH", ""), }, variables = vars) @@ -61,6 +61,7 @@ env["PLATFORM_FLAGS"] = {} env.Tool("Test", toolpath = ["#/BuildTools/SCons/Tools"]) env.Tool("WriteVal", toolpath = ["#/BuildTools/SCons/Tools"]) env.Tool("BuildVersion", toolpath = ["#/BuildTools/SCons/Tools"]) +env.Tool("Flags", toolpath = ["#/BuildTools/SCons/Tools"]) if env["PLATFORM"] == "darwin" : env.Tool("Nib", toolpath = ["#/BuildTools/SCons/Tools"]) env.Tool("AppBundle", toolpath = ["#/BuildTools/SCons/Tools"]) diff --git a/BuildTools/SCons/Tools/Flags.py b/BuildTools/SCons/Tools/Flags.py new file mode 100644 index 0000000..13fbb32 --- /dev/null +++ b/BuildTools/SCons/Tools/Flags.py @@ -0,0 +1,10 @@ +import SCons.Util + +def generate(env) : + def useFlags(env, flags) : + for flag in flags : + env[flag] = env.get(flag, []) + flags[flag] + env.AddMethod(useFlags, "UseFlags") + +def exists(env) : + return True diff --git a/Limber/SConscript b/Limber/SConscript index 0068233..e2fadac 100644 --- a/Limber/SConscript +++ b/Limber/SConscript @@ -3,12 +3,12 @@ Import("env") if env["SCONS_STAGE"] == "build" : myenv = env.Clone() myenv.BuildVersion("BuildVersion.h", project = "limber") - myenv.MergeFlags(env["SWIFTEN_FLAGS"]) - myenv.MergeFlags(env["LIBIDN_FLAGS"]) - myenv.MergeFlags(env.get("LIBXML_FLAGS", "")) - myenv.MergeFlags(env.get("EXPAT_FLAGS", "")) - myenv.MergeFlags(env["OPENSSL_FLAGS"]) - myenv.MergeFlags(env["BOOST_FLAGS"]) - myenv.MergeFlags(myenv["PLATFORM_FLAGS"]) + myenv.UseFlags(env["SWIFTEN_FLAGS"]) + myenv.UseFlags(env["LIBIDN_FLAGS"]) + myenv.UseFlags(env.get("LIBXML_FLAGS", "")) + myenv.UseFlags(env.get("EXPAT_FLAGS", "")) + myenv.UseFlags(env["OPENSSL_FLAGS"]) + myenv.UseFlags(env["BOOST_FLAGS"]) + myenv.UseFlags(myenv["PLATFORM_FLAGS"]) myenv.Program("limber", ["main.cpp"]) diff --git a/Swiften/QA/ClientTest/SConscript b/Swiften/QA/ClientTest/SConscript index 31c4011..15a68c6 100644 --- a/Swiften/QA/ClientTest/SConscript +++ b/Swiften/QA/ClientTest/SConscript @@ -4,8 +4,8 @@ Import("env") if env["TEST"] : myenv = env.Clone() - myenv.MergeFlags(myenv["SWIFTEN_FLAGS"]) - myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"]) + myenv.UseFlags(myenv["SWIFTEN_FLAGS"]) + myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"]) for i in ["SWIFT_CLIENTTEST_JID", "SWIFT_CLIENTTEST_PASS"]: if ARGUMENTS.get(i.lower(), False) : diff --git a/Swiften/QA/SConscript b/Swiften/QA/SConscript index b885909..4638d6c 100644 --- a/Swiften/QA/SConscript +++ b/Swiften/QA/SConscript @@ -7,4 +7,4 @@ SConscript(dirs = [ # "DNSSDTest", "StorageTest", "TLSTest", - ]) \ No newline at end of file + ]) diff --git a/Swiften/SConscript b/Swiften/SConscript index e81309e..080e88e 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -11,12 +11,12 @@ if env["SCONS_STAGE"] == "flags" : swiften_env["LIBPATH"] = [Dir(".")] swiften_env["LIBS"] = ["Swiften"] dep_env = env.Clone() - dep_env.MergeFlags(dep_env["PLATFORM_FLAGS"]) for module in ["BOOST", "LIBIDN", "ZLIB", "OPENSSL", "LIBXML", "EXPAT"] : if env.get(module + "_BUNDLED", False) : - swiften_env.MergeFlags(env.get(module + "_FLAGS", {})) + swiften_env.UseFlags(env.get(module + "_FLAGS", {})) else : - dep_env.MergeFlags(env.get(module + "_FLAGS", {})) + dep_env.UseFlags(env.get(module + "_FLAGS", {})) + dep_env.UseFlags(dep_env["PLATFORM_FLAGS"]) for var, e in [("SWIFTEN_FLAGS", swiften_env), ("SWIFTEN_DEP_FLAGS", dep_env)] : env[var] = { -- cgit v0.10.2-6-g49f6