From 0e124ddce9726971e579578a49a6e017d98298be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Mon, 11 Feb 2013 19:33:27 +0100 Subject: Fix bundled OpenSSL builds. Change-Id: Ic11b04663f324b75d81a18887cbe4c7324823c86 diff --git a/3rdParty/OpenSSL/SConscript b/3rdParty/OpenSSL/SConscript index dfe78b7..9b84f6d 100644 --- a/3rdParty/OpenSSL/SConscript +++ b/3rdParty/OpenSSL/SConscript @@ -1,4 +1,4 @@ -Import("env") +Import("env", "conf_env") openssl_bundle_dir = "openssl" @@ -13,16 +13,26 @@ if env.get("OPENSSL_BUNDLED", False) : if env["SCONS_STAGE"] == "build" : openssl_env = env.Clone() openssl_env["OPENSSL_BUNDLE_DIR"] = openssl_bundle_dir + openssl_env.Replace(CCFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]]) openssl_env.Append(CPPPATH = [ "$OPENSSL_BUNDLE_DIR", "$OPENSSL_BUNDLE_DIR/crypto", "$OPENSSL_BUNDLE_DIR/crypto/asn1", "$OPENSSL_BUNDLE_DIR/crypto/evp", + "$OPENSSL_BUNDLE_DIR/crypto/modes", "$OPENSSL_BUNDLE_DIR/include" ]) openssl_env.Append(CPPDEFINES = ["OPENSSL_THREADS", "_REENTRANT", "DSO_DLFCN", "HAVE_DLFCN_H", "L_ENDIAN"]) - openssl_env.StaticLibrary("crypto", [ + # Detect 32/64 bit + conf = Configure(conf_env) + if conf.CheckDeclaration("__LP64__") : + openssl_env.Append(CPPDEFINES = [("DES_LONG", "unsigned int"), ("MD32_REG_T", "int")]) + else : + openssl_env.Append(CPPDEFINES = [("DES_LONG", "unsigned long")]) + conf.Finish() + + env["OPENSSL_OBJECTS"] = openssl_env.SwiftenObject([ "$OPENSSL_BUNDLE_DIR/crypto/cryptlib.c", "$OPENSSL_BUNDLE_DIR/crypto/mem.c", "$OPENSSL_BUNDLE_DIR/crypto/mem_dbg.c", @@ -576,8 +586,6 @@ if env.get("OPENSSL_BUNDLED", False) : "$OPENSSL_BUNDLE_DIR/crypto/ts/ts_lib.c", "$OPENSSL_BUNDLE_DIR/crypto/ts/ts_conf.c", "$OPENSSL_BUNDLE_DIR/crypto/ts/ts_asn1.c", - ]) - openssl_env.StaticLibrary("ssl", [ "$OPENSSL_BUNDLE_DIR/ssl/s2_meth.c", "$OPENSSL_BUNDLE_DIR/ssl/s2_srvr.c", "$OPENSSL_BUNDLE_DIR/ssl/s2_clnt.c", diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index 8e8aecf..567ff83 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -37,6 +37,7 @@ if os.name == "nt" : if os.name == "nt" : vars.Add(PackageVariable("bonjour", "Bonjour SDK location", "yes")) vars.Add(PackageVariable("openssl", "OpenSSL location", "yes")) +vars.Add(BoolVariable("openssl_force_bundled", "Force use of the bundled OpenSSL", "no")) vars.Add(PathVariable("boost_includedir", "Boost headers location", None, PathVariable.PathAccept)) vars.Add(PathVariable("boost_libdir", "Boost library location", None, PathVariable.PathAccept)) vars.Add(PathVariable("expat_includedir", "Expat headers location", None, PathVariable.PathAccept)) @@ -278,6 +279,7 @@ for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR"] : else : env[path] = Dir("#/" + ARGUMENTS[path]).abspath + ################################################################################ # XCode / iPhone / ... ################################################################################ diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index 3f02106..b584fad 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -410,40 +410,41 @@ 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") : 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"]) + 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() + openssl_conf.Finish() # Bonjour if env["PLATFORM"] == "darwin" : -- cgit v0.10.2-6-g49f6