Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
752 changes: 600 additions & 152 deletions ports/curl/dependencies.patch

Large diffs are not rendered by default.

106 changes: 0 additions & 106 deletions ports/curl/pkgconfig-curl-config.patch

This file was deleted.

8 changes: 5 additions & 3 deletions ports/curl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ string(REPLACE "." "_" curl_version "curl-${VERSION}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO curl/curl
REF ${curl_version}
SHA512 ec2fa6c47d52feed943421b00e98370971bcc73b82842a85426ea9e42d36eaab51258a8d00197fdaaf5ec39e19385280fe387765f27e3b3dc1086c46236dc0bf
REF #[[ ${curl_version} ]] rc-8_18_0-1
SHA512 5223c84dc5fc48353e0743d7443e26dbe0c691241862f81cbcaf9ca009c65f9e1d5ead5b1ac70cc056e07fb1b6aa700a2e6a0878929fe82cbd7ac067249323f3
HEAD_REF master
PATCHES
dependencies.patch
pkgconfig-curl-config.patch
)
# The on-the-fly tarballs do not carry the details of release tarballs.
vcpkg_replace_string("${SOURCE_PATH}/include/curl/curlver.h" [[-DEV"]] [["]])
vcpkg_replace_string("${SOURCE_PATH}/include/curl/curlver.h" [[LIBCURL_TIMESTAMP "[unreleased]"]] [[LIBCURL_TIMESTAMP "[vcpkg]"]])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this maybe include the port version like vcpkg-2?

Copy link
Contributor Author

@dg0yt dg0yt Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The port version isn't readily available as a CMake variable.
    (I don't want to read the manifest for an optional property.)
  • If we were using official tarballs, the value would also be const for one version.
  • If there was a strong desire for details, we might use (a fragment of) the directory name of SOURCE_PATH (e.g. c-8_18_0-1-f780f9182e.clean -> f780f9182e). It is unique for a combination of sources and patches.


vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
Expand Down
47 changes: 23 additions & 24 deletions ports/curl/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE")
list(GET ARGS 0 _z_vcpg_curl_name)
_find_package(${ARGS} CONFIG)

if(CURL_FOUND)
if(${_z_vcpg_curl_name}_FOUND)
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)

include("${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake")

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 "")
Expand All @@ -25,30 +23,31 @@ if(CURL_FOUND)
string(REGEX REPLACE "([\$]<[^;]*)?OpenSSL::(SSL|Crypto)([^;]*>)?" "${OPENSSL_LIBRARIES}" _curl_link_libraries "${_curl_link_libraries}")
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()
# leave CURL_LIBRARIES as set by upstream (imported target)
message(WARNING "Cannot easily unroll CURL_LIBRARIES (\"${CURL_LIBRARIES}\") to filepaths. Exported CMake config must use \"find_dependency(CURL)\".")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this warning could be moved into a watch() action for read access. Then it is only emitted when the variable is actually read, not when a project uses the target directly.

else()
# resolve CURL_LIBRARIES to filepaths.
if(WIN32)
get_target_property(_curl_location_debug ${_curl_target} IMPORTED_IMPLIB_DEBUG)
get_target_property(_curl_location_release ${_curl_target} IMPORTED_IMPLIB_RELEASE)
endif()

if(WIN32)
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_target} IMPORTED_LOCATION_DEBUG)
get_target_property(_curl_location_release ${_curl_target} IMPORTED_LOCATION_RELEASE)
endif()

if(NOT _curl_location_debug AND NOT _curl_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_LIBRARY_DEBUG "${_curl_location_debug}" CACHE INTERNAL "vcpkg")
set(CURL_LIBRARY_RELEASE "${_curl_location_release}" CACHE INTERNAL "vcpkg")
include("${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake")
select_library_configurations(CURL)
set(CURL_LIBRARIES ${CURL_LIBRARY} ${_curl_link_libraries})

set(CURL_INCLUDE_DIRS "${_curl_include_dirs}")
set(CURL_LIBRARY_DEBUG "${_curl_location_debug}" CACHE INTERNAL "vcpkg")
set(CURL_LIBRARY_RELEASE "${_curl_location_release}" CACHE INTERNAL "vcpkg")
select_library_configurations(CURL)
set(CURL_LIBRARIES ${CURL_LIBRARY} ${_curl_link_libraries})
set(CURL_VERSION_STRING "${CURL_VERSION}")
unset(_curl_link_libraries)
unset(_curl_location_debug)
unset(_curl_location_release)
endif()

