Skip to content

Commit 09a139b

Browse files
committed
py build w/ openssl
1 parent b82c715 commit 09a139b

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include LICENSE
44
include README.md
55

66
include configure/CONFIG_PVXS_VERSION
7+
include configure/probe-openssl.c
78
include src/*.h
89
include src/*.h@
910
include src/*.cpp

setup.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,21 @@ def run(self):
138138
'EVENT__HAVE_MBEDTLS':None,
139139
}
140140

141+
probe = ProbeToolchain()
142+
143+
with open('configure/probe-openssl.c', 'r') as F:
144+
if probe.try_compile(F.read()):
145+
DEFS['EVENT__HAVE_OPENSSL'] = '1'
146+
log.info('Enable OpenSSL Support')
147+
else:
148+
log.info('No OpenSSL Support')
149+
141150
DEFS.update(pvxsversion) # PVXS_*_VERSION
142151
DEFS.update(eventversion) # EVENT*VERSION
143152

144153
for var in ('EPICS_HOST_ARCH', 'T_A', 'OS_CLASS', 'CMPLR_CLASS'):
145154
DEFS[var] = get_config_var(var)
146155

147-
probe = ProbeToolchain()
148-
149156
if probe.check_symbol('__GNU_LIBRARY__', headers=['features.h']):
150157
DEFS['_GNU_SOURCE'] = '1'
151158
probe.define_macros += [('_GNU_SOURCE', None)]
@@ -523,6 +530,11 @@ def define_DSOS(self):
523530
elif DEFS['EVENT__HAVE_SELECT']=='1':
524531
src_core += ['select.c']
525532

533+
pvxs_tls_macros = []
534+
if DEFS['EVENT__HAVE_OPENSSL']=='1':
535+
src_core += ['bufferevent_openssl.c', 'bufferevent_ssl.c']
536+
pvxs_tls_macros += [('PVXS_ENABLE_OPENSSL', None)]
537+
526538
src_core = [os.path.join('bundle', 'libevent', src) for src in src_core]
527539

528540
src_pvxs = [
@@ -566,11 +578,16 @@ def define_DSOS(self):
566578
src_pvxs += ['src/os/WIN32/osdSockExt.cpp']
567579
else:
568580
src_pvxs += ['src/os/default/osdSockExt.cpp']
581+
if DEFS['EVENT__HAVE_OPENSSL']=='1':
582+
src_pvxs += ['src/ossl.cpp']
569583

570584
event_libs = []
571585
if OS_CLASS=='WIN32':
572586
event_libs = ['ws2_32','shell32','advapi32','bcrypt','iphlpapi']
573587

588+
if DEFS['EVENT__HAVE_OPENSSL']=='1':
589+
event_libs += ['ssl', 'crypto']
590+
574591
src_pvxsIoc = [
575592
"ioc/channel.cpp",
576593
"ioc/credentials.cpp",
@@ -639,7 +656,11 @@ def define_DSOS(self):
639656
libraries = event_libs,
640657
),
641658
DSO('pvxslibs.lib.pvxs', src_pvxs,
642-
define_macros = [('PVXS_API_BUILDING', None), ('PVXS_ENABLE_EXPERT_API', None)] + get_config_var('CPPFLAGS'),
659+
define_macros = [
660+
('PVXS_API_BUILDING', None),
661+
('PVXS_ENABLE_EXPERT_API', None),
662+
('PVXS_ENABLE_SSLKEYLOGFILE', None),
663+
] + pvxs_tls_macros + get_config_var('CPPFLAGS'),
643664
include_dirs=[
644665
'bundle/libevent/include',
645666
'src',

0 commit comments

Comments
 (0)