aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libsrtp
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libsrtp')
-rw-r--r--vcpkg/ports/libsrtp/cmake-config.diff44
-rw-r--r--vcpkg/ports/libsrtp/cmake-project-include.cmake20
-rw-r--r--vcpkg/ports/libsrtp/fix-runtime-destination.patch12
-rw-r--r--vcpkg/ports/libsrtp/portfile.cmake30
-rw-r--r--vcpkg/ports/libsrtp/vcpkg.json26
5 files changed, 132 insertions, 0 deletions
diff --git a/vcpkg/ports/libsrtp/cmake-config.diff b/vcpkg/ports/libsrtp/cmake-config.diff
new file mode 100644
index 0000000..bb83f3f
--- /dev/null
+++ b/vcpkg/ports/libsrtp/cmake-config.diff
@@ -0,0 +1,44 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a08247a..7ccbf85 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -285,7 +285,7 @@ target_include_directories(srtp2 PUBLIC
+ )
+ if(ENABLE_OPENSSL)
+ target_include_directories(srtp2 PRIVATE ${OPENSSL_INCLUDE_DIR})
+- target_link_libraries(srtp2 OpenSSL::Crypto)
++ target_link_libraries(srtp2 PRIVATE OpenSSL::Crypto)
+ elseif(ENABLE_MBEDTLS)
+ target_include_directories(srtp2 PRIVATE ${MBEDTLS_INCLUDE_DIRS})
+ target_link_libraries(srtp2 ${MBEDTLS_LIBRARIES})
+@@ -294,7 +294,7 @@ elseif(ENABLE_NSS)
+ target_link_libraries(srtp2 ${NSS_LIBRARIES})
+ endif()
+ if(WIN32)
+- target_link_libraries(srtp2 ws2_32)
++ target_link_libraries(srtp2 PRIVATE ws2_32)
+ target_compile_definitions(srtp2 PUBLIC _CRT_SECURE_NO_WARNINGS)
+ endif()
+
+@@ -491,7 +491,7 @@ 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}"
++ INSTALL_DESTINATION lib/cmake/libSRTP
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+diff --git a/Config.cmake.in b/Config.cmake.in
+index 0ad9b17..c9ce5a7 100644
+--- a/Config.cmake.in
++++ b/Config.cmake.in
+@@ -1,3 +1,8 @@
+ @PACKAGE_INIT@
+
++if("@ENABLE_OPENSSL@")
++ include(CMakeFindDependencyMacro)
++ find_dependency(OpenSSL)
++endif()
++
+ include ( "${CMAKE_CURRENT_LIST_DIR}/libSRTPTargets.cmake" )
diff --git a/vcpkg/ports/libsrtp/cmake-project-include.cmake b/vcpkg/ports/libsrtp/cmake-project-include.cmake
new file mode 100644
index 0000000..a3ce6f8
--- /dev/null
+++ b/vcpkg/ports/libsrtp/cmake-project-include.cmake
@@ -0,0 +1,20 @@
+if(MSVC)
+ string(APPEND CMAKE_CFLAGS " /wd4703")
+endif()
+
+block(SCOPE_FOR VARIABLES)
+ set(prefix [[${pcfiledir}/../..]])
+ set(libdir [[${prefix}/lib]])
+ set(includedir [[${prefix}/include]])
+ set(PACKAGE_NAME "${PROJECT_NAME}")
+ set(PACKAGE_VERSION "${PROJECT_VERSION}")
+ set(LIBS "")
+ if(WIN32)
+ set(LIBS "-lws2_32")
+ endif()
+ configure_file("${PROJECT_SOURCE_DIR}/libsrtp2.pc.in" "${PROJECT_BINARY_DIR}/libsrtp2.pc" @ONLY)
+ if(ENABLE_OPENSSL)
+ file(APPEND "${PROJECT_BINARY_DIR}/libsrtp2.pc" "Requires.private: libcrypto")
+ endif()
+ install(FILES "${PROJECT_BINARY_DIR}/libsrtp2.pc" DESTINATION "lib/pkgconfig")
+endblock()
diff --git a/vcpkg/ports/libsrtp/fix-runtime-destination.patch b/vcpkg/ports/libsrtp/fix-runtime-destination.patch
new file mode 100644
index 0000000..ba97cc1
--- /dev/null
+++ b/vcpkg/ports/libsrtp/fix-runtime-destination.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d548e78..4a839e2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -262,6 +262,7 @@ endif()
+
+ install(TARGETS srtp2 DESTINATION lib
+ EXPORT libSRTPTargets
++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+
+ install(FILES include/srtp.h crypto/include/auth.h
diff --git a/vcpkg/ports/libsrtp/portfile.cmake b/vcpkg/ports/libsrtp/portfile.cmake
new file mode 100644
index 0000000..a5f8043
--- /dev/null
+++ b/vcpkg/ports/libsrtp/portfile.cmake
@@ -0,0 +1,30 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO cisco/libsrtp
+ REF "v${VERSION}"
+ SHA512 eb42cc1755acd5677351fc058e2f45314ba66b590bce80944ea12aa3780953ce4c1c6211979729304d753e6c0fd325647adafc38c20c6af8482ce6f552022896
+ PATCHES
+ cmake-config.diff
+ fix-runtime-destination.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ openssl ENABLE_OPENSSL
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ "-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
+ -DLIBSRTP_TEST_APPS=OFF
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libSRTP)
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/libsrtp/vcpkg.json b/vcpkg/ports/libsrtp/vcpkg.json
new file mode 100644
index 0000000..cc6ef75
--- /dev/null
+++ b/vcpkg/ports/libsrtp/vcpkg.json
@@ -0,0 +1,26 @@
+{
+ "name": "libsrtp",
+ "version": "2.7.0",
+ "port-version": 1,
+ "description": "This package provides an implementation of the Secure Real-time Transport Protocol (SRTP), the Universal Security Transform (UST), and a supporting cryptographic kernel.",
+ "homepage": "https://github.com/cisco/libsrtp/",
+ "license": "BSD-3-Clause",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "openssl": {
+ "description": "Enable OpenSSL support",
+ "dependencies": [
+ "openssl"
+ ]
+ }
+ }
+}