unset(_curl_include_dirs)
unset(_curl_link_libraries)
unset(_curl_location_debug)
unset(_curl_location_release)
unset(_curl_target)
cmake_policy(POP)
endif()
2 changes: 1 addition & 1 deletion ports/curl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "curl",
"version": "8.17.0",
"version": "8.18.0",
"description": "A library for transferring data with URLs",
"homepage": "https://curl.se/",
"license": "curl AND ISC AND BSD-3-Clause",
Expand Down
27 changes: 27 additions & 0 deletions ports/libssh2/cmake-config.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/cmake/libssh2-config.cmake.in b/cmake/libssh2-config.cmake.in
index edc86d7..fd53d55 100644
--- a/cmake/libssh2-config.cmake.in
+++ b/cmake/libssh2-config.cmake.in
@@ -22,10 +22,22 @@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")

# Alias for either shared or static library
if(NOT TARGET @PROJECT_NAME@::@LIB_NAME@)
+ if(CMAKE_VERSION VERSION_LESS "3.18.0")
+ # cannot add alias to non-global imported library
+ add_library(@PROJECT_NAME@::@LIB_NAME@ INTERFACE IMPORTED)
+ set_target_properties(@PROJECT_NAME@::@LIB_NAME@ PROPERTIES INTERFACE_LINK_LIBRARIES @PROJECT_NAME@::@LIB_SELECTED@)
+ else()
add_library(@PROJECT_NAME@::@LIB_NAME@ ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
+ endif()
endif()

# Compatibility alias
if(NOT TARGET Libssh2::@LIB_NAME@)
+ if(CMAKE_VERSION VERSION_LESS "3.18.0")
+ # cannot add alias to non-global imported library
+ add_library(Libssh2::@LIB_NAME@ INTERFACE IMPORTED)
+ set_target_properties(Libssh2::@LIB_NAME@ PROPERTIES INTERFACE_LINK_LIBRARIES @PROJECT_NAME@::@LIB_SELECTED@)
+ else()
add_library(Libssh2::@LIB_NAME@ ALIAS @PROJECT_NAME@::@LIB_SELECTED@)
+ endif()
endif()
3 changes: 2 additions & 1 deletion ports/libssh2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ vcpkg_from_github(
SHA512 616efcd7f5c1fb1046104ebce70549e4756e2a55150efa2df5bb7123051d3bf336023cedcbfe932cd7c690a0b4d1f1a93c760ea39f1dba50c2b06d0945dca958
HEAD_REF master
PATCHES
cmake-config.diff
pkgconfig.diff
)

Expand All @@ -24,11 +25,11 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
endif()

vcpkg_find_acquire_program(PKGCONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}")

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
-DENABLE_DEBUG_LOGGING=OFF
Expand Down
2 changes: 1 addition & 1 deletion ports/libssh2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libssh2",
"version": "1.11.1",
"port-version": 1,
"port-version": 2,
"description": "libssh2 is a client-side C library implementing the SSH2 protocol.",
"homepage": "https://www.libssh2.org",
"license": "BSD-3-Clause",
Expand Down
58 changes: 58 additions & 0 deletions ports/ngtcp2/export-crypto-targets.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/crypto/ossl/CMakeLists.txt b/crypto/ossl/CMakeLists.txt
index da2ef2df..1a108ada 100644
--- a/crypto/ossl/CMakeLists.txt
+++ b/crypto/ossl/CMakeLists.txt
@@ -29,14 +29,11 @@ set(ngtcp2_crypto_ossl_SOURCES
)

set(ngtcp2_crypto_ossl_INCLUDE_DIRS
- "${CMAKE_CURRENT_SOURCE_DIR}/../../lib/includes"
- "${CMAKE_CURRENT_BINARY_DIR}/../../lib/includes"
- "${CMAKE_CURRENT_SOURCE_DIR}/../../lib"
- "${CMAKE_CURRENT_SOURCE_DIR}/../../crypto/includes"
- "${CMAKE_CURRENT_BINARY_DIR}/../../crypto/includes"
- "${CMAKE_CURRENT_SOURCE_DIR}/../../crypto"
- "${CMAKE_CURRENT_BINARY_DIR}/../../crypto"
- "${OPENSSL_INCLUDE_DIRS}"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/crypto/includes>"
+ "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/crypto/includes>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/crypto>"
+ "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/crypto>"
)

foreach(name libngtcp2_crypto_ossl.pc)
@@ -55,9 +52,10 @@ if(ENABLE_SHARED_LIB)
)
target_include_directories(ngtcp2_crypto_ossl PUBLIC
${ngtcp2_crypto_ossl_INCLUDE_DIRS})
- target_link_libraries(ngtcp2_crypto_ossl ngtcp2 ${OPENSSL_LIBRARIES})
+ target_link_libraries(ngtcp2_crypto_ossl PUBLIC ngtcp2 OpenSSL::SSL)

