From 33b961b760569b91d4fda74272afbf6ce1a8422d Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 12 Aug 2023 15:44:51 -0700 Subject: [PATCH] py build w/ openssl --- MANIFEST.in | 1 + setup.py | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index a1074ed6b..db8a90a8e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include LICENSE include README.md include configure/CONFIG_PVXS_VERSION +include configure/probe-openssl.c include src/*.h include src/*.h@ include src/*.cpp diff --git a/setup.py b/setup.py index b899118fe..a0bc1329f 100755 --- a/setup.py +++ b/setup.py @@ -138,14 +138,21 @@ def run(self): 'EVENT__HAVE_MBEDTLS':None, } + probe = ProbeToolchain() + + with open('configure/probe-openssl.c', 'r') as F: + if probe.try_compile(F.read()): + DEFS['EVENT__HAVE_OPENSSL'] = '1' + log.info('Enable OpenSSL Support') + else: + log.info('No OpenSSL Support') + DEFS.update(pvxsversion) # PVXS_*_VERSION DEFS.update(eventversion) # EVENT*VERSION for var in ('EPICS_HOST_ARCH', 'T_A', 'OS_CLASS', 'CMPLR_CLASS'): DEFS[var] = get_config_var(var) - probe = ProbeToolchain() - if probe.check_symbol('__GNU_LIBRARY__', headers=['features.h']): DEFS['_GNU_SOURCE'] = '1' probe.define_macros += [('_GNU_SOURCE', None)] @@ -523,6 +530,11 @@ def define_DSOS(self): elif DEFS['EVENT__HAVE_SELECT']=='1': src_core += ['select.c'] + pvxs_tls_macros = [] + if DEFS['EVENT__HAVE_OPENSSL']=='1': + src_core += ['bufferevent_openssl.c', 'bufferevent_ssl.c'] + pvxs_tls_macros += [('PVXS_ENABLE_OPENSSL', None)] + src_core = [os.path.join('bundle', 'libevent', src) for src in src_core] src_pvxs = [ @@ -566,11 +578,16 @@ def define_DSOS(self): src_pvxs += ['src/os/WIN32/osdSockExt.cpp'] else: src_pvxs += ['src/os/default/osdSockExt.cpp'] + if DEFS['EVENT__HAVE_OPENSSL']=='1': + src_pvxs += ['src/ossl.cpp'] event_libs = [] if OS_CLASS=='WIN32': event_libs = ['ws2_32','shell32','advapi32','bcrypt','iphlpapi'] + if DEFS['EVENT__HAVE_OPENSSL']=='1': + event_libs += ['ssl', 'crypto'] + src_pvxsIoc = [ "ioc/channel.cpp", "ioc/credentials.cpp", @@ -639,7 +656,11 @@ def define_DSOS(self): libraries = event_libs, ), DSO('pvxslibs.lib.pvxs', src_pvxs, - define_macros = [('PVXS_API_BUILDING', None), ('PVXS_ENABLE_EXPERT_API', None)] + get_config_var('CPPFLAGS'), + define_macros = [ + ('PVXS_API_BUILDING', None), + ('PVXS_ENABLE_EXPERT_API', None), + ('PVXS_ENABLE_SSLKEYLOGFILE', None), + ] + pvxs_tls_macros + get_config_var('CPPFLAGS'), include_dirs=[ 'bundle/libevent/include', 'src',