Last active
February 4, 2021 09:59
-
-
Save rkitover/2d9e5baff1f1cc4f2618dee53083bd35 to your computer and use it in GitHub Desktop.
static openssl patch for python 2.7.14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ruN Python-2.7.14.orig/setup.py Python-2.7.14.new/setup.py | |
--- Python-2.7.14.orig/setup.py 2017-09-16 10:38:35.000000000 -0700 | |
+++ Python-2.7.14.new/setup.py 2017-11-16 07:48:31.368080272 -0800 | |
@@ -808,10 +808,15 @@ | |
depends=['socketmodule.h'], | |
libraries=math_libs) ) | |
# Detect SSL support for the socket module (via _ssl) | |
+ openssl_root = os.getenv('OPENSSL_ROOT') | |
+ | |
search_for_ssl_incs_in = [ | |
'/usr/local/ssl/include', | |
'/usr/contrib/ssl/include/' | |
] | |
+ if openssl_root is not None: | |
+ search_for_ssl_incs_in.insert(0, os.path.join(openssl_root, 'include')) | |
+ | |
ssl_incs = find_file('openssl/ssl.h', inc_dirs, | |
search_for_ssl_incs_in | |
) | |
@@ -824,14 +829,25 @@ | |
['/usr/local/ssl/lib', | |
'/usr/contrib/ssl/lib/' | |
] ) | |
+ if openssl_root is not None: | |
+ ssl_libs.insert(0, os.path.join(openssl_root, 'lib')) | |
if (ssl_incs is not None and | |
ssl_libs is not None): | |
- exts.append( Extension('_ssl', ['_ssl.c'], | |
- include_dirs = ssl_incs, | |
- library_dirs = ssl_libs, | |
- libraries = ['ssl', 'crypto'], | |
- depends = ['socketmodule.h']), ) | |
+ if openssl_root is not None: | |
+ exts.append( Extension('_ssl', ['_ssl.c'], | |
+ include_dirs = ssl_incs, | |
+ library_dirs = [], | |
+ libraries = [], | |
+ extra_link_args = [ os.path.join(openssl_root, 'lib/libssl.a'), | |
+ os.path.join(openssl_root, 'lib/libcrypto.a'), '-ldl' ], | |
+ depends = ['socketmodule.h'])) | |
+ else: | |
+ exts.append( Extension('_ssl', ['_ssl.c'], | |
+ include_dirs = ssl_incs, | |
+ library_dirs = ssl_libs, | |
+ libraries = ['ssl', 'crypto'], | |
+ depends = ['socketmodule.h'])) | |
else: | |
missing.append('_ssl') | |
@@ -866,10 +882,18 @@ | |
if have_usable_openssl: | |
# The _hashlib module wraps optimized implementations | |
# of hash functions from the OpenSSL library. | |
- exts.append( Extension('_hashlib', ['_hashopenssl.c'], | |
- include_dirs = ssl_incs, | |
- library_dirs = ssl_libs, | |
- libraries = ['ssl', 'crypto']) ) | |
+ if openssl_root is not None: | |
+ exts.append( Extension('_hashlib', ['_hashopenssl.c'], | |
+ include_dirs = ssl_incs, | |
+ library_dirs = [], | |
+ libraries = [], | |
+ extra_link_args = [ os.path.join(openssl_root, 'lib/libssl.a'), | |
+ os.path.join(openssl_root, 'lib/libcrypto.a'), '-ldl' ])) | |
+ else: | |
+ exts.append( Extension('_hashlib', ['_hashopenssl.c'], | |
+ include_dirs = ssl_incs, | |
+ library_dirs = ssl_libs, | |
+ libraries = ['ssl', 'crypto'])) | |
else: | |
print ("warning: openssl 0x%08x is too old for _hashlib" % | |
openssl_ver) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is based on:
https://gist.github.com/eddy-geek/9604982