Skip to content

Commit

Permalink
Update curl to version 8.4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Oct 11, 2023
1 parent f342af7 commit 3f30f89
Show file tree
Hide file tree
Showing 16 changed files with 171 additions and 93 deletions.
8 changes: 4 additions & 4 deletions cmake/Modules/FindCurl_EP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ if (NOT CURL_FOUND AND TILEDB_SUPERBUILD)
PREFIX "externals"
# Set download name to avoid collisions with only the version number in the filename
DOWNLOAD_NAME ep_curl.tar.gz
URL "https://curl.se/download/curl-7.88.1.tar.gz"
URL_HASH SHA1=6ae5229c36badb822641bb14958e7d227c57611d
URL "https://curl.se/download/curl-8.4.0.tar.gz"
URL_HASH SHA1=1a2af84acf92902939cac5e0f903e13a3eb82094
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${TILEDB_EP_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=Release
Expand Down Expand Up @@ -161,8 +161,8 @@ if (NOT CURL_FOUND AND TILEDB_SUPERBUILD)

ExternalProject_Add(ep_curl
PREFIX "externals"
URL "https://curl.se/download/curl-7.88.1.tar.gz"
URL_HASH SHA1=6ae5229c36badb822641bb14958e7d227c57611d
URL "https://curl.se/download/curl-8.4.0.tar.gz"
URL_HASH SHA1=1a2af84acf92902939cac5e0f903e13a3eb82094
CONFIGURE_COMMAND
${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${SSL_PKG_CONFIG_PATH} ${TILEDB_EP_BASE}/src/ep_curl/configure
--prefix=${TILEDB_EP_INSTALL_PREFIX}
Expand Down
33 changes: 21 additions & 12 deletions ports/curl/0002_fix_uwp.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 8cea346c3..967312905 100644
index 6f84919..b838245 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -118,6 +118,10 @@ if(CURL_HAS_LTO)
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
endif()

+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "_WINSOCK_DEPRECATED_NO_WARNINGS")
+endif()
+
if(WIN32)
if(BUILD_SHARED_LIBS)
if(MSVC)
@@ -162,6 +162,9 @@ if(BUILD_STATIC_LIBS)
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set_property(TARGET ${LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS "_WINSOCK_DEPRECATED_NO_WARNINGS")
+ endif()
if(CMAKEVERSION AND CMAKESONAME)
set_target_properties(${LIB_STATIC} PROPERTIES
VERSION ${CMAKEVERSION} SOVERSION ${CMAKESONAME})
@@ -197,6 +200,9 @@ if(BUILD_SHARED_LIBS)
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_DEFINITIONS "_WINSOCK_DEPRECATED_NO_WARNINGS")
+ endif()
if(CMAKEVERSION AND CMAKESONAME)
set_target_properties(${LIB_SHARED} PROPERTIES
VERSION ${CMAKEVERSION} SOVERSION ${CMAKESONAME})
18 changes: 9 additions & 9 deletions ports/curl/0005_remove_imp_suffix.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 1d71e14..62b7b33 100644
index b838245..3199160 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -125,7 +125,6 @@ if(WIN32)
if(MSVC)
# Add "_imp" as a suffix before the extension to avoid conflicting with
# the statically linked "libcurl.lib"
- set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
endif()
endif()
endif()
@@ -92,7 +92,6 @@ endif()
if(WIN32 AND
NOT IMPORT_LIB_SUFFIX AND
CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL CMAKE_IMPORT_LIBRARY_SUFFIX)
- set(IMPORT_LIB_SUFFIX "_imp")
endif()

# Whether to do a single compilation pass for libcurl sources and reuse these
4 changes: 2 additions & 2 deletions ports/curl/0012-fix-dependency-idn2.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f6de81..6702845 100644
index 1b19c68..bb5fba9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -632,6 +632,7 @@ endif()
@@ -839,7 +839,8 @@ endif()
# Check for idn2
option(USE_LIBIDN2 "Use libidn2 for IDN support" ON)
if(USE_LIBIDN2)
Expand Down
4 changes: 2 additions & 2 deletions ports/curl/0020-fix-pc-file.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b2e428..ea430f4 100644
index bb5fba9..9919fd3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1505,7 +1505,9 @@ set(includedir "\${prefix}/include")
@@ -1624,7 +1624,9 @@ set(includedir "\${prefix}/include")
set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(LIBCURL_LIBS "")
set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
Expand Down
10 changes: 5 additions & 5 deletions ports/curl/0022-deduplicate-libs.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09d82f1..f0d99e6 100644
index 9919fd3..7e513f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1507,6 +1507,7 @@ else()
@@ -1654,6 +1654,7 @@ if(BUILD_SHARED_LIBS)
else()
set(ENABLE_SHARED "no")
set(ENABLE_STATIC "yes")
set(LIBCURL_NO_SHARED "${LIBCURL_LIBS}")
+ set(LIBCURL_LIBS "")
set(CPPFLAG_CURL_STATICLIB "-DCURL_STATICLIB")
endif()
# "a" (Linux) or "lib" (Windows)
string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(BUILD_STATIC_LIBS)
29 changes: 0 additions & 29 deletions ports/curl/0023-fix-find-cares.patch

This file was deleted.

13 changes: 13 additions & 0 deletions ports/curl/cmake-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
index c89c686..2f39949 100644
--- a/CMake/curl-config.cmake.in
+++ b/CMake/curl-config.cmake.in
@@ -45,4 +45,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@PROJECT_NAME@")

# Alias for either shared or static library
-add_library(@PROJECT_NAME@::libcurl ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
+if(NOT TARGET @PROJECT_NAME@::libcurl)
+ add_library(@PROJECT_NAME@::libcurl INTERFACE IMPORTED)
+ set_target_properties(@PROJECT_NAME@::libcurl PROPERTIES INTERFACE_LINK_LIBRARIES @PROJECT_NAME@::@LIB_SELECTED@)
+endif()
8 changes: 1 addition & 7 deletions ports/curl/cmake-project-include.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down Expand Up @@ -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)
Expand Down
61 changes: 61 additions & 0 deletions ports/curl/dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
index 056907c..c89c686 100644
--- a/CMake/curl-config.cmake.in
+++ b/CMake/curl-config.cmake.in
@@ -31,6 +31,16 @@ 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}/@[email protected]")
check_required_components("@PROJECT_NAME@")

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 049ac34..cc0fe19 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -178,7 +178,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()

@@ -590,7 +591,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 REQUIRED)
+ 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.
@@ -873,7 +876,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}")
4 changes: 2 additions & 2 deletions ports/curl/export-components.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 874a237..3974956 100644
index 7e513f6..049ac34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1617,8 +1617,17 @@ if(CURL_ENABLE_EXPORT_TARGET)
@@ -1727,8 +1727,17 @@ if(CURL_ENABLE_EXPORT_TARGET)
)
endif()

