diff options
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/SCons/SConscript.boot | 2 | ||||
-rw-r--r-- | BuildTools/SCons/SConstruct | 36 |
2 files changed, 20 insertions, 18 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index 3e8ab96..10b0daf 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -41,9 +41,9 @@ if os.name == "nt" : vars.Add(PathVariable("wix_bindir", "Path to WiX binaries", "", PathVariable.PathAccept)) if os.name == "nt" : vars.Add(PackageVariable("bonjour", "Bonjour SDK location", "yes")) +vars.Add(EnumVariable("tls_backend", "Choose the TLS backend", "native", ["native", "openssl", "openssl_bundled"])) vars.Add(PackageVariable("openssl", "OpenSSL location", "yes")) vars.Add("openssl_libnames", "Comma-separated openssl library names to override defaults", None) -vars.Add(BoolVariable("openssl_force_bundled", "Force use of the bundled OpenSSL", "no")) vars.Add("openssl_include", "Location of OpenSSL include files (if not under (openssl)/include)", None) vars.Add("openssl_libdir", "Location of OpenSSL library files (if not under (openssl)/lib)", None) vars.Add(PackageVariable("hunspell_prefix", "Hunspell location", False)) diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index dafd2b0..3305fd3 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -507,26 +507,34 @@ conf.Finish() if env["qt"] : env["QTDIR"] = env["qt"] -# Check for OS X Secure Transport -if not env.get("openssl_force_bundled", False) and env["PLATFORM"] == "darwin" and env["target"] == "native" : - env["HAVE_SECURETRANSPORT"] = True -else : - env["HAVE_SECURETRANSPORT"] = False +################################################################################ +# TLS backend selection +################################################################################ +env["OPENSSL_FLAGS"] = {} +if env.get("tls_backend") == "native" : + if env["PLATFORM"] == "win32" : + env["HAVE_SCHANNEL"] = True + elif env["PLATFORM"] == "darwin" and env["target"] == "native": + env["HAVE_SECURETRANSPORT"] = True + elif env["target"] in ("iphone-device", "iphone-simulator", "xcode", "android") : + env["tls_backend"] = "openssl_bundled" + else : + env["tls_backend"] = "openssl" # OpenSSL -openssl_env = conf_env.Clone() -if env.get("openssl_force_bundled", False) or env["target"] in ("iphone-device", "iphone-simulator", "xcode", "android") : +if env.get("tls_backend") == "openssl_bundled" : env["OPENSSL_BUNDLED"] = True env["HAVE_OPENSSL"] = True -elif not env["HAVE_SECURETRANSPORT"] : +elif env.get("tls_backend") == "openssl" : + openssl_env = conf_env.Clone() use_openssl = bool(env["openssl"]) openssl_prefix = "" if isinstance(env["openssl"], str) : openssl_prefix = env["openssl"] openssl_flags = {} if openssl_prefix : - openssl_include = env.get("openssl_include", None) - openssl_libdir = env.get("openssl_libdir", None) + openssl_include = env.get("openssl_include") + openssl_libdir = env.get("openssl_libdir") if openssl_include: openssl_flags = {"CPPPATH":[openssl_include]} else: @@ -545,7 +553,7 @@ elif not env["HAVE_SECURETRANSPORT"] : if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") : env["HAVE_OPENSSL"] = 1 env["OPENSSL_FLAGS"] = openssl_flags - openssl_libnames = env.get("openssl_libnames", None) + openssl_libnames = env.get("openssl_libnames") if openssl_libnames: env["OPENSSL_FLAGS"]["LIBS"] = openssl_libnames.split(',') elif env["PLATFORM"] == "win32" : @@ -555,12 +563,6 @@ elif not env["HAVE_SECURETRANSPORT"] : 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" : - # If we're compiling for Windows and OpenSSL isn't being used, use Schannel - env["HAVE_SCHANNEL"] = True - openssl_conf.Finish() if env["PLATFORM"] == "win32" : |