From 1055431497ded70c1ef766ea7e543e6c4bc4f0da Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 29 Aug 2015 15:47:53 -0500 Subject: add support for static linking of the openssl backend on OS X --- src/_cffi_src/build_openssl.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/_cffi_src/build_openssl.py') diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py index 6a5bf2da..bd8cf73e 100644 --- a/src/_cffi_src/build_openssl.py +++ b/src/_cffi_src/build_openssl.py @@ -4,6 +4,7 @@ from __future__ import absolute_import, division, print_function +import os import sys from _cffi_src.utils import build_ffi_for_binding, extra_link_args @@ -11,15 +12,27 @@ from _cffi_src.utils import build_ffi_for_binding, extra_link_args def _get_openssl_libraries(platform): # OpenSSL goes by a different library name on different operating systems. - if platform != "win32": + if platform == "darwin": + return _osx_libraries( + os.environ.get("CRYPTOGRAPHY_BUILD_STATIC", None) + ) + elif platform == "win32": + return ["libeay32", "ssleay32", "advapi32", + "crypt32", "gdi32", "user32", "ws2_32"] + else: # In some circumstances, the order in which these libs are # specified on the linker command-line is significant; # libssl must come before libcrypto # (http://marc.info/?l=openssl-users&m=135361825921871) 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 ["libeay32", "ssleay32", "advapi32", - "crypt32", "gdi32", "user32", "ws2_32"] + return ["ssl", "crypto"] _OSX_PRE_INCLUDE = """ -- cgit v1.2.3 From 7539dcb6e424e27f6bb270571b9410bd6ad36aac Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 29 Aug 2015 21:00:54 -0500 Subject: no need for None --- src/_cffi_src/build_openssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/_cffi_src/build_openssl.py') diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py index bd8cf73e..49d7464c 100644 --- a/src/_cffi_src/build_openssl.py +++ b/src/_cffi_src/build_openssl.py @@ -14,7 +14,7 @@ def _get_openssl_libraries(platform): # OpenSSL goes by a different library name on different operating systems. if platform == "darwin": return _osx_libraries( - os.environ.get("CRYPTOGRAPHY_BUILD_STATIC", None) + os.environ.get("CRYPTOGRAPHY_BUILD_STATIC") ) elif platform == "win32": return ["libeay32", "ssleay32", "advapi32", -- cgit v1.2.3 From 7402cf1c676ffb7ba48d6e90227bb4b1397af12d Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 31 Aug 2015 12:34:30 -0500 Subject: rename env var to CRYPTOGRAPHY_OSX_NO_LINK_FLAGS --- src/_cffi_src/build_openssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/_cffi_src/build_openssl.py') diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py index 49d7464c..defa69d3 100644 --- a/src/_cffi_src/build_openssl.py +++ b/src/_cffi_src/build_openssl.py @@ -14,7 +14,7 @@ def _get_openssl_libraries(platform): # OpenSSL goes by a different library name on different operating systems. if platform == "darwin": return _osx_libraries( - os.environ.get("CRYPTOGRAPHY_BUILD_STATIC") + os.environ.get("CRYPTOGRAPHY_OSX_NO_LINK_FLAGS") ) elif platform == "win32": return ["libeay32", "ssleay32", "advapi32", -- cgit v1.2.3