-
-
Save rainbowbird/f40f8f2113dc0dca5f50773d2ca50965 to your computer and use it in GitHub Desktop.
Compile python with statically linked openssl
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
--- a/setup.py 2014-03-17 03:31:31.000000000 +0100 | |
+++ b/setup.py 2014-03-17 19:06:03.000000000 +0100 | |
@@ -750,10 +750,8 @@ | |
exts.append( Extension('_socket', ['socketmodule.c'], | |
depends = ['socketmodule.h']) ) | |
# Detect SSL support for the socket module (via _ssl) | |
- search_for_ssl_incs_in = [ | |
- '/usr/local/ssl/include', | |
- '/usr/contrib/ssl/include/' | |
- ] | |
+ CUSTOM_OPENSSL = '/data2/soft/openssl/' | |
+ search_for_ssl_incs_in = [ os.path.join(CUSTOM_OPENSSL, 'include') ] | |
+ ssl_incs = find_file('openssl/ssl.h', [], | |
search_for_ssl_incs_in | |
) | |
if ssl_incs is not None: | |
@@ -762,17 +761,17 @@ | |
['/usr/kerberos/include']) | |
if krb5_h: | |
ssl_incs += krb5_h | |
- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, | |
- ['/usr/local/ssl/lib', | |
- '/usr/contrib/ssl/lib/' | |
- ] ) | |
+ ssl_libs = find_library_file(self.compiler, 'ssl', [], | |
+ [ os.path.join(CUSTOM_OPENSSL, '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'], | |
+ library_dirs = [], | |
+ extra_link_args = [ os.path.join(CUSTOM_OPENSSL, 'lib/libssl.a'), | |
+ os.path.join(CUSTOM_OPENSSL, 'lib/libcrypto.a'), '-ldl'], | |
depends = ['socketmodule.h']), ) | |
else: | |
missing.append('_ssl') | |
@@ -812,8 +811,9 @@ | |
exts.append( Extension('_hashlib', ['_hashopenssl.c'], | |
depends = ['hashlib.h'], | |
include_dirs = ssl_incs, | |
- library_dirs = ssl_libs, | |
- libraries = ['ssl', 'crypto']) ) | |
+ library_dirs = [], | |
+ extra_link_args = [ os.path.join(CUSTOM_OPENSSL, 'lib/libssl.a'), | |
+ os.path.join(CUSTOM_OPENSSL, 'lib/libcrypto.a'), '-ldl'],) ) | |
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