Expand Down
4 changes: 2 additions & 2 deletions ports/curl/mbedtls-ws2_32.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMake/FindMbedTLS.cmake b/CMake/FindMbedTLS.cmake
index 7bdb197..c8c5a73 100644
index 814bd97..8b17eac 100644
--- a/CMake/FindMbedTLS.cmake
+++ b/CMake/FindMbedTLS.cmake
@@ -26,6 +26,9 @@ find_library(MBEDX509_LIBRARY mbedx509)
@@ -28,6 +28,9 @@ find_library(MBEDX509_LIBRARY mbedx509)
find_library(MBEDCRYPTO_LIBRARY mbedcrypto)

set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
Expand Down
28 changes: 24 additions & 4 deletions ports/curl/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
string(REPLACE "." "_" curl_version "curl-${VERSION}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO curl/curl
REF curl-7_88_1
SHA512 c5caa1f95580ddbf2041c9c4b885f84d4f5c5fcb905a5ea59f9dbb58a98fc292260f95cb935e963bf83d7dcecf98561deef5ce3ff91cdcb29a080559cff0ed64
REF "${curl_version}"
SHA512 c8550fef49e2f1571f7392a351e10bbdb23821069db1e988094fe27fe0a881a265ba69a2cd34462e630563d153462a975ef70472ba39adaad1c5e5ab45cf7f4f
HEAD_REF master
PATCHES
0002_fix_uwp.patch
Expand All @@ -12,7 +13,8 @@ vcpkg_from_github(
0022-deduplicate-libs.patch
mbedtls-ws2_32.patch
export-components.patch
0023-fix-find-cares.patch
dependencies.patch
cmake-config.patch # https://github.com/curl/curl/pull/11913
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down Expand Up @@ -72,6 +74,7 @@ vcpkg_cmake_configure(
-DENABLE_MANUAL=OFF
-DCURL_CA_FALLBACK=ON
-DCURL_USE_LIBPSL=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON
OPTIONS_DEBUG
-DENABLE_DEBUG=ON
)
Expand Down Expand Up @@ -125,4 +128,21 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
endif()

file(INSTALL "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

file(READ "${SOURCE_PATH}/lib/krb5.c" krb5_c)
string(REGEX REPLACE "#i.*" "" krb5_c "${krb5_c}")
set(krb5_copyright "${CURRENT_BUILDTREES_DIR}/krb5.c Notice")
file(WRITE "${krb5_copyright}" "${krb5_c}")

file(READ "${SOURCE_PATH}/lib/inet_ntop.c" inet_ntop_c)
string(REGEX REPLACE "#i.*" "" inet_ntop_c "${inet_ntop_c}")
set(inet_ntop_copyright "${CURRENT_BUILDTREES_DIR}/inet_ntop.c and inet_pton.c Notice")
file(WRITE "${inet_ntop_copyright}" "${inet_ntop_c}")

vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/COPYING"
"${krb5_copyright}"
"${inet_ntop_copyright}"
)
4 changes: 4 additions & 0 deletions ports/curl/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
curl is compatible with built-in CMake targets:

find_package(CURL REQUIRED)
target_link_libraries(main PRIVATE CURL::libcurl)
31 changes: 19 additions & 12 deletions ports/curl/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ _find_package(${ARGS} CONFIG)
if(CURL_FOUND)
include("${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake")

get_target_property(_curl_include_dirs CURL::libcurl INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_curl_link_libraries CURL::libcurl INTERFACE_LINK_LIBRARIES)
set(_curl_target CURL::libcurl_shared)
if(TARGET CURL::libcurl_static)
set(_curl_target CURL::libcurl_static)
endif()
get_target_property(_curl_include_dirs ${_curl_target} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_curl_link_libraries ${_curl_target} INTERFACE_LINK_LIBRARIES)
if(NOT _curl_link_libraries)
set(_curl_link_libraries "")
endif()
Expand All @@ -24,33 +28,35 @@ 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.")
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
get_target_property(_curl_location_debug CURL::libcurl IMPORTED_IMPLIB_DEBUG)
get_target_property(_curl_location_release CURL::libcurl IMPORTED_IMPLIB_RELEASE)
get_target_property(_curl_location_debug ${_curl_target} IMPORTED_IMPLIB_DEBUG)
get_target_property(_curl_location_release ${_curl_target} IMPORTED_IMPLIB_RELEASE)
endif()

if(NOT _curl_location_debug AND NOT _curl_location_release)
get_target_property(_curl_location_debug CURL::libcurl IMPORTED_LOCATION_DEBUG)
get_target_property(_curl_location_release CURL::libcurl IMPORTED_LOCATION_RELEASE)
get_target_property(_curl_location_debug ${_curl_target} IMPORTED_LOCATION_DEBUG)
get_target_property(_curl_location_release ${_curl_target} IMPORTED_LOCATION_RELEASE)
endif()

set(CURL_INCLUDE_DIRS "${_curl_include_dirs}")
Expand All @@ -64,5 +70,6 @@ if(CURL_FOUND)
unset(_curl_link_libraries)
unset(_curl_location_debug)
unset(_curl_location_release)
unset(_curl_target)
endif()
cmake_policy(POP)
Loading

0 comments on commit 3f30f89

Please sign in to comment.