summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools/SCons/SConstruct')
-rw-r--r--BuildTools/SCons/SConstruct62
1 files changed, 34 insertions, 28 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 6d63d5b..78f388b 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -5,13 +5,13 @@ Import("env", "conf_env")
root = Dir("../..").abspath
# Override SConscript to handle tests
oldSConscript = SConscript
-def SConscript(*arguments, **keywords) :
- if not keywords.get("test_only", False) or env["TEST"] :
- return apply(oldSConscript, arguments, keywords)
+def SConscript(*args, **kwargs) :
+ if not kwargs.get("test_only", False) or env["TEST"] :
+ return oldSConscript(*args, **kwargs)
env.SConscript = SConscript
################################################################################
# Extend the default build environment (not affecting the configure env)
#
@@ -140,15 +140,15 @@ int main(int argc, char* argv[]) {
conf = Configure(conf_env, custom_tests = {
'CheckCpp11Support' : checkForCpp11Support,
})
if not conf.CheckCXX() or not conf.CheckCC() :
- print "Error: You need a working compiler"
+ print("Error: You need a working compiler")
Exit(1)
if not conf.CheckCpp11Support() :
- print "Error: You need a compiler with support for the C++11 standard"
+ print("Error: You need a compiler with support for the C++11 standard")
Exit(1)
env["HAVE_ZLIB"] = True
zlib_flags = {}
@@ -168,11 +168,11 @@ if (not zlib_okay) and conf.CheckLib("z") :
zlib_flags["LIBS"] = ["z"]
zlib_okay = True
if zlib_okay :
env["ZLIB_FLAGS"] = zlib_flags
elif not env.get("zlib_bundled_enable", True) :
- print "Error: Zlib not found and zlib_bundled_enable is false"
+ print("Error: Zlib not found and zlib_bundled_enable is false")
Exit(1)
else :
env["ZLIB_BUNDLED"] = True
if conf.CheckLib("resolv") :
@@ -236,11 +236,11 @@ if not env.get("boost_force_bundled") and allLibsPresent :
env["BOOST_FLAGS"].update({"LIBS": libNames})
if not conf.CheckCXXHeader("boost/uuid/uuid.hpp") :
# FIXME: Remove this workaround when UUID is available in most distros
env["BOOST_BUNDLED_UUID_ONLY"] = True
elif not env.get("boost_bundled_enable", True) :
- print "Error: Boost not found and boost_bundled_enable is false"
+ print("Error: Boost not found and boost_bundled_enable is false")
Exit(1)
else :
env["BOOST_BUNDLED"] = True
boost_version = GetVersion(conf, "BOOST_VERSION", "boost/version.hpp")
if boost_version == 106400 :
@@ -371,11 +371,11 @@ if env.get("try_expat", True) and not env.get("HAVE_LIBXML",0) :
conf.Finish()
# Bundled expat
bundledExpat = False
if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) :
- print "Expat or LibXML not found. Using bundled Expat"
+ print("Expat or LibXML not found. Using bundled Expat")
SConscript("#/3rdParty/Expat/SConscript")
env["HAVE_EXPAT"] = 1
env["EXPAT_BUNDLED"] = True
################################################################################
@@ -422,14 +422,14 @@ conf.Finish()
if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) :
if env.get("libidn_bundled_enable", True) :
env["HAVE_LIBIDN"] = 1
env["LIBIDN_BUNDLED"] = 1
elif env.get("need_idn", True):
- print "Error: ICU and LIBIDN not found, and libidn_bundled_enable is false"
+ print("Error: ICU and LIBIDN not found, and libidn_bundled_enable is false")
Exit(1)
else:
- print "Proceeding without an IDN library because need_idn was false. This will break all internal binaries"
+ print("Proceeding without an IDN library because need_idn was false. This will break all internal binaries")
# Unbound
if env["unbound"] :
env["LDNS_BUNDLED"] = 1
env["UNBOUND_BUNDLED"] = 1
@@ -512,11 +512,11 @@ if not env.get("lua_force_bundled", False) and conf.CheckLibWithHeader(env["lua_
env["LUA_FLAGS"] = { "LIBS": [env["lua_libname"]] }
lua_version = GetVersion(conf, "LUA_VERSION_NUM", "lua.h")
if lua_version > 0 :
env["LUA_FLAGS"]["LUA_VERSION"] = str(lua_version // 100) + "." + str(lua_version % 100)
else :
- print "Warning: Unable to determine Lua version. Not installing Lua libraries."
+ print("Warning: Unable to determine Lua version. Not installing Lua libraries.")
env["LUA_FLAGS"].update(lua_flags)
else :
env["LUA_BUNDLED"] = 1
conf.Finish()
@@ -552,10 +552,14 @@ conf.Finish()
# Qt
if env["qt"] :
env["QTDIR"] = env["qt"]
+if env["PLATFORM"] == "win32" :
+ systemIncludeFlag = "/I"
+else:
+ systemIncludeFlag = "-isystem"
################################################################################
# TLS backend selection
################################################################################
env["OPENSSL_FLAGS"] = {}
@@ -581,13 +585,13 @@ elif env.get("tls_backend") == "openssl" :
openssl_flags = {}
if openssl_prefix :
openssl_include = env.get("openssl_include")
openssl_libdir = env.get("openssl_libdir")
if openssl_include:
- openssl_flags = {"CPPPATH":[openssl_include]}
+ openssl_flags = { "CPPFLAGS": [systemIncludeFlag + openssl_include]}
else:
- openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
+ openssl_flags = { "CPPFLAGS": [systemIncludeFlag + os.path.join(openssl_prefix, "include")] }
if openssl_libdir:
openssl_flags["LIBPATH"] = [openssl_libdir]
env["OPENSSL_DIR"] = openssl_prefix
elif env["PLATFORM"] == "win32" :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib", "VC")]
@@ -664,11 +668,11 @@ try :
myenv.Tool("qt4", toolpath = ["#/BuildTools/SCons/Tools"])
env["HAVE_QT"] = True
except SCons.Errors.StopError:
env["HAVE_QT"] = False
except Exception as e:
- print "Info: %s" % str(e)
+ print("Info: %s" % str(e))
env["HAVE_QT"] = False
################################################################################
# DocBook setup
################################################################################
@@ -686,11 +690,11 @@ if env.get("docbook_xsl") :
try:
if env.Dir("#/.git").exists() :
if not env.GetOption("clean") and env.get("install_git_hooks", True) :
env.Install("#/.git/hooks", Glob("#/BuildTools/Git/Hooks/*"))
except TypeError:
- print "You seem to be using Swift in a Git submodule. Not installing hooks."
+ print("You seem to be using Swift in a Git submodule. Not installing hooks.")
################################################################################
# Replace #pragma once with proper guards on platforms that require it
################################################################################
@@ -701,10 +705,12 @@ if ARGUMENTS.get("replace_pragma_once", False) :
def relpath(path, start) :
i = len(os.path.commonprefix([path, start]))
return path[i+1:]
for actual_root, dirs, files in os.walk(root) :
+ dirs.sort()
+ files.sort()
if "3rdParty" in actual_root :
continue
for file in files :
if not file.endswith(".h") :
continue
@@ -727,18 +733,18 @@ if ARGUMENTS.get("dump_trace", False) :
SCons.Node.Python.Value.changed_since_last_build = (lambda x, y, z: True)
# Modules
modules = []
if os.path.isdir(Dir("#/3rdParty").abspath) :
- for dir in os.listdir(Dir("#/3rdParty").abspath) :
+ for dir in sorted(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) :
+for dir in sorted(os.listdir(Dir("#").abspath)) :
full_dir = os.path.join(Dir("#").abspath, dir)
if not os.path.isdir(full_dir) :
continue
sconscript = os.path.join(full_dir, "SConscript")
if os.path.isfile(sconscript) :
@@ -750,11 +756,11 @@ 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"] :
env["SCONS_STAGE"] = stage
- SConscript(dirs = map(lambda x : root + "/" + x, modules))
+ SConscript(dirs = list(map(lambda x : root + "/" + x, modules)))
# SLOCCount
if ARGUMENTS.get("sloccount", False) :
for project in env["PROJECTS"] :
env.SLOCCount("#/" + project)
@@ -762,27 +768,27 @@ if ARGUMENTS.get("sloccount", False) :
################################################################################
# Print summary
################################################################################
-print
-print " Build Configuration"
-print " -------------------"
+print("")
+print(" Build Configuration")
+print(" -------------------")
parsers = []
if env.get("HAVE_LIBXML", 0):
parsers.append("LibXML")
if env.get("HAVE_EXPAT", 0):
parsers.append("Expat")
if env.get("EXPAT_BUNDLED", False) :
parsers.append("(Bundled)")
-print " Projects: " + ' '.join(env["PROJECTS"])
-print ""
-print " XML Parsers: " + ' '.join(parsers)
+print(" Projects: " + ' '.join(env["PROJECTS"]))
+print("")
+print(" XML Parsers: " + ' '.join(parsers))
-print " TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled")
-print " DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled"))
-print
+print(" TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled"))
+print(" DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled")))
+print("")
if not GetOption("help") and not env.get("HAVE_OPENSSL", 0) and not env.get("HAVE_SCHANNEL", 0) and not env.get("HAVE_SECURETRANSPORT", 0):
- print "Error: A working TLS backend is required. Please check the documentation for more information."
+ print("Error: A working TLS backend is required. Please check the documentation for more information.")
Exit(1)