1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 08:16:54 +00:00
borg/setup_crypto.py
2019-03-14 00:18:15 +01:00

18 lines
664 B
Python

# Support code for building a C extension with crypto from OpenSSL / LibreSSL
import os
def crypto_ext_kwargs(pc):
system_prefix = os.environ.get('BORG_OPENSSL_PREFIX')
if system_prefix:
print('Detected OpenSSL [via BORG_OPENSSL_PREFIX]')
return dict(include_dirs=[os.path.join(system_prefix, 'include')],
library_dirs=[os.path.join(system_prefix, 'lib')],
libraries=['crypto'])
if pc and pc.exists('libcrypto'):
print('Detected OpenSSL [via pkg-config]')
return pc.parse('libcrypto')
raise Exception('Could not find OpenSSL lib/headers, please set BORG_OPENSSL_PREFIX')