Fix Cygwin compilation:

- Fix various incompatibilities and differences between Linux and Cygwin builds
- Make usrsctp an optional dependency
- Fix building without SSL
- Add new secure random bytes function, use it for websockets
- Switch to libsrtp2 v2.6.0 (currently latest release)
- Add patch that makes latest libsrtp2 build in latest Cygwin
- Add patch that makes srt build in latest Cygwin
- Correctly allow linking libsrtp2 and srt to local mbedtls version
This commit is contained in:
Thulinma 2024-03-26 12:04:53 +01:00
parent db30be38c5
commit dbafa808b8
23 changed files with 131 additions and 23 deletions

View file

@ -99,9 +99,9 @@ message('Building release @0@ for version @1@ @ debug level @2@'.format(release,
# Set dependencies
mist_deps = []
ccpp = meson.get_compiler('cpp')
if usessl
ccpp = meson.get_compiler('cpp')
mbedtls = ccpp.find_library('mbedtls', required: false)
mbedx509 = ccpp.find_library('mbedx509', required: false)
mbedcrypto = ccpp.find_library('mbedcrypto', required: false)
@ -141,9 +141,16 @@ if usessl
endif
mist_deps += [mbedtls, mbedx509, mbedcrypto]
mist_deps += dependency('libsrtp2', default_options: ['tests=disabled'], fallback: ['libsrtp2', 'libsrtp2_dep'])
mist_deps += dependency('libsrtp2', default_options: ['tests=disabled', 'crypto-library=mbedtls'], fallback: ['libsrtp2', 'libsrtp2_dep'])
usrsctp_dep = dependency('usrsctp', fallback: ['usrsctp', 'usrsctp_dep'])
usrsctp_dep = false
if not get_option('NOUSRSCTP') and host_machine.system() != 'cygwin'
usrsctp_dep = dependency('usrsctp', fallback: ['usrsctp', 'usrsctp_dep'])
endif
have_usrsctp = not get_option('NOUSRSCTP') and host_machine.system() != 'cygwin' and usrsctp_dep.found()
if have_usrsctp
option_defines += '-DWITH_DATACHANNELS'
endif
endif
libsrt = false
@ -169,6 +176,12 @@ if not get_option('NOSHM') and host_machine.system() != 'darwin'
mist_deps += ccpp.find_library('rt', required : true)
endif
#
if host_machine.system() == 'cygwin'
option_defines += ['-D_POSIX_C_SOURCE=200112L', '-D_GNU_SOURCE', '-D_TTHREAD_POSIX_', '-D_TTHREAD_PLATFORM_DEFINED_']
option_defines += '-D_GNU_SOURCE'
endif
# Set defines from active options
add_project_arguments(option_defines, language: 'cpp')