Sync code

This commit is contained in:
starlet-dx 2024-05-27 17:16:45 +08:00
parent f84b9eacbc
commit 5f41af1be6
4 changed files with 172 additions and 1 deletions

View File

@ -0,0 +1,93 @@
From 38f5ccb11453fc2d612b06aa7a506c28d8f8363f Mon Sep 17 00:00:00 2001
From: SE2Dev <5873790+SE2Dev@users.noreply.github.com>
Date: Wed, 13 Oct 2021 22:45:11 +0000
Subject: [PATCH] Export CMake Targets
---
CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
Config.cmake.in | 3 +++
2 files changed, 49 insertions(+), 2 deletions(-)
create mode 100644 Config.cmake.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e15e851..4e47a2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -240,7 +240,11 @@ add_library(srtp2
set_target_properties(srtp2 PROPERTIES VERSION ${CMAKE_PROJECT_VERSION})
-target_include_directories(srtp2 PUBLIC crypto/include include)
+target_include_directories(srtp2 PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/crypto/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:/include>
+)
if(ENABLE_OPENSSL)
target_include_directories(srtp2 PRIVATE ${OPENSSL_INCLUDE_DIR})
target_link_libraries(srtp2 OpenSSL::Crypto)
@@ -256,7 +260,10 @@ if(WIN32)
target_compile_definitions(srtp2 PUBLIC _CRT_SECURE_NO_WARNINGS)
endif()
-install(TARGETS srtp2 DESTINATION lib)
+install(TARGETS srtp2 DESTINATION lib
+ EXPORT libSRTPTargets
+)
+
install(FILES include/srtp.h crypto/include/auth.h
crypto/include/cipher.h
crypto/include/crypto_types.h
@@ -352,3 +359,40 @@ if(TEST_APPS)
endif()
endif()
endif()
+
+# Export targets
+install(
+ EXPORT libSRTPTargets
+ FILE libSRTPTargets.cmake
+ NAMESPACE libSRTP::
+ DESTINATION lib/cmake/libSRTP
+)
+
+#--------------------------------------------------------------------
+# Create generated files
+#--------------------------------------------------------------------
+include(CMakePackageConfigHelpers)
+
+# Generate the config file that is includes the exports
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfig.cmake"
+ INSTALL_DESTINATION "${CONFIG_FILE_DIR}"
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+# Generate the version file for the config file
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfigVersion.cmake"
+ VERSION "${CMAKE_PROJECT_VERSION}"
+ COMPATIBILITY AnyNewerVersion
+)
+
+#--------------------------------------------------------------------
+# Install CMake config files
+#--------------------------------------------------------------------
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfigVersion.cmake
+ DESTINATION lib/cmake/libSRTP
+)
diff --git a/Config.cmake.in b/Config.cmake.in
new file mode 100644
index 0000000..0ad9b17
--- /dev/null
+++ b/Config.cmake.in
@@ -0,0 +1,3 @@
+@PACKAGE_INIT@
+
+include ( "${CMAKE_CURRENT_LIST_DIR}/libSRTPTargets.cmake" )
--
2.42.0.windows.2

View File

@ -0,0 +1,28 @@
From 52de41970582ec69f94fa32ec62f84a70dbd6345 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pascal=20B=C3=BChler?= <pabuhler@cisco.com>
Date: Mon, 11 Oct 2021 10:40:26 +0200
Subject: [PATCH] cast time_t values to known types for formatting in fprintf
This is a fix suggested in issue #566 to address build issues
with debian x32.
---
test/rtp_decoder.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/rtp_decoder.c b/test/rtp_decoder.c
index 6d88e43..9bbf62e 100644
--- a/test/rtp_decoder.c
+++ b/test/rtp_decoder.c
@@ -792,7 +792,7 @@ void rtp_decoder_handle_pkt(u_char *arg,
dcdr->rtcp_cnt++;
}
timersub(&hdr->ts, &dcdr->start_tv, &delta);
- fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
- (long)delta.tv_usec);
+ fprintf(stdout, "%02ld:%02d.%06ld\n", (long)(delta.tv_sec / 60),
+ (int)(delta.tv_sec % 60), (long)delta.tv_usec);
hexdump(&message, octets_recvd);
}
--
2.42.0.windows.2

View File

@ -0,0 +1,37 @@
From 1e7b25f4a957e290d362c3e67afa2c8bac8be82c Mon Sep 17 00:00:00 2001
From: Stepan Saiko <ssaiko@naumen.ru>
Date: Sun, 10 Oct 2021 13:33:52 +0500
Subject: [PATCH] Include directory should point to 'include' not to
'include/srtp2'
---
include/srtp2/meson.build | 1 -
meson.build | 3 ++-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/srtp2/meson.build b/include/srtp2/meson.build
index 88d068a..9b8390e 100644
--- a/include/srtp2/meson.build
+++ b/include/srtp2/meson.build
@@ -5,4 +5,3 @@ foreach h : public_headers
output: '@BASENAME@.h',
copy: true)
endforeach
-public_incs = include_directories('.')
diff --git a/meson.build b/meson.build
index 226b05c..a25197a 100644
--- a/meson.build
+++ b/meson.build
@@ -264,7 +264,8 @@ else
libsrtp2 = libsrtp2_static
endif
-subdir('include/srtp2') # copies public_headers into the builddir and sets public_incs
+subdir('include/srtp2') # copies public_headers into the builddir
+public_incs = include_directories('include') # sets public_incs
libsrtp2_dep = declare_dependency(link_with: libsrtp2,
include_directories: public_incs)
--
2.42.0.windows.2

View File

@ -1,6 +1,6 @@
Name: libsrtp
Version: 2.4.2
Release: 1
Release: 4
Summary: Library for SRTP (Secure Realtime Transport Protocol)
License: BSD
URL: https://github.com/cisco/libsrtp
@ -8,6 +8,10 @@ Source0: https://github.com/cisco/libsrtp/archive/v%{version}.tar.gz
BuildRequires: gcc
Patch0001: 0001-cast-time_t-values-to-known-types-for-formatting-in-.patch
Patch0002: 0002-Include-directory-should-point-to-include-not-to-inc.patch
Patch0003: 0001-Export-CMake-Targets.patch
%description
This package provides an implementation of the Secure Real-time Transport Protocol (SRTP),
the Universal Security Transform (UST), and a supporting cryptographic kernel.
@ -47,6 +51,15 @@ development of %{name}.
%{_libdir}/*.so
%changelog
* Thu Feb 1 2024 liubo <liubo1@xfusion.com> - 2.4.2-4
- Export CMake Targets
* Wed Nov 22 2023 liubo <liubo1@xfusion.com> - 2.4.2-3
- Include directory should point to 'include' not to 'include/srtp2'
* Thu Oct 19 2023 liubo <liubo1@xfusion.com> - 2.4.2-2
- cast time_t values to known types for formatting in fprintf
* Fri Jan 14 2022 wangkai <wangkai385@huawei.com> - 2.4.2-1
- Update to 2.4.2