Skip to content

Commit

Permalink
[curl] Update to 8.3.0 (microsoft#33924)
Browse files Browse the repository at this point in the history
* [curl] Update to 8.3.0

* Add explicit usage

* Fix CMake 3.7 compatibility

* Update copyright

* Update vcpkg-cmake-wrapper
  • Loading branch information
dg0yt authored Sep 26, 2023
1 parent 796801a commit 08a6cdd
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 40 deletions.
30 changes: 15 additions & 15 deletions ports/curl/0002_fix_uwp.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 8cea346c3..967312905 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)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 9bb8f0b..7678f43 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -216,6 +216,10 @@ if(BUILD_SHARED_LIBS)
$<BUILD_INTERFACE:${CURL_SOURCE_DIR}/include>)
endif()

+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set_property(TARGET ${LIB_SELECTED} APPEND PROPERTY COMPILE_DEFINITIONS "_WINSOCK_DEPRECATED_NO_WARNINGS")
+endif()
+
add_library(${LIB_NAME} ALIAS ${LIB_SELECTED})
add_library(${PROJECT_NAME}::${LIB_NAME} ALIAS ${LIB_SELECTED})

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 7678f43..00f61f8 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()
elseif(NOT CMAKE_CROSSCOMPILING)
@@ -105,7 +105,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
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 a35ee52..ee133d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1507,6 +1507,7 @@ else()
@@ -1611,6 +1611,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)
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 056907c4f..56f7c9dd9 100644
--- a/CMake/curl-config.cmake.in
+++ b/CMake/curl-config.cmake.in
@@ -35,4 +35,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()
22 changes: 20 additions & 2 deletions ports/curl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO curl/curl
REF "${curl_version}"
SHA512 7b0aef4f1cb93d446017a337e752d43254db92e02561875d1eb88eb3020a3efaf5d3f7fdfb1ff12dfd561d526789b284a10bef35af81bd6d9cfb2c3dc325815b
SHA512 f4a6a629e42bf635f5fd01e25b6b8c750cd5db20f63d7f2bada4de08851deb4b58135019da8b76028db7f32475d11ae8a53486fb6927a6257a889468da604ce4
HEAD_REF master
PATCHES
0002_fix_uwp.patch
Expand All @@ -14,6 +14,7 @@ vcpkg_from_github(
mbedtls-ws2_32.patch
export-components.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 @@ -127,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)
17 changes: 11 additions & 6 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 Down Expand Up @@ -46,13 +50,13 @@ if(CURL_FOUND)
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 @@ -66,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)
4 changes: 2 additions & 2 deletions ports/curl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "curl",
"version": "8.2.1",
"version": "8.3.0",
"description": "A library for transferring data with URLs",
"homepage": "https://curl.se/",
"license": null,
"license": "curl AND ISC AND BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,7 @@
"port-version": 8
},
"curl": {
"baseline": "8.2.1",
"baseline": "8.3.0",
"port-version": 0
},
"curlpp": {
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/curl.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "11ef099083754220ca800477b81e5ea6e51730ff",
"version": "8.3.0",
"port-version": 0
},
{
"git-tree": "1e4df4c9590fb15d2d73014c66dbbc151b624b9b",
"version": "8.2.1",
Expand Down

0 comments on commit 08a6cdd

Please sign in to comment.