install(TARGETS ngtcp2_crypto_ossl
+ EXPORT "${PROJECT_NAME}Targets"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
@@ -77,8 +75,10 @@ if(ENABLE_STATIC_LIB)
"-DNGTCP2_STATICLIB")
target_include_directories(ngtcp2_crypto_ossl_static PUBLIC
${ngtcp2_crypto_ossl_INCLUDE_DIRS})
+ target_link_libraries(ngtcp2_crypto_ossl_static PUBLIC ngtcp2_static OpenSSL::SSL)

install(TARGETS ngtcp2_crypto_ossl_static
+ EXPORT "${PROJECT_NAME}Targets"
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()

diff --git a/lib/config.cmake.in b/lib/config.cmake.in
index 435a4d4a..fffcd517 100644
--- a/lib/config.cmake.in
+++ b/lib/config.cmake.in
@@ -1,3 +1,6 @@
include(CMakeFindDependencyMacro)
+if("@HAVE_OSSL@")
+ find_dependency(OpenSSL)
+endif()

include("${CMAKE_CURRENT_LIST_DIR}/@NGTCP2_TARGETS_EXPORT_NAME@.cmake")
2 changes: 2 additions & 0 deletions ports/ngtcp2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 bd68cc652edba8b5619370729b88cc0dccd9c0542391b12b87b5a106e7982a984c9a1f1dea8817f8953318bc12967878498fbc50e221ec465e77422e5ae1ddcf
HEAD_REF main
PATCHES
export-crypto-targets.diff
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC_LIB)
Expand Down
1 change: 1 addition & 0 deletions ports/ngtcp2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ngtcp2",
"version": "1.18.0",
"port-version": 1,
"description": "ngtcp2 project is an effort to implement RFC9000 QUIC protocol.",
"homepage": "https://github.com/ngtcp2/ngtcp2",
"license": "MIT",
Expand Down
3 changes: 1 addition & 2 deletions scripts/test_ports/vcpkg-ci-curl/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

vcpkg_find_acquire_program(PKGCONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}")

vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
OPTIONS
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
OPTIONS_RELEASE
"-DCURL_CONFIG=${CURRENT_INSTALLED_DIR}/tools/curl/bin/curl-config"
OPTIONS_DEBUG
Expand Down
6 changes: 6 additions & 0 deletions scripts/test_ports/vcpkg-ci-curl/project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ project(libcurl-test C)

block(SCOPE_FOR VARIABLES)
# blocked by FindOpenSSL in CMake 3.30: set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig 1)
set(env_pkg_config_backup "$ENV{PKG_CONFIG}")
set(ENV{PKG_CONFIG} "${CMAKE_COMMAND} -E false")

find_package(CURL COMPONENTS libz REQUIRED)

add_executable(main main.c)
target_link_libraries(main PRIVATE CURL::libcurl)

unset(PKG_CONFIG_EXECUTABLE CACHE)
unset(PKG_CONFIG_ARGN CACHE)
set(ENV{PKG_CONFIG} "${env_pkg_config_backup}")
endblock()

block(SCOPE_FOR VARIABLES)
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5554,7 +5554,7 @@
},
"libssh2": {
"baseline": "1.11.1",
"port-version": 1
"port-version": 2
},
"libstemmer": {
"baseline": "2021.2.2.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libssh2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6c7dcac34e292ddbac4c17716d218f35606c65a6",
"version": "1.11.1",
"port-version": 2
},
{
"git-tree": "01783f68b91820c8270fe759f595b5562fb55a7c",
"version": "1.11.1",
Expand Down
Loading