diff --git a/ports/libsrtp/cmake-config.diff b/ports/libsrtp/cmake-config.diff new file mode 100644 index 0000000000..bb83f3f0f4 --- /dev/null +++ b/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/ports/libsrtp/cmake-project-include.cmake b/ports/libsrtp/cmake-project-include.cmake index 32269c847b..a3ce6f8d2c 100644 --- a/ports/libsrtp/cmake-project-include.cmake +++ b/ports/libsrtp/cmake-project-include.cmake @@ -1,3 +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/ports/libsrtp/portfile.cmake b/ports/libsrtp/portfile.cmake index a1e27ae1fc..a5f8043353 100644 --- a/ports/libsrtp/portfile.cmake +++ b/ports/libsrtp/portfile.cmake @@ -4,6 +4,7 @@ vcpkg_from_github( REF "v${VERSION}" SHA512 eb42cc1755acd5677351fc058e2f45314ba66b590bce80944ea12aa3780953ce4c1c6211979729304d753e6c0fd325647adafc38c20c6af8482ce6f552022896 PATCHES + cmake-config.diff fix-runtime-destination.patch ) @@ -21,8 +22,8 @@ vcpkg_cmake_configure( ) vcpkg_cmake_install() - vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libSRTP) +vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/libsrtp/vcpkg.json b/ports/libsrtp/vcpkg.json index bf2d07c5da..cc6ef75f66 100644 --- a/ports/libsrtp/vcpkg.json +++ b/ports/libsrtp/vcpkg.json @@ -1,6 +1,7 @@ { "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", diff --git a/scripts/test_ports/vcpkg-ci-libsrtp/portfile.cmake b/scripts/test_ports/vcpkg-ci-libsrtp/portfile.cmake new file mode 100644 index 0000000000..dd25706120 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libsrtp/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-libsrtp/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-libsrtp/project/CMakeLists.txt new file mode 100644 index 0000000000..ad46b40954 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libsrtp/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.30) +project(libsrtp-test C) + +find_package(libSRTP CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE libSRTP::srtp2) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libsrtp_pc libsrtp2 REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::libsrtp_pc) diff --git a/scripts/test_ports/vcpkg-ci-libsrtp/project/main.c b/scripts/test_ports/vcpkg-ci-libsrtp/project/main.c new file mode 100644 index 0000000000..2756986548 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libsrtp/project/main.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("libsrtp versions: %s\n", srtp_get_version_string()); + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-libsrtp/vcpkg.json b/scripts/test_ports/vcpkg-ci-libsrtp/vcpkg.json new file mode 100644 index 0000000000..2ac53831a3 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libsrtp/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "vcpkg-ci-libsrtp", + "version-string": "ci", + "description": "Port to force features of libsrtp within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libsrtp", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "libsrtp", + "features": [ + "openssl" + ] + } + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 41da071226..af0b91bfae 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5306,7 +5306,7 @@ }, "libsrtp": { "baseline": "2.7.0", - "port-version": 0 + "port-version": 1 }, "libssh": { "baseline": "0.10.6", diff --git a/versions/l-/libsrtp.json b/versions/l-/libsrtp.json index 6434709f2f..22adae26e1 100644 --- a/versions/l-/libsrtp.json +++ b/versions/l-/libsrtp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "eae4adb49b2e66ded0e95785dee1155b587addf1", + "version": "2.7.0", + "port-version": 1 + }, { "git-tree": "0f04591cad0e2ac930c04051a0f62a440dc8753c", "version": "2.7.0",