提交 33639a84 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Merge branch 'issue-353' into v3

gyp stuff for libsrtp taken from Chromium project:
https://chromium.googlesource.com/chromium/deps/libsrtp/+/master/
# libsrtp dependency for mediasoup
Here we provide our own `libsrtp.gyp` for mediasoup which is inspired by the corresponding file in Chromium sources. However, Chromium has migrated from GYP to GN:
* https://chromium.googlesource.com/chromium/deps/libsrtp/+/master/BUILD.gn
## IMPORTANT
When the `libsrtp` dependency is updated to a new version, we must update according the `config/config.h` file which defines C macros with the new version.
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
// This is a stub config.h for libSRTP. It doesn't define anything besides // This is a stub config.h for libSRTP. It doesn't define anything besides
// version number strings because the build is configured by libsrtp.gyp. // version number strings because the build is configured by libsrtp.gyp.
#define PACKAGE_STRING "libsrtp 2.0.0" #define PACKAGE_STRING "libsrtp 2.3.0"
#define PACKAGE_VERSION "2.0.0" #define PACKAGE_VERSION "2.3.0"
#if defined(_MSC_VER) && !defined(__cplusplus) #if defined(_MSC_VER) && !defined(__cplusplus)
// Microsoft provides "inline" only for C++ code // Microsoft provides "inline" only for C++ code
......
# NOTE: Inspired by https://chromium.googlesource.com/chromium/deps/libsrtp/+/master/libsrtp.gyp
#
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
...@@ -11,60 +9,55 @@ ...@@ -11,60 +9,55 @@
}, },
'target_defaults': { 'target_defaults': {
'defines': [ 'defines': [
# Config.
'HAVE_CONFIG_H', 'HAVE_CONFIG_H',
# Platform properties.
'HAVE_STDLIB_H', 'HAVE_STDLIB_H',
'HAVE_STRING_H', 'HAVE_STRING_H',
'TESTAPP_SOURCE', 'HAVE_STDINT_H',
], 'HAVE_INTTYPES_H',
'include_dirs': [ 'HAVE_INT8_T',
'./config', 'HAVE_INT16_T',
'srtp/include', 'HAVE_INT32_T',
'srtp/crypto/include', 'HAVE_UINT8_T',
'HAVE_UINT16_T',
'HAVE_UINT32_T',
'HAVE_UINT64_T',
], ],
'conditions': [ 'conditions': [
['use_openssl==1', { [ 'use_openssl == 1', {
'defines': [ 'defines': [
'OPENSSL', 'OPENSSL',
'GCM', 'GCM',
], ],
}], }],
# NOTE: Avoid having to set os_posix. [ 'OS != "win"', {
# ['os_posix==1', {
['OS!="win"', {
'defines': [ 'defines': [
'HAVE_INT16_T',
'HAVE_INT32_T',
'HAVE_INT8_T',
'HAVE_UINT16_T',
'HAVE_UINT32_T',
'HAVE_UINT64_T',
'HAVE_UINT8_T',
'HAVE_STDINT_H',
'HAVE_INTTYPES_H',
'HAVE_NETINET_IN_H',
'HAVE_ARPA_INET_H', 'HAVE_ARPA_INET_H',
'HAVE_NETINET_IN_H',
'HAVE_SYS_TYPES_H',
'HAVE_UNISTD_H', 'HAVE_UNISTD_H',
], ],
'cflags': [ 'cflags': [ '-Wall', '-Wno-unused-variable', '-Wno-sign-compare' ],
'-Wno-unused-variable',
],
}], }],
['OS=="win"', { [ 'OS == "mac"', {
'xcode_settings':
{
'WARNING_CFLAGS': [ '-Wall', '-Wno-unused-variable', '-Wno-sign-compare' ],
}
}],
[ 'OS == "win"', {
'defines': [ 'defines': [
'HAVE_BYTESWAP_METHODS_H',
# All Windows architectures are this way.
'SIZEOF_UNSIGNED_LONG=4',
'SIZEOF_UNSIGNED_LONG_LONG=8',
'HAVE_WINSOCK2_H', 'HAVE_WINSOCK2_H',
], ],
}], }],
['target_arch=="x64" or target_arch=="ia32"', { [ 'target_arch == "x64" or target_arch == "ia32"', {
'defines': [ 'defines': [
'CPU_CISC', 'CPU_CISC',
], ],
}], }],
['target_arch=="arm" or target_arch=="arm64" \ [ 'target_arch == "arm" or target_arch == "arm64" \
or target_arch=="mipsel" or target_arch=="mips64el"', { or target_arch == "mipsel" or target_arch == "mips64el"', {
'defines': [ 'defines': [
# TODO(leozwang): CPU_RISC doesn't work properly on android/arm and # TODO(leozwang): CPU_RISC doesn't work properly on android/arm and
# mips platforms for unknown reasons, need to investigate the root # mips platforms for unknown reasons, need to investigate the root
...@@ -74,55 +67,18 @@ ...@@ -74,55 +67,18 @@
'CPU_CISC', 'CPU_CISC',
], ],
}], }],
['target_arch=="mipsel" or target_arch=="arm" or target_arch=="ia32"', { ],
'defines': [ 'include_dirs': [
# Define FORCE_64BIT_ALIGN to avoid alignment-related-crashes like './config',
# crbug/414919. Without this, aes_cbc_alloc will allocate an 'srtp/include',
# aes_cbc_ctx_t not 64-bit aligned and the v128_t members of 'srtp/crypto/include',
# aes_cbc_ctx_t will not be 64-bit aligned, which breaks the
# compiler optimizations that assume 64-bit alignment of v128_t.
'FORCE_64BIT_ALIGN',
],
}],
], ],
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include_dirs': [
# NOTE: I don't think we must export this.
'srtp/include', 'srtp/include',
# NOTE: I don't think we must export this. # NOTE: I don't think we must export this.
# 'srtp/crypto/include', # 'srtp/crypto/include',
], ],
'conditions': [
# NOTE: Avoid having to set os_posix.
# ['os_posix==1', {
['OS!="win"', {
'defines': [
'HAVE_INT16_T',
'HAVE_INT32_T',
'HAVE_INT8_T',
'HAVE_UINT16_T',
'HAVE_UINT32_T',
'HAVE_UINT64_T',
'HAVE_UINT8_T',
'HAVE_STDINT_H',
'HAVE_INTTYPES_H',
'HAVE_NETINET_IN_H',
],
}],
['OS=="win"', {
'defines': [
'HAVE_BYTESWAP_METHODS_H',
# All Windows architectures are this way.
'SIZEOF_UNSIGNED_LONG=4',
'SIZEOF_UNSIGNED_LONG_LONG=8',
],
}],
['target_arch=="x64" or target_arch=="ia32"', {
'defines': [
'CPU_CISC',
],
}],
],
}, },
}, },
'targets': [ 'targets': [
...@@ -130,13 +86,12 @@ ...@@ -130,13 +86,12 @@
'target_name': 'libsrtp', 'target_name': 'libsrtp',
'type': 'static_library', 'type': 'static_library',
'sources': [ 'sources': [
# includes # Includes.
'srtp/include/ekt.h', 'srtp/include/ekt.h',
'srtp/include/getopt_s.h',
'srtp/include/srtp.h', 'srtp/include/srtp.h',
# Headers.
'srtp/include/srtp_priv.h', 'srtp/include/srtp_priv.h',
'srtp/include/ut_sim.h', 'srtp/include/ut_sim.h',
# headers
'srtp/crypto/include/aes.h', 'srtp/crypto/include/aes.h',
'srtp/crypto/include/aes_gcm.h', 'srtp/crypto/include/aes_gcm.h',
'srtp/crypto/include/aes_icm.h', 'srtp/crypto/include/aes_icm.h',
...@@ -159,7 +114,7 @@ ...@@ -159,7 +114,7 @@
'srtp/crypto/include/rdbx.h', 'srtp/crypto/include/rdbx.h',
'srtp/crypto/include/sha1.h', 'srtp/crypto/include/sha1.h',
'srtp/crypto/include/stat.h', 'srtp/crypto/include/stat.h',
# sources # Sources.
'srtp/srtp/ekt.c', 'srtp/srtp/ekt.c',
'srtp/srtp/srtp.c', 'srtp/srtp/srtp.c',
'srtp/crypto/cipher/aes.c', 'srtp/crypto/cipher/aes.c',
...@@ -181,7 +136,7 @@ ...@@ -181,7 +136,7 @@
'srtp/crypto/replay/ut_sim.c', 'srtp/crypto/replay/ut_sim.c',
], ],
'conditions': [ 'conditions': [
['use_openssl==1', { [ 'use_openssl == 1', {
'dependencies': [ 'dependencies': [
'<(DEPTH)/deps/openssl/openssl.gyp:openssl', '<(DEPTH)/deps/openssl/openssl.gyp:openssl',
], ],
...@@ -197,203 +152,6 @@ ...@@ -197,203 +152,6 @@
], ],
}], }],
], ],
}, # target libsrtp
{
'target_name': 'rdbx_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/include/getopt_s.h',
'srtp/test/getopt_s.c',
'srtp/test/rdbx_driver.c',
],
},
{
'target_name': 'srtp_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/include/getopt_s.h',
'srtp/include/srtp_priv.h',
'srtp/test/getopt_s.c',
'srtp/test/srtp_driver.c',
],
},
{
'target_name': 'roc_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/include/rdbx.h',
'srtp/include/ut_sim.h',
'srtp/test/roc_driver.c',
],
},
{
'target_name': 'replay_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/include/rdbx.h',
'srtp/include/ut_sim.h',
'srtp/test/replay_driver.c',
],
},
{
'target_name': 'rtpw',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/include/getopt_s.h',
'srtp/include/rtp.h',
'srtp/include/srtp.h',
'srtp/crypto/include/datatypes.h',
'srtp/test/getopt_s.c',
'srtp/test/rtp.c',
'srtp/test/rtpw.c',
],
'conditions': [
['OS=="android"', {
'defines': [
'HAVE_SYS_SOCKET_H',
],
}],
],
},
{
'target_name': 'srtp_test_cipher_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/cipher_driver.c',
'srtp/include/getopt_s.h',
'srtp/test/getopt_s.c',
],
'conditions': [
['use_openssl==1', {
'dependencies': [
'<(DEPTH)/deps/openssl/openssl.gyp:openssl',
],
}],
],
},
{
'target_name': 'srtp_test_datatypes_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/datatypes_driver.c',
],
},
{
'target_name': 'srtp_test_stat_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/stat_driver.c',
],
},
{
'target_name': 'srtp_test_sha1_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/sha1_driver.c',
],
},
{
'target_name': 'srtp_test_kernel_driver',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/kernel_driver.c',
'srtp/include/getopt_s.h',
'srtp/test/getopt_s.c',
],
},
{
'target_name': 'srtp_test_aes_calc',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/aes_calc.c',
],
},
{
'target_name': 'srtp_test_rand_gen',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/rand_gen.c',
'srtp/include/getopt_s.h',
'srtp/test/getopt_s.c',
],
},
{
'target_name': 'srtp_test_rand_gen_soak',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/rand_gen_soak.c',
'srtp/include/getopt_s.h',
'srtp/test/getopt_s.c',
],
},
{
'target_name': 'srtp_test_env',
'type': 'executable',
'dependencies': [
'libsrtp',
],
'sources': [
'srtp/crypto/test/env.c',
],
},
{
'target_name': 'srtp_runtest',
'type': 'none',
'dependencies': [
'rdbx_driver',
'srtp_driver',
'roc_driver',
'replay_driver',
'rtpw',
'srtp_test_cipher_driver',
'srtp_test_datatypes_driver',
'srtp_test_stat_driver',
'srtp_test_sha1_driver',
'srtp_test_kernel_driver',
'srtp_test_aes_calc',
'srtp_test_rand_gen',
'srtp_test_rand_gen_soak',
'srtp_test_env',
],
}, },
], # targets ], # targets
} }
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论