summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-28 18:34:56 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-11-28 10:56:49 (GMT)
commitab6bac1ee3ba4ebf4dfc8dc1a3ae6783756c48c9 (patch)
treedc69a9a658683b7f3caa81a06040dcbd4d87acc8 /Swiften/Config/SConscript
parent34eb7f55fbdd1566ee117738f3a423354ce1b45c (diff)
downloadswift-contrib-ab6bac1ee3ba4ebf4dfc8dc1a3ae6783756c48c9.zip
swift-contrib-ab6bac1ee3ba4ebf4dfc8dc1a3ae6783756c48c9.tar.bz2
Added swiften-config.
Diffstat (limited to 'Swiften/Config/SConscript')
-rw-r--r--Swiften/Config/SConscript33
1 files changed, 33 insertions, 0 deletions
diff --git a/Swiften/Config/SConscript b/Swiften/Config/SConscript
new file mode 100644
index 0000000..962093a
--- /dev/null
+++ b/Swiften/Config/SConscript
@@ -0,0 +1,33 @@
+Import("env")
+
+def replaceSwiftenPath(input) :
+ return input.replace(env.Dir("#").abspath, "#")
+
+def cStringVariable(env, cVar, sconsVar) :
+ result = "const char* " + cVar + "[] = {\n"
+ # FIXME: Probably not very robust
+ for var in sconsVar.split(" ") :
+ result += "\t\"" + env.subst(var) + "\",\n"
+ result += "\t0\n"
+ result += "};\n"
+ return result
+
+config_flags = ""
+
+swiften_env = env.Clone()
+swiften_env.MergeFlags(swiften_env["SWIFTEN_FLAGS"])
+swiften_env.MergeFlags(swiften_env["SWIFTEN_DEP_FLAGS"])
+
+cppflags = replaceSwiftenPath(" ".join([swiften_env.subst("$_CPPDEFFLAGS"), swiften_env.subst("$_CPPINCFLAGS")]))
+config_flags += cStringVariable(swiften_env, "CPPFLAGS", cppflags)
+
+libflags = replaceSwiftenPath(" ".join([swiften_env.subst("$_LIBDIRFLAGS"), swiften_env.subst("$_LIBFLAGS")]))
+config_flags += cStringVariable(swiften_env, "LIBFLAGS", libflags)
+
+config_env = env.Clone()
+config_env.MergeFlags(config_env["SWIFTEN_FLAGS"])
+config_env.MergeFlags(config_env["BOOST_FLAGS"])
+config_env.WriteVal("swiften-config.h", config_env.Value(config_flags))
+config_env.Program("swiften-config", [
+ "swiften-config.cpp"
+ ])