summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools/SCons/SConstruct')
-rw-r--r--BuildTools/SCons/SConstruct167
1 files changed, 109 insertions, 58 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index a0a6e8d..8f4d440 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -33,7 +33,7 @@ def colorize(command, target, color) :
suffix = "\033[0m"
return " " + prefix + command + suffix + " " + target
-if int(ARGUMENTS.get("V", 0)) == 0:
+if int(ARGUMENTS.get("V", 0)) == 0 and not ARGUMENTS.get("dump_trace", False) :
env["CCCOMSTR"] = colorize("CC", "$TARGET", "green")
env["SHCCCOMSTR"] = colorize("CC", "$TARGET", "green")
env["CXXCOMSTR"] = colorize("CXX", "$TARGET", "green")
@@ -42,6 +42,7 @@ if int(ARGUMENTS.get("V", 0)) == 0:
env["SHLINKCOMSTR"] = colorize("LINK", "$TARGET", "red")
env["ARCOMSTR"] = colorize("AR", "$TARGET", "red")
env["RANLIBCOMSTR"] = colorize("RANLIB", "$TARGET", "red")
+ env["PCHCOMSTR"] = colorize("PCH", "$TARGET", "blue")
env["QT4_RCCCOMSTR"] = colorize("RCC", "$TARGET", "blue")
env["QT4_UICCOMSTR"] = colorize("UIC", "$TARGET", "blue")
env["QT4_MOCFROMHCOMSTR"] = colorize("MOC", "$TARGET", "blue")
@@ -332,27 +333,53 @@ if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) :
env["HAVE_LIBIDN"] = 1
env["LIBIDN_BUNDLED"] = 1
+# Unbound
+if env["unbound"] :
+ env["LDNS_BUNDLED"] = 1
+ env["UNBOUND_BUNDLED"] = 1
+else :
+ env["LDNS_FLAGS"] = {}
+ env["UNBOUND_FLAGS"] = {}
+
# LibMiniUPnPc
if env["experimental"] :
- #libminiupnpc_conf_env = conf_env.Clone()
- #conf = Configure(libminiupnpc_conf_env)
- #if conf.CheckCHeader("miniupnpc.h") and conf.CheckLib(env["libminiupnpc_libname"]) :
- # print "NOT IMPLEMENTED YET"
- #else :
- env["LIBMINIUPNPC_BUNDLED"] = 1
- #conf.Finish()
+ libminiupnpc_flags = {"CPPPATH": ["/usr/include/miniupnpc/"]}
+ libminiupnpc_conf_env = conf_env.Clone()
+ if env.get("libminiupnpc_libdir", None) :
+ libminiupnpc_flags["LIBPATH"] = [env["libminiupnpc_libdir"]]
+ if env.get("libminiupnpc_includedir", None) :
+ libminiupnpc_flags["CPPPATH"] = [env["libminiupnpc_includedir"]]
+ libminiupnpc_conf_env.MergeFlags(libminiupnpc_flags)
+ conf = Configure(libminiupnpc_conf_env)
+ if conf.CheckCHeader("miniupnpc.h") and conf.CheckLib(env["libminiupnpc_libname"]) and False :
+ # ^ False because APIs aren't stable
+ env["HAVE_LIBMINIUPNPC"] = 1
+ env["LIBMINIUPNPC_FLAGS"] = { "LIBS": ["miniupnpc"] }
+ env["LIBMINIUPNPC_FLAGS"].update(libminiupnpc_flags)
+ else :
+ env["LIBMINIUPNPC_BUNDLED"] = 1
+ conf.Finish()
else :
env["LIBMINIUPNPC_FLAGS"] = {}
# LibNATPMP
if env["experimental"] :
- #libnatpmp_conf_env = conf_env.Clone()
- #conf = Configure(libnatpmp_conf_env)
- #if conf.CheckCHeader("natpmp.h") and conf.CheckLib(env["libnatpmp_libname"]) :
- # print "NOT IMPLEMENTED YET"
- #else :
- env["LIBNATPMP_BUNDLED"] = 1
- #conf.Finish()
+ libnatpmp_flags = {}
+ libnatpmp_conf_env = conf_env.Clone()
+ if env.get("libnatpmp_libdir", None) :
+ libnatpmp_flags["LIBPATH"] = [env["libnatpmp_libdir"]]
+ if env.get("libnatpmp_includedir", None) :
+ libnatpmp_flags["CPPPATH"] = [env["libnatpmp_includedir"]]
+ libnatpmp_conf_env.MergeFlags(libnatpmp_flags)
+ conf = Configure(libnatpmp_conf_env)
+ if conf.CheckCHeader("natpmp.h") and conf.CheckLib(env["libnatpmp_libname"]) and False:
+ # ^ False because APIs aren't stable
+ env["HAVE_LIBNATPMP"] = 1
+ env["LIBNATPMP_FLAGS"] = { "LIBS": ["natpmp"] }
+ env["LIBNATPMP_FLAGS"].update(libnatpmp_flags)
+ else :
+ env["LIBNATPMP_BUNDLED"] = 1
+ conf.Finish()
else :
env["LIBNATPMP_FLAGS"] = {}
@@ -372,7 +399,6 @@ if env["experimental"] :
env["SQLITE_FLAGS"].update(sqlite_flags)
else :
env["SQLITE_BUNDLED"] = 1
- env["SQLITE_ASYNC_BUNDLED"] = 1
conf.Finish()
else :
env["SQLITE_FLAGS"] = {}
@@ -409,43 +435,60 @@ if env["qt"] :
# OpenSSL
openssl_env = conf_env.Clone()
-use_openssl = bool(env["openssl"])
-openssl_prefix = env["openssl"] if isinstance(env["openssl"], str) else ""
-openssl_flags = {}
-if openssl_prefix :
- openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
- if env["PLATFORM"] == "win32" :
- openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib", "VC")]
- env["OPENSSL_DIR"] = openssl_prefix
- else :
- openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib")]
- openssl_env.MergeFlags(openssl_flags)
-
-openssl_conf = Configure(openssl_env)
-if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") :
- env["HAVE_OPENSSL"] = 1
- env["OPENSSL_FLAGS"] = openssl_flags
- if env["PLATFORM"] == "win32" :
- env["OPENSSL_FLAGS"]["LIBS"] = ["libeay32MD", "ssleay32MD"]
- else:
- env["OPENSSL_FLAGS"]["LIBS"] = ["ssl", "crypto"]
- if env["PLATFORM"] == "darwin" :
- if platform.mac_ver()[0].startswith("10.5") :
- env["OPENSSL_FLAGS"]["FRAMEWORKS"] = ["Security"]
-elif env["target"] in ("iphone-device", "iphone-simulator", "xcode") :
+if env.get("openssl_force_bundled", False) or env["target"] in ("iphone-device", "iphone-simulator", "xcode", "android") :
env["OPENSSL_BUNDLED"] = True
env["HAVE_OPENSSL"] = True
else :
- env["OPENSSL_FLAGS"] = {}
- if env["PLATFORM"] == "win32" :
- env["HAVE_SCHANNEL"] = True
- # If we're compiling for Windows and OpenSSL isn't being used, use Schannel
- env.Append(LIBS = ["secur32"])
-
-openssl_conf.Finish()
+ use_openssl = bool(env["openssl"])
+ openssl_prefix = env["openssl"] if isinstance(env["openssl"], str) else ""
+ openssl_flags = {}
+ if openssl_prefix :
+ openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
+ if env["PLATFORM"] == "win32" :
+ openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib", "VC")]
+ env["OPENSSL_DIR"] = openssl_prefix
+ else :
+ openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib")]
+ openssl_env.MergeFlags(openssl_flags)
+
+ openssl_conf = Configure(openssl_env)
+ if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") :
+ env["HAVE_OPENSSL"] = 1
+ env["OPENSSL_FLAGS"] = openssl_flags
+ if env["PLATFORM"] == "win32" :
+ env["OPENSSL_FLAGS"]["LIBS"] = ["libeay32MD", "ssleay32MD"]
+ else:
+ env["OPENSSL_FLAGS"]["LIBS"] = ["ssl", "crypto"]
+ if env["PLATFORM"] == "darwin" :
+ if platform.mac_ver()[0].startswith("10.5") :
+ env["OPENSSL_FLAGS"]["FRAMEWORKS"] = ["Security"]
+ else :
+ env["OPENSSL_FLAGS"] = {}
+ if env["PLATFORM"] == "win32" :
+ env["HAVE_SCHANNEL"] = True
+ # If we're compiling for Windows and OpenSSL isn't being used, use Schannel
+ env.Append(LIBS = ["secur32"])
+
+ openssl_conf.Finish()
+
+#Hunspell
+hunspell_env = conf_env.Clone()
+hunspell_prefix = env["hunspell"] if isinstance(env.get("hunspell", False), str) else ""
+hunspell_flags = {}
+if hunspell_prefix :
+ hunspell_flags = {"CPPPATH":[os.path.join(hunspell_prefix, "include")], "LIBPATH":[os.path.join(hunspell_prefix, "lib")]}
+hunspell_env.MergeFlags(hunspell_flags)
+
+env["HAVE_HUNSPELL"] = 0;
+hunspell_conf = Configure(hunspell_env)
+if hunspell_conf.CheckCXXHeader("hunspell/hunspell.hxx") and hunspell_conf.CheckLib("hunspell") :
+ env["HAVE_HUNSPELL"] = 1
+ hunspell_flags["LIBS"] = ["hunspell"]
+ env["HUNSPELL_FLAGS"] = hunspell_flags
+hunspell_conf.Finish()
# Bonjour
-if env["PLATFORM"] == "darwin" :
+if env["PLATFORM"] == "darwin" and env["target"] == "native" :
env["HAVE_BONJOUR"] = 1
elif env.get("bonjour", False) :
bonjour_env = conf_env.Clone()
@@ -524,18 +567,22 @@ else :
# Project files
################################################################################
-# Build tools
-env.SConscript(dirs = ["#/BuildTools/CLang"])
+if ARGUMENTS.get("dump_trace", False) :
+ env.SetOption("no_exec", True)
+ env["TEST"] = True
+ env.Decider(lambda x, y, z : True)
+ SCons.Node.Python.Value.changed_since_last_build = (lambda x, y, z: True)
# Modules
modules = []
-for dir in os.listdir(Dir("#/3rdParty").abspath) :
- full_dir = os.path.join(Dir("#/3rdParty").abspath, dir)
- if not os.path.isdir(full_dir) :
- continue
- sconscript = os.path.join(full_dir, "SConscript")
- if os.path.isfile(sconscript) :
- modules.append("3rdParty/" + dir)
+if os.path.isdir(Dir("#/3rdParty").abspath) :
+ for dir in os.listdir(Dir("#/3rdParty").abspath) :
+ full_dir = os.path.join(Dir("#/3rdParty").abspath, dir)
+ if not os.path.isdir(full_dir) :
+ continue
+ sconscript = os.path.join(full_dir, "SConscript")
+ if os.path.isfile(sconscript) :
+ modules.append("3rdParty/" + dir)
for dir in os.listdir(Dir("#").abspath) :
full_dir = os.path.join(Dir("#").abspath, dir)
if not os.path.isdir(full_dir) :
@@ -544,9 +591,13 @@ for dir in os.listdir(Dir("#").abspath) :
if os.path.isfile(sconscript) :
modules.append(dir)
+# QA comes last
+modules.remove("QA")
+modules.append("QA")
+
# Flags
env["PROJECTS"] = [m for m in modules if m not in ["Documentation", "QA", "SwifTools"] and not m.startswith("3rdParty")]
-for stage in ["flags", "build", "test"] :
+for stage in ["flags", "build"] :
env["SCONS_STAGE"] = stage
SConscript(dirs = map(lambda x : root + "/" + x, modules))