aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-05-24 12:49:18 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2017-05-24 12:49:18 -0700
commitadeaacfa567b32401d3bef848b78d078bf4393ec (patch)
tree7486ba41d5e0f40e4b2e5b317b668b8db3b6041b /src
parentcd5b47fceba4b78d16e584a6703f4ab837c040fd (diff)
downloadcryptography-adeaacfa567b32401d3bef848b78d078bf4393ec.tar.gz
cryptography-adeaacfa567b32401d3bef848b78d078bf4393ec.tar.bz2
cryptography-adeaacfa567b32401d3bef848b78d078bf4393ec.zip
allow global suppression of link flags (#3592)
CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS will now suppress link flags regardless of platform. Additionally, CRYPTOGRAPHY_WINDOWS_LINK_LEGACY_OPENSSL is now the flag you need if you want to link against < 1.1.0 on windows.
Diffstat (limited to 'src')
-rw-r--r--src/_cffi_src/build_openssl.py35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py
index 7e8fb34b..853f4488 100644
--- a/src/_cffi_src/build_openssl.py
+++ b/src/_cffi_src/build_openssl.py
@@ -13,27 +13,22 @@ from _cffi_src.utils import (
def _get_openssl_libraries(platform):
+ if os.environ.get("CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS", None):
+ return []
# OpenSSL goes by a different library name on different operating systems.
- if platform == "darwin":
- return _osx_libraries(
- os.environ.get("CRYPTOGRAPHY_OSX_NO_LINK_FLAGS")
- )
- elif platform == "win32":
- windows_link_openssl110 = os.environ.get(
- "CRYPTOGRAPHY_WINDOWS_LINK_OPENSSL110", None
+ if platform == "win32" and compiler_type() == "msvc":
+ windows_link_legacy_openssl = os.environ.get(
+ "CRYPTOGRAPHY_WINDOWS_LINK_LEGACY_OPENSSL", None
)
- if compiler_type() == "msvc":
- if windows_link_openssl110 is not None:
- # Link against the 1.1.0 names
- libs = ["libssl", "libcrypto"]
- else:
- # Link against the 1.0.2 and lower names
- libs = ["libeay32", "ssleay32"]
+ if windows_link_legacy_openssl is None:
+ # Link against the 1.1.0 names
+ libs = ["libssl", "libcrypto"]
else:
- # Support mingw, which behaves unix-like and prefixes "lib"
- libs = ["ssl", "crypto"]
+ # Link against the 1.0.2 and lower names
+ libs = ["libeay32", "ssleay32"]
return libs + ["advapi32", "crypt32", "gdi32", "user32", "ws2_32"]
else:
+ # darwin, linux, mingw all use this path
# In some circumstances, the order in which these libs are
# specified on the linker command-line is significant;
# libssl must come before libcrypto
@@ -41,14 +36,6 @@ def _get_openssl_libraries(platform):
return ["ssl", "crypto"]
-def _osx_libraries(build_static):
- # For building statically we don't want to pass the -lssl or -lcrypto flags
- if build_static == "1":
- return []
- else:
- return ["ssl", "crypto"]
-
-
ffi = build_ffi_for_binding(
module_name="_openssl",
module_prefix="_cffi_src.openssl.",