Added support for a local copy of dependencies, when the system version is not compatible or available

Change-Id: Ibd5c74bff376df49631710e72136416197251d62
This commit is contained in:
Thulinma 2022-12-28 13:19:56 +01:00
parent 529adbfaf6
commit 00833223e1
9 changed files with 273 additions and 10 deletions

View file

@ -1,6 +1,7 @@
#include "certificate.h" #include "certificate.h"
#include "defines.h" #include "defines.h"
#include <string.h> #include <string.h>
#include <ctime>
Certificate::Certificate(){ Certificate::Certificate(){

View file

@ -92,26 +92,49 @@ message('Building release @0@ for version @1@ @ debug level @2@'.format(release,
ssl_deps = [] ssl_deps = []
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)
# Test if we can compile the way we expect
code_ddvtech = '''
#include <mbedtls/ssl.h>
mbedtls_ssl_srtp_profile srtp_profiles[] ={MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_80,
MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_32};
static int test()
{
mbedtls_ssl_config ssl_conf;
mbedtls_ssl_conf_dtls_srtp_protection_profiles(&ssl_conf, srtp_profiles,
sizeof(srtp_profiles) / sizeof(srtp_profiles[0]));
return 0;
}
'''
ddvtech_mbedtls = ccpp.compiles(code_ddvtech, dependencies: [mbedtls, mbedx509, mbedcrypto], name: 'MbedTLS is DDVTech fork')
if not mbedtls.found() or not ddvtech_mbedtls
mbedtls_proj = subproject('mbedtls')
mbedtls = mbedtls_proj.get_variable('mbedtls_dep')
mbedx509 = mbedtls_proj.get_variable('mbedx509_dep')
mbedcrypto = mbedtls_proj.get_variable('mbedcrypto_dep')
endif
srtp2 = dependency('libsrtp2', fallback : ['libsrtp2', 'libsrtp2_dep'])
ssl_deps = [mbedtls, mbedx509, mbedcrypto, srtp2]
endif
libsrt = false libsrt = false
if not get_option('NOSRT') if not get_option('NOSRT')
libsrt = dependency('srt', required: false) libsrt = dependency('srt', fallback: ['libsrt', 'srt_dep'])
endif endif
have_srt = not get_option('NOSRT') and libsrt.found() have_srt = not get_option('NOSRT') and libsrt.found()
librist = false librist = false
if not get_option('NORIST') if not get_option('NORIST')
librist = dependency('librist', required: false) librist = dependency('librist', fallback: ['librist', 'librist_dep'], default_options:['test=false', 'built_tools=false'])
endif endif
have_librist = not get_option('NORIST') and librist.found() have_librist = not get_option('NORIST') and librist.found()
if usessl
ccpp = meson.get_compiler('cpp')
mbedtls = ccpp.find_library('mbedtls')
mbedx509 = ccpp.find_library('mbedx509')
mbedcrypto = ccpp.find_library('mbedcrypto')
srtp2 = dependency('libsrtp2')
ssl_deps = [mbedtls, mbedx509, mbedcrypto, srtp2]
endif
# Set build targets # Set build targets

8
subprojects/librist.wrap Normal file
View file

@ -0,0 +1,8 @@
[wrap-git]
directory = librist
url = https://code.videolan.org/rist/librist.git
revision = v0.2.7
[provide]
dependency_names = librist

9
subprojects/libsrt.wrap Normal file
View file

@ -0,0 +1,9 @@
[wrap-git]
directory = srt
url = https://github.com/Haivision/srt.git
revision = v1.5.1
patch_directory = libsrt
[provide]
dependency_names = srt

View file

@ -0,0 +1,8 @@
[wrap-git]
directory = libsrtp
url = https://github.com/cisco/libsrtp.git
revision = 1b6deccb216e3cd88bf7ce563b34557b3897c2dd
[provide]
libsrtp2 = libsrtp2_dep

10
subprojects/mbedtls.wrap Normal file
View file

@ -0,0 +1,10 @@
[wrap-git]
url = https://github.com/livepeer/mbedtls.git
revision = dtls_srtp_support
depth = 1
patch_directory = mbedtls
[provide]
mbedcrypto = mbedcrypto_dep
mbedx509 = mbedx509_dep
mbedtls = mbedtls_dep

View file

@ -0,0 +1,77 @@
project('SRT', 'cpp', 'c', version: '1.5.1')
add_project_arguments(['-DENABLE_LOGGING=1', '-O3', '-DNDEBUG', '-DENABLE_MONOTONIC_CLOCK=1', '-DENABLE_NEW_RCVBUFFER=1', '-DENABLE_SOCK_CLOEXEC=1', '-DHAI_ENABLE_SRT=1', '-DHAI_PATCH=1', '-DHAVE_INET_PTON=1', '-DHAVE_PTHREAD_GETNAME_NP=1', '-DHAVE_PTHREAD_SETNAME_NP=1', '-DLINUX=1', '-DNDEBUG', '-DSRT_DYNAMIC', '-DSRT_ENABLE_APP_READER', '-DSRT_ENABLE_BINDTODEVICE', '-DSRT_ENABLE_CLOSE_SYNCH', '-DSRT_ENABLE_ENCRYPTION', '-DSRT_EXPORTS', '-DSRT_VERSION="1.5.1"', '-DUSE_MBEDTLS=1', '-D_GNU_SOURCE'], language: ['cpp','c'])
mbedcrypto_lib = dependency('mbedcrypto', required: false)
mbedx509_lib = dependency('mbedx509', required: false)
mbedtls_lib = dependency('mbedtls', required: false)
if not mbedtls_lib.found()
ccpp = meson.get_compiler('cpp')
mbedtls_lib = ccpp.find_library('mbedtls')
mbedx509_lib = ccpp.find_library('mbedx509')
mbedcrypto_lib = ccpp.find_library('mbedcrypto')
endif
header_tgts = []
subdir('srt')
srt_src = files(
'srtcore/api.cpp',
'srtcore/buffer.cpp',
'srtcore/buffer_rcv.cpp',
'srtcore/cache.cpp',
'srtcore/channel.cpp',
'srtcore/common.cpp',
'srtcore/core.cpp',
'srtcore/crypto.cpp',
'srtcore/epoll.cpp',
'srtcore/fec.cpp',
'srtcore/handshake.cpp',
'srtcore/list.cpp',
'srtcore/logger_default.cpp',
'srtcore/logger_defs.cpp',
'srtcore/md5.cpp',
'srtcore/packet.cpp',
'srtcore/packetfilter.cpp',
'srtcore/queue.cpp',
'srtcore/congctl.cpp',
'srtcore/socketconfig.cpp',
'srtcore/srt_c_api.cpp',
'srtcore/strerror_defs.cpp',
'srtcore/sync.cpp',
'srtcore/tsbpd_time.cpp',
'srtcore/window.cpp',
'srtcore/sync_posix.cpp',
'haicrypt/haicrypt_log.cpp',
'srtcore/srt_compat.c',
'haicrypt/cryspr.c',
'haicrypt/cryspr-mbedtls.c',
'haicrypt/hcrypt.c',
'haicrypt/hcrypt_ctx_rx.c',
'haicrypt/hcrypt_ctx_tx.c',
'haicrypt/hcrypt_rx.c',
'haicrypt/hcrypt_sa.c',
'haicrypt/hcrypt_tx.c',
'haicrypt/hcrypt_xpt_srt.c',
'srtcore/srt.h',
'srtcore/logging_api.h',
'srtcore/access_control.h',
'srtcore/platform_sys.h',
'srtcore/udt.h'
)
libsrt = library(
'srt',
sources: [srt_src, versionfile],
dependencies: [mbedtls_lib, mbedx509_lib, mbedcrypto_lib],
include_directories: ['srt', 'haicrypt', 'srtcore']
)
srt_dep = declare_dependency(
link_with : [libsrt],
dependencies: [mbedtls_lib, mbedx509_lib, mbedcrypto_lib],
sources: [header_tgts],
include_directories: include_directories('.'),
)

View file

@ -0,0 +1,15 @@
versionfile = configure_file(format: 'cmake@', output: 'version.h', input: files('../srtcore/version.h.in'), configuration: {
'SRT_VERSION_MAJOR': 1,
'SRT_VERSION_MINOR' : 5,
'SRT_VERSION_PATCH': 1,
'CI_BUILD_NUMBER_STRING': '"1.5.1"',
'SRT_VERSION': '1.5.1',
})
header_tgts += configure_file(copy:true, input: files('../srtcore/srt.h'), output: 'srt.h')
header_tgts += configure_file(copy:true, input: files('../srtcore/logging_api.h'), output: 'logging_api.h')
header_tgts += configure_file(copy:true, input: files('../srtcore/access_control.h'), output: 'access_control.h')
header_tgts += configure_file(copy:true, input: files('../srtcore/platform_sys.h'), output: 'platform_sys.h')
header_tgts += configure_file(copy:true, input: files('../srtcore/udt.h'), output: 'udt.h')

View file

@ -0,0 +1,112 @@
project('mbedtls', 'c', default_options: ['optimization=2', 'warning_level=0'])
add_project_arguments(['-Wno-stringop-overflow'], language: 'c')
incl = include_directories('include')
libmbedcrypto = library('mbedcrypto',
'library/aes.c',
'library/aesni.c',
'library/arc4.c',
'library/aria.c',
'library/asn1parse.c',
'library/asn1write.c',
'library/base64.c',
'library/bignum.c',
'library/blowfish.c',
'library/camellia.c',
'library/ccm.c',
'library/chacha20.c',
'library/chachapoly.c',
'library/cipher.c',
'library/cipher_wrap.c',
'library/cmac.c',
'library/ctr_drbg.c',
'library/des.c',
'library/dhm.c',
'library/ecdh.c',
'library/ecdsa.c',
'library/ecjpake.c',
'library/ecp.c',
'library/ecp_curves.c',
'library/entropy.c',
'library/entropy_poll.c',
'library/error.c',
'library/gcm.c',
'library/havege.c',
'library/hkdf.c',
'library/hmac_drbg.c',
'library/md.c',
'library/md2.c',
'library/md4.c',
'library/md5.c',
'library/md_wrap.c',
'library/memory_buffer_alloc.c',
'library/oid.c',
'library/padlock.c',
'library/pem.c',
'library/pk.c',
'library/pk_wrap.c',
'library/pkcs12.c',
'library/pkcs5.c',
'library/pkparse.c',
'library/pkwrite.c',
'library/platform.c',
'library/platform_util.c',
'library/poly1305.c',
'library/ripemd160.c',
'library/rsa.c',
'library/rsa_internal.c',
'library/sha1.c',
'library/sha256.c',
'library/sha512.c',
'library/threading.c',
'library/timing.c',
'library/version.c',
'library/version_features.c',
'library/xtea.c',
include_directories: incl
)
mbedcrypto_dep = declare_dependency(
link_with: [libmbedcrypto],
include_directories: incl,
)
libmbedx509 = library('mbedx509',
'library/certs.c',
'library/pkcs11.c',
'library/x509.c',
'library/x509_create.c',
'library/x509_crl.c',
'library/x509_crt.c',
'library/x509_csr.c',
'library/x509write_crt.c',
'library/x509write_csr.c',
include_directories: incl,
dependencies: mbedcrypto_dep,
)
mbedx509_dep = declare_dependency(
link_with: [libmbedx509],
include_directories: incl,
)
libmbedtls = library('mbedtls',
'library/debug.c',
'library/net_sockets.c',
'library/ssl_cache.c',
'library/ssl_ciphersuites.c',
'library/ssl_cli.c',
'library/ssl_cookie.c',
'library/ssl_srv.c',
'library/ssl_ticket.c',
'library/ssl_tls.c',
include_directories: incl,
dependencies: [mbedx509_dep, mbedcrypto_dep],
)
mbedtls_dep = declare_dependency(
link_with: [libmbedtls],
include_directories: incl,
)