mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 02:11:39 +08:00
[curl] Update libssh2/brotli/c-ares dependencies (#32287)
* [curl] Fix libssh2 dependency * Revise dependencies patching * Fix pc file * Cleanup
This commit is contained in:
parent
88f5e897a7
commit
b25f6bffd4
@ -1,29 +0,0 @@
|
||||
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
|
||||
index 496a92d0e..564415ef6 100644
|
||||
--- a/CMake/curl-config.cmake.in
|
||||
+++ b/CMake/curl-config.cmake.in
|
||||
@@ -30,6 +30,9 @@ endif()
|
||||
if(@USE_ZLIB@)
|
||||
find_dependency(ZLIB @ZLIB_VERSION_MAJOR@)
|
||||
endif()
|
||||
+if(@USE_ARES@)
|
||||
+ find_dependency(c-ares)
|
||||
+endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b43520751..dbf62751f 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -169,8 +169,8 @@ set(CURL_LIBS "")
|
||||
|
||||
if(ENABLE_ARES)
|
||||
set(USE_ARES 1)
|
||||
- find_package(CARES REQUIRED)
|
||||
- list(APPEND CURL_LIBS ${CARES_LIBRARY})
|
||||
+ find_package(c-ares CONFIG REQUIRED)
|
||||
+ list(APPEND CURL_LIBS c-ares::cares)
|
||||
endif()
|
||||
|
||||
include(CurlSymbolHiding)
|
@ -13,6 +13,7 @@ function(vcpkg_curl_flatten input output)
|
||||
list(REMOVE_AT input_libs 0)
|
||||
while(input_libs)
|
||||
list(POP_BACK input_libs lib)
|
||||
string(REGEX REPLACE "^.<LINK_ONLY:(.*)>\$" "\\1" lib "${lib}")
|
||||
if(TARGET "${lib}")
|
||||
set(import_lib "")
|
||||
set(import_location "")
|
||||
@ -69,13 +70,6 @@ function(vcpkg_curl_flatten input output)
|
||||
set("${output}" "${output_libs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(CURL_USE_LIBSSH2)
|
||||
find_package(Libssh2 CONFIG REQUIRED)
|
||||
set(LIBSSH2_FOUND TRUE)
|
||||
get_target_property(LIBSSH2_INCLUDE_DIR Libssh2::libssh2 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(LIBSSH2_LIBRARY Libssh2::libssh2)
|
||||
endif()
|
||||
|
||||
if(USE_LIBIDN2)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(LIBIDN2 REQUIRED libidn2)
|
||||
|
60
ports/curl/dependencies.patch
Normal file
60
ports/curl/dependencies.patch
Normal file
@ -0,0 +1,60 @@
|
||||
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
|
||||
index dbe4ed2..267108e 100644
|
||||
--- a/CMake/curl-config.cmake.in
|
||||
+++ b/CMake/curl-config.cmake.in
|
||||
@@ -30,6 +30,15 @@ endif()
|
||||
if(@USE_ZLIB@)
|
||||
find_dependency(ZLIB @ZLIB_VERSION_MAJOR@)
|
||||
endif()
|
||||
+if("@USE_ARES@")
|
||||
+ find_dependency(c-ares CONFIG)
|
||||
+endif()
|
||||
+if("@USE_LIBSSH2@")
|
||||
+ find_dependency(Libssh2 CONFIG)
|
||||
+endif()
|
||||
+if("@HAVE_BROTLI@")
|
||||
+ find_dependency(unofficial-brotli CONFIG)
|
||||
+endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 42c9ae4..8c42d91 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -149,7 +149,8 @@ set(CURL_LIBS "")
|
||||
|
||||
if(ENABLE_ARES)
|
||||
set(USE_ARES 1)
|
||||
- find_package(CARES REQUIRED)
|
||||
+ find_package(CARES NAMES c-ares CONFIG REQUIRED)
|
||||
+ set(CARES_LIBRARY c-ares::cares)
|
||||
list(APPEND CURL_LIBS ${CARES_LIBRARY})
|
||||
endif()
|
||||
|
||||
@@ -522,7 +523,9 @@ endif()
|
||||
option(CURL_BROTLI "Set to ON to enable building curl with brotli support." OFF)
|
||||
set(HAVE_BROTLI OFF)
|
||||
if(CURL_BROTLI)
|
||||
- find_package(Brotli QUIET)
|
||||
+ find_package(BROTLI NAMES unofficial-brotli REQUIRED)
|
||||
+ set(BROTLI_INCLUDE_DIRS "")
|
||||
+ set(BROTLI_LIBRARIES "unofficial::brotli::brotlidec")
|
||||
if(BROTLI_FOUND)
|
||||
set(HAVE_BROTLI ON)
|
||||
set(CURL_LIBS "${BROTLI_LIBRARIES};${CURL_LIBS}") # For 'ld' linker. Emulate `list(PREPEND ...)` to stay compatible with <v3.15 CMake.
|
||||
@@ -796,7 +800,13 @@ mark_as_advanced(CURL_USE_LIBSSH2)
|
||||
set(USE_LIBSSH2 OFF)
|
||||
|
||||
if(CURL_USE_LIBSSH2)
|
||||
- find_package(LibSSH2)
|
||||
+ find_package(LIBSSH2 NAMES Libssh2 REQUIRED)
|
||||
+ if(TARGET Libssh2::libssh2_shared)
|
||||
+ set(LIBSSH2_LIBRARY Libssh2::libssh2_shared)
|
||||
+ else()
|
||||
+ set(LIBSSH2_LIBRARY Libssh2::libssh2_static)
|
||||
+ endif()
|
||||
+ get_target_property(LIBSSH2_INCLUDE_DIR "${LIBSSH2_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(LIBSSH2_FOUND)
|
||||
list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY})
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}")
|
@ -13,7 +13,7 @@ vcpkg_from_github(
|
||||
0022-deduplicate-libs.patch
|
||||
mbedtls-ws2_32.patch
|
||||
export-components.patch
|
||||
0023-fix-find-cares.patch
|
||||
dependencies.patch
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
|
@ -24,20 +24,22 @@ if(CURL_FOUND)
|
||||
if(_curl_link_libraries MATCHES "OpenSSL::")
|
||||
string(REGEX REPLACE "([\$]<[^;]*)?OpenSSL::(SSL|Crypto)([^;]*>)?" "${OPENSSL_LIBRARIES}" _curl_link_libraries "${_curl_link_libraries}")
|
||||
endif()
|
||||
if(_curl_link_libraries MATCHES "Libssh2::libssh2")
|
||||
if(_curl_link_libraries MATCHES "Libssh2::libssh2_(shared|static)")
|
||||
# TODO: move find_dependency(Libssh2 CONFIG) into CURL config
|
||||
set(_libssh2_target "${CMAKE_MATCH_0}")
|
||||
find_package(Libssh2 CONFIG QUIET)
|
||||
get_target_property(_libssh2_LIBRARY_DEBUG Libssh2::libssh2 IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(_libssh2_LIBRARY_RELEASE Libssh2::libssh2 IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_libssh2_LIBRARY_DEBUG "${_libssh2_target}" IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(_libssh2_LIBRARY_RELEASE "${_libssh2_target}" IMPORTED_IMPLIB_RELEASE)
|
||||
if(NOT IMPORTED_IMPLIB_DEBUG AND NOT IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_libssh2_LIBRARY_DEBUG Libssh2::libssh2 IMPORTED_LOCATION_DEBUG)
|
||||
get_target_property(_libssh2_LIBRARY_RELEASE Libssh2::libssh2 IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(_libssh2_LIBRARY_DEBUG "${_libssh2_target}" IMPORTED_LOCATION_DEBUG)
|
||||
get_target_property(_libssh2_LIBRARY_RELEASE "${_libssh2_target}" IMPORTED_LOCATION_RELEASE)
|
||||
endif()
|
||||
select_library_configurations(_libssh2)
|
||||
string(REGEX REPLACE "([\$]<[^;]*)?Libssh2::libssh2([^;]*>)?" "${_libssh2_LIBRARIES}" _curl_link_libraries "${_curl_link_libraries}")
|
||||
string(REGEX REPLACE "([\$]<[^;]*)?${_libssh2_target}([^;]*>)?" "${_libssh2_LIBRARIES}" _curl_link_libraries "${_curl_link_libraries}")
|
||||
unset(_libssh2_LIBRARIES)
|
||||
unset(_libssh2_LIBRARY_DEBUG)
|
||||
unset(_libssh2_LIBRARY_RELEASE)
|
||||
unset(_libssh2_target)
|
||||
endif()
|
||||
if(_curl_link_libraries MATCHES "::")
|
||||
message(WARNING "CURL_LIBRARIES list at least one target. This will not work for use cases where targets are not resolved.")
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "curl",
|
||||
"version": "8.1.2",
|
||||
"port-version": 1,
|
||||
"description": "A library for transferring data with URLs",
|
||||
"homepage": "https://curl.se/",
|
||||
"license": null,
|
||||
|
@ -1954,7 +1954,7 @@
|
||||
},
|
||||
"curl": {
|
||||
"baseline": "8.1.2",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"curlpp": {
|
||||
"baseline": "2018-06-15",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "7d8ee40552d5b1c103d52b2b28d9577cb45e2593",
|
||||
"version": "8.1.2",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "b70ded19f70e4b198d8c3f844324c7884d3faa7d",
|
||||
"version": "8.1.2",
|
||||
|
Loading…
Reference in New Issue
Block a user