Skip to content

Commit

Permalink
py build w/ openssl
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Aug 13, 2023
1 parent 97e8763 commit 98a80f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 98a80f1

Please sign in to comment.