diff --git a/CMakeLists.txt b/CMakeLists.txt index 58847a7ab2..b348286cdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # CMake settings cmake_minimum_required(VERSION 3.19) -set(VCPKG_TAG 2c401863dd54a640aeb26ed736c55489c079323b) +set(VCPKG_TAG f5c5b8ddbb88dec7eed4a5ac54c36d1c64d2d29d) set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/src/qml/imports CACHE PATH "QML import path for Qt Creator to detect custom modules properly") diff --git a/vcpkg/overlay/curl/0002_fix_uwp.patch b/vcpkg/overlay/curl/0002_fix_uwp.patch new file mode 100644 index 0000000000..7e2cf7cd90 --- /dev/null +++ b/vcpkg/overlay/curl/0002_fix_uwp.patch @@ -0,0 +1,24 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 6f84919..b838245 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -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}) diff --git a/vcpkg/overlay/curl/0005_remove_imp_suffix.patch b/vcpkg/overlay/curl/0005_remove_imp_suffix.patch new file mode 100644 index 0000000000..5fe94196a5 --- /dev/null +++ b/vcpkg/overlay/curl/0005_remove_imp_suffix.patch @@ -0,0 +1,12 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index b838245..3199160 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -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 diff --git a/vcpkg/overlay/curl/0012-fix-dependency-idn2.patch b/vcpkg/overlay/curl/0012-fix-dependency-idn2.patch new file mode 100644 index 0000000000..c0efbba3a2 --- /dev/null +++ b/vcpkg/overlay/curl/0012-fix-dependency-idn2.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1b19c68..bb5fba9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -839,7 +839,8 @@ endif() + # Check for idn2 + option(USE_LIBIDN2 "Use libidn2 for IDN support" ON) + if(USE_LIBIDN2) +- check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2) ++ set(HAVE_LIBIDN2 TRUE) ++ list(INSERT CURL_LIBS 0 ${LIBIDN2_LINK_LIBRARIES}) + else() + set(HAVE_LIBIDN2 OFF) + endif() diff --git a/vcpkg/overlay/curl/0020-fix-pc-file.patch b/vcpkg/overlay/curl/0020-fix-pc-file.patch new file mode 100644 index 0000000000..aad6ed9c2a --- /dev/null +++ b/vcpkg/overlay/curl/0020-fix-pc-file.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bb5fba9..9919fd3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1624,7 +1624,9 @@ set(includedir "\${prefix}/include") + set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + set(LIBCURL_LIBS "") + set(libdir "${CMAKE_INSTALL_PREFIX}/lib") +-foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS}) ++set(CURL_LIBS_FLAT "") ++vcpkg_curl_flatten(CURL_LIBS CURL_LIBS_FLAT) ++foreach(_lib ${CURL_LIBS_FLAT}) + if(TARGET "${_lib}") + set(_libname "${_lib}") + get_target_property(_imported "${_libname}" IMPORTED) diff --git a/vcpkg/overlay/curl/0022-deduplicate-libs.patch b/vcpkg/overlay/curl/0022-deduplicate-libs.patch new file mode 100644 index 0000000000..aa47329589 --- /dev/null +++ b/vcpkg/overlay/curl/0022-deduplicate-libs.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9919fd3..7e513f6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1654,6 +1654,7 @@ if(BUILD_SHARED_LIBS) + else() + set(ENABLE_SHARED "no") + set(LIBCURL_NO_SHARED "${LIBCURL_LIBS}") ++ set(LIBCURL_LIBS "") + set(CPPFLAG_CURL_STATICLIB "-DCURL_STATICLIB") + endif() + if(BUILD_STATIC_LIBS) diff --git a/vcpkg/overlay/curl/cmake-config.patch b/vcpkg/overlay/curl/cmake-config.patch new file mode 100644 index 0000000000..39b7d28316 --- /dev/null +++ b/vcpkg/overlay/curl/cmake-config.patch @@ -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}/@TARGETS_EXPORT_NAME@.cmake") + 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() diff --git a/vcpkg/overlay/curl/cmake-project-include.cmake b/vcpkg/overlay/curl/cmake-project-include.cmake new file mode 100644 index 0000000000..c43df547fc --- /dev/null +++ b/vcpkg/overlay/curl/cmake-project-include.cmake @@ -0,0 +1,76 @@ +# Process the libs and targets in the variable named by `input` +# into a flat list of libs in the variable named by `output`. +# Simplify -framework elements. +# Use -l where possible. +# Avoid duplicates. +function(vcpkg_curl_flatten input output) + set(output_libs "${${output}}") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + string(REGEX REPLACE ";optimized;[^;]*|;debug" "" input_libs "VCPKG;${${input}}") + else() + string(REGEX REPLACE ";debug;[^;]*|;optimized" "" input_libs "VCPKG;${${input}}") + endif() + list(REMOVE_AT input_libs 0) + while(input_libs) + list(POP_BACK input_libs lib) + string(REGEX REPLACE "^.\$" "\\1" lib "${lib}") + if(TARGET "${lib}") + set(import_lib "") + set(import_location "") + get_target_property(type "${lib}" TYPE) + if(NOT type STREQUAL "INTERFACE_LIBRARY") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + get_target_property(link_libs "${lib}" IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG) + get_target_property(import_lib "${lib}" IMPORTED_IMPLIB_DEBUG) + get_target_property(import_location "${lib}" IMPORTED_LOCATION_DEBUG) + else() + get_target_property(link_libs "${lib}" IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE) + get_target_property(import_lib "${lib}" IMPORTED_IMPLIB_RELEASE) + get_target_property(import_location "${lib}" IMPORTED_LOCATION_RELEASE) + endif() + if(link_libs) + vcpkg_curl_flatten(link_libs output_libs) + endif() + get_target_property(link_libs "${lib}" IMPORTED_LINK_INTERFACE_LIBRARIES) + if(link_libs) + vcpkg_curl_flatten(link_libs output_libs) + endif() + if(NOT import_lib) + get_target_property(import_lib "${lib}" IMPORTED_IMPLIB) + endif() + if(NOT import_location) + get_target_property(import_location "${lib}" IMPORTED_LOCATION) + endif() + endif() + get_target_property(link_libs "${lib}" INTERFACE_LINK_LIBRARIES) + if(link_libs) + vcpkg_curl_flatten(link_libs output_libs) + endif() + if(import_lib) + set(lib "${import_lib}") + elseif(import_location) + set(lib "${import_location}") + endif() + endif() + if(lib MATCHES "^(.*)/([^/]*)[.]framework$") + if(CMAKE_MATCH_1 IN_LIST CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES) + set(lib "-framework ${CMAKE_MATCH_2}") + else() + set(lib "-framework ${lib}") + endif() + elseif(WIN32 AND lib MATCHES ".*/${CMAKE_IMPORT_LIBRARY_PREFIX}([^/]*)${CMAKE_IMPORT_LIBRARY_SUFFIX}") + set(lib -l${CMAKE_MATCH_1}) + elseif(lib MATCHES ".*/${CMAKE_STATIC_LIBRARY_PREFIX}([^/]*)${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(lib -l${CMAKE_MATCH_1}) + endif() + if(NOT "${lib}" IN_LIST output_libs) + list(PREPEND output_libs "${lib}") + endif() + endwhile() + set("${output}" "${output_libs}" PARENT_SCOPE) +endfunction() + +if(USE_LIBIDN2) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBIDN2 REQUIRED libidn2) +endif() diff --git a/vcpkg/overlay/curl/dependencies.patch b/vcpkg/overlay/curl/dependencies.patch new file mode 100644 index 0000000000..affbc5ec30 --- /dev/null +++ b/vcpkg/overlay/curl/dependencies.patch @@ -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}/@TARGETS_EXPORT_NAME@.cmake") + 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 +Date: Wed, 11 Oct 2023 16:06:12 +0000 +Subject: [PATCH] cmake: fix `HAVE_H_ERRNO_ASSIGNABLE` detection + +Fix `HAVE_H_ERRNO_ASSIGNABLE` to not run, only compile its test snippet, +aligning this with autotools. This fixes an error when doing +cross-builds and also actually detects this feature. It affected systems +not allowlisted into this, e.g. SerenityOS. + +We used this detection result to enable `HAVE_GETADDRINFO_THREADSAFE`. + +Follow-up to 04a3a377d83fd72c4cf7a96c9cb6d44785e33264 #11979 +Ref: #12095 (closed in favour of this patch) +Ref: #11964 (effort to sync cmake detections with autotools) + +Reported-by: Kartatz on Github +Assisted-by: Kartatz on Github +Fixes #12093 +Closes #12094 +--- + CMake/OtherTests.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake +index d67a9059bcdea..f1902d73a31f5 100644 +--- a/CMake/OtherTests.cmake ++++ b/CMake/OtherTests.cmake +@@ -172,7 +172,7 @@ if(NOT DEFINED HAVE_GETADDRINFO_THREADSAFE) + }" HAVE_H_ERRNO) + + if(NOT HAVE_H_ERRNO) +- check_c_source_runs("${_source_epilogue} ++ check_c_source_compiles("${_source_epilogue} + int main(void) + { + h_errno = 2; diff --git a/vcpkg/overlay/curl/mbedtls-ws2_32.patch b/vcpkg/overlay/curl/mbedtls-ws2_32.patch new file mode 100644 index 0000000000..2ead172689 --- /dev/null +++ b/vcpkg/overlay/curl/mbedtls-ws2_32.patch @@ -0,0 +1,14 @@ +diff --git a/CMake/FindMbedTLS.cmake b/CMake/FindMbedTLS.cmake +index 814bd97..8b17eac 100644 +--- a/CMake/FindMbedTLS.cmake ++++ b/CMake/FindMbedTLS.cmake +@@ -28,6 +28,9 @@ find_library(MBEDX509_LIBRARY mbedx509) + find_library(MBEDCRYPTO_LIBRARY mbedcrypto) + + set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}") ++if(WIN32) ++ list(APPEND MBEDTLS_LIBRARIES ws2_32) ++endif() + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(MbedTLS DEFAULT_MSG diff --git a/vcpkg/overlay/curl/portfile.cmake b/vcpkg/overlay/curl/portfile.cmake new file mode 100644 index 0000000000..a668b9bbd7 --- /dev/null +++ b/vcpkg/overlay/curl/portfile.cmake @@ -0,0 +1,149 @@ +string(REPLACE "." "_" curl_version "curl-${VERSION}") +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO curl/curl + REF "${curl_version}" + SHA512 c8550fef49e2f1571f7392a351e10bbdb23821069db1e988094fe27fe0a881a265ba69a2cd34462e630563d153462a975ef70472ba39adaad1c5e5ab45cf7f4f + HEAD_REF master + PATCHES + 0002_fix_uwp.patch + 0005_remove_imp_suffix.patch + 0012-fix-dependency-idn2.patch + 0020-fix-pc-file.patch + 0022-deduplicate-libs.patch + mbedtls-ws2_32.patch + export-components.patch + dependencies.patch + cmake-config.patch # https://github.com/curl/curl/pull/11913 + have_h_errno_assignable.patch # https://github.com/curl/curl/commit/104767ae480f7adba7ed3f50b7f5bfe29934668d +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + # Support HTTP2 TLS Download https://curl.haxx.se/ca/cacert.pem rename to curl-ca-bundle.crt, copy it to libcurl.dll location. + http2 USE_NGHTTP2 + wolfssl CURL_USE_WOLFSSL + openssl CURL_USE_OPENSSL + mbedtls CURL_USE_MBEDTLS + ssh CURL_USE_LIBSSH2 + tool BUILD_CURL_EXE + c-ares ENABLE_ARES + sspi CURL_WINDOWS_SSPI + brotli CURL_BROTLI + schannel CURL_USE_SCHANNEL + sectransp CURL_USE_SECTRANSP + idn2 USE_LIBIDN2 + winidn USE_WIN32_IDN + winldap USE_WIN32_LDAP + websockets ENABLE_WEBSOCKETS + zstd CURL_ZSTD + INVERTED_FEATURES + non-http HTTP_ONLY + winldap CURL_DISABLE_LDAP # Only WinLDAP support ATM +) + +set(OPTIONS "") +if("idn2" IN_LIST FEATURES) + vcpkg_find_acquire_program(PKGCONFIG) + list(APPEND OPTIONS "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}") +endif() + +if("sectransp" IN_LIST FEATURES) + list(APPEND OPTIONS -DCURL_CA_PATH=none -DCURL_CA_BUNDLE=none) +endif() + +# UWP targets +if(VCPKG_TARGET_IS_UWP) + list(APPEND OPTIONS + -DCURL_DISABLE_TELNET=ON + -DENABLE_IPV6=OFF + -DENABLE_UNIX_SOCKETS=OFF + ) +endif() + +if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND OPTIONS -DENABLE_UNICODE=ON) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake" + ${FEATURE_OPTIONS} + ${OPTIONS} + -DBUILD_TESTING=OFF + -DENABLE_MANUAL=OFF + -DCURL_CA_FALLBACK=ON + -DCURL_USE_LIBPSL=OFF + -DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON + OPTIONS_DEBUG + -DENABLE_DEBUG=ON +) +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +if ("tool" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES curl AUTO_CLEAN) +endif() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/CURL) + +vcpkg_fixup_pkgconfig() +set(namespec "curl") +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + set(namespec "libcurl") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libcurl.pc" " -lcurl" " -l${namespec}") +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libcurl.pc" " -lcurl" " -l${namespec}-d") +endif() + +#Fix install path +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_PACKAGES_DIR}" "\${prefix}") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_INSTALLED_DIR}" "\${prefix}") +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "\nprefix=\${prefix}" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../../.. && pwd -P)]=]) +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin") +file(RENAME "${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/curl-config") +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/curl-config") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_PACKAGES_DIR}" "\${prefix}") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_INSTALLED_DIR}" "\${prefix}") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "\nprefix=\${prefix}/debug" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../../../.. && pwd -P)]=]) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "-lcurl" "-l${namespec}-d") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "curl." "curl-d.") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/curl-config") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/curl/curl.h" + "#ifdef CURL_STATICLIB" + "#if 1" + ) +endif() + +file(INSTALL "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +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}" +) diff --git a/vcpkg/overlay/curl/usage b/vcpkg/overlay/curl/usage new file mode 100644 index 0000000000..eea11400ee --- /dev/null +++ b/vcpkg/overlay/curl/usage @@ -0,0 +1,4 @@ +curl is compatible with built-in CMake targets: + + find_package(CURL REQUIRED) + target_link_libraries(main PRIVATE CURL::libcurl) diff --git a/vcpkg/overlay/curl/vcpkg-cmake-wrapper.cmake b/vcpkg/overlay/curl/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000000..5e64ef762a --- /dev/null +++ b/vcpkg/overlay/curl/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,75 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0057 NEW) + +if(NOT CMAKE_VERSION VERSION_LESS 3.14 AND COMPONENTS IN_LIST ARGS) + include("${CMAKE_CURRENT_LIST_DIR}/CURLConfigComponents.cmake") +endif() + +list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE") +_find_package(${ARGS} CONFIG) + +if(CURL_FOUND) + 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 "") + endif() + if(_curl_link_libraries MATCHES "ZLIB::ZLIB") + string(REGEX REPLACE "([\$]<[^;]*)?ZLIB::ZLIB([^;]*>)?" "${ZLIB_LIBRARIES}" _curl_link_libraries "${_curl_link_libraries}") + endif() + 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_(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_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_target}" IMPORTED_LOCATION_DEBUG) + get_target_property(_libssh2_LIBRARY_RELEASE "${_libssh2_target}" IMPORTED_LOCATION_RELEASE) + endif() + select_library_configurations(_libssh2) + 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_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() + + 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_include_dirs) + unset(_curl_link_libraries) + unset(_curl_location_debug) + unset(_curl_location_release) + unset(_curl_target) +endif() +cmake_policy(POP) diff --git a/vcpkg/overlay/curl/vcpkg.json b/vcpkg/overlay/curl/vcpkg.json new file mode 100644 index 0000000000..e028d38970 --- /dev/null +++ b/vcpkg/overlay/curl/vcpkg.json @@ -0,0 +1,210 @@ +{ + "name": "curl", + "version": "8.4.0", + "description": "A library for transferring data with URLs", + "homepage": "https://curl.se/", + "license": "curl AND ISC AND BSD-3-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "default-features": [ + "non-http", + "ssl" + ], + "features": { + "brotli": { + "description": "brotli support (brotli)", + "dependencies": [ + "brotli" + ] + }, + "c-ares": { + "description": "c-ares support", + "dependencies": [ + "c-ares" + ] + }, + "http2": { + "description": "HTTP2 support", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "ssl" + ] + }, + "nghttp2" + ] + }, + "idn": { + "description": "Default IDN support", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "winidn" + ], + "platform": "windows" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "idn2" + ], + "platform": "!windows" + } + ] + }, + "idn2": { + "description": "idn2 support (libidn2)", + "dependencies": [ + "libidn2" + ] + }, + "mbedtls": { + "description": "SSL support (mbedTLS)", + "dependencies": [ + "mbedtls" + ] + }, + "non-http": { + "description": "Enables protocols beyond HTTP/HTTPS/HTTP2" + }, + "openssl": { + "description": "SSL support (OpenSSL)", + "dependencies": [ + "openssl" + ] + }, + "schannel": { + "description": "SSL support (Secure Channel)", + "supports": "windows & !uwp", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "sspi" + ] + } + ] + }, + "sectransp": { + "description": "SSL support (sectransp)", + "supports": "osx | ios" + }, + "ssh": { + "description": "SSH support via libssh2", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "non-http" + ] + }, + { + "name": "curl", + "default-features": false, + "features": [ + "openssl" + ] + }, + "libssh2" + ] + }, + "ssl": { + "description": "Default SSL backend", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "sectransp" + ], + "platform": "osx | ios" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "schannel" + ], + "platform": "(windows & !uwp) | mingw" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "openssl" + ], + "platform": "(uwp | !windows) & !(osx | ios) & !mingw" + } + ] + }, + "sspi": { + "description": "SSPI support", + "supports": "windows & !uwp" + }, + "tool": { + "description": "Builds curl executable", + "supports": "!uwp" + }, + "websockets": { + "description": "WebSocket support (experimental)" + }, + "winidn": { + "description": "WinIDN support", + "supports": "windows" + }, + "winldap": { + "description": "LDAP support (WinLDAP). This feature does not include LDAPS support.", + "supports": "windows & !uwp", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "non-http" + ] + } + ] + }, + "winssl": { + "description": "Legacy name for schannel", + "supports": "windows & !uwp", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "schannel" + ] + } + ] + }, + "wolfssl": { + "description": "SSL support (wolfSSL)", + "dependencies": [ + "wolfssl" + ] + }, + "zstd": { + "description": "ZStandard support (zstd)", + "dependencies": [ + "zstd" + ] + } + } +}