mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[curl] Add support of different features. (#2862)
* [curl] Add support of different features. Default-Features: openssl, http2, ssh (as in previous builds) Feature: curl Description: Builds curl executable (placed in the /tools directory) Feature: http-only Description: Disables all protocols except HTTP/HTTPS/HTTP2 Feature: http2 Build-Depends: nghttp2, openssl Description: HTTP2 support (requires openssl) Feature: openssl Build-Depends: openssl Description: SSL support via OpenSSL Feature: winssl Description: SSL support via Schannel Feature: ssh Build-Depends: libssh2 Description: SSH support via libssh2 * [cpr] Add features of the curl library. * [cpr] Remove transitive features * [curl] Remove http2 from default features. Remove winssl feature. Rename "curl" feature to "tool". * [curl] Fixup curl -> tool renaming * [curl] Further refactoring of WINSSL/Openssl -- use single ssl feature.
This commit is contained in:
parent
fd08d14bdb
commit
f272a872d4
@ -1,4 +1,4 @@
|
||||
Source: cpr
|
||||
Version: 1.3.0-1
|
||||
Version: 1.3.0-3
|
||||
Description: C++ Requests is a simple wrapper around libcurl inspired by the excellent Python Requests project.
|
||||
Build-Depends: curl
|
||||
Build-Depends: curl[core]
|
||||
|
@ -1,5 +1,24 @@
|
||||
Source: curl
|
||||
Version: 7.58.0-1
|
||||
Build-Depends: zlib, openssl, libssh2, nghttp2
|
||||
Version: 7.58.0-4
|
||||
Build-Depends: zlib
|
||||
Description: A library for transferring data with URLs
|
||||
# For WINSSL create target triplet which contains set(CURL_USE_WINSSL ON)
|
||||
Default-Features: ssl
|
||||
# For WINSSL add set(CURL_USE_WINSSL ON) to your triplet file
|
||||
|
||||
Feature: tool
|
||||
Description: Builds curl executable
|
||||
|
||||
Feature: non-http
|
||||
Description: Enables protocols beyond HTTP/HTTPS/HTTP2
|
||||
|
||||
Feature: http2
|
||||
Build-Depends: nghttp2, ssl
|
||||
Description: HTTP2 support
|
||||
|
||||
Feature: ssl
|
||||
Build-Depends: openssl
|
||||
Description: SSL support
|
||||
|
||||
Feature: ssh
|
||||
Build-Depends: libssh2, curl[non-http]
|
||||
Description: SSH support via libssh2
|
||||
|
@ -14,24 +14,49 @@ vcpkg_apply_patches(
|
||||
${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CURL_STATICLIB)
|
||||
|
||||
# Support HTTP2 TSL Download https://curl.haxx.se/ca/cacert.pem rename to curl-ca-bundle.crt, copy it to libcurl.dll location.
|
||||
SET(HTTP2_OPTIONS)
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
SET(CURL_STATICLIB OFF)
|
||||
SET(HTTP2_OPTIONS
|
||||
-DUSE_NGHTTP2=ON
|
||||
)
|
||||
else()
|
||||
SET(CURL_STATICLIB ON)
|
||||
set(HTTP2_OPTIONS)
|
||||
if("http2" IN_LIST FEATURES)
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
message(FATAL_ERROR "The http2 feature cannot be enabled when building for UWP.")
|
||||
endif()
|
||||
|
||||
set(HTTP2_OPTIONS -DUSE_NGHTTP2=ON)
|
||||
endif()
|
||||
|
||||
set(USE_OPENSSL ON)
|
||||
if(CURL_USE_WINSSL)
|
||||
set(USE_OPENSSL OFF)
|
||||
set(USE_WINSSL ON)
|
||||
set(HTTP2_OPTIONS) ## disable HTTP2 when CURL_USE_WINSSL
|
||||
# SSL
|
||||
set(USE_OPENSSL OFF)
|
||||
set(USE_WINSSL OFF)
|
||||
if("ssl" IN_LIST FEATURES)
|
||||
if(CURL_USE_WINSSL)
|
||||
set(USE_WINSSL ON)
|
||||
else()
|
||||
set(USE_OPENSSL ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# SSH
|
||||
set(USE_LIBSSH2 OFF)
|
||||
if("ssh" IN_LIST FEATURES)
|
||||
set(USE_LIBSSH2 ON)
|
||||
endif()
|
||||
|
||||
# HTTP/HTTPS only
|
||||
# Note that `HTTP_ONLY` curl option disables everything including HTTPS, which is not an option.
|
||||
set(USE_HTTP_ONLY ON)
|
||||
if("non-http" IN_LIST FEATURES)
|
||||
set(USE_HTTP_ONLY OFF)
|
||||
endif()
|
||||
|
||||
# curl exe
|
||||
set(BUILD_CURL_EXE OFF)
|
||||
if("tool" IN_LIST FEATURES)
|
||||
set(BUILD_CURL_EXE ON)
|
||||
endif()
|
||||
|
||||
# UWP targets
|
||||
set(UWP_OPTIONS)
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(UWP_OPTIONS
|
||||
@ -40,7 +65,6 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
-DENABLE_IPV6=OFF
|
||||
-DENABLE_UNIX_SOCKETS=OFF
|
||||
)
|
||||
set(HTTP2_OPTIONS) ## disable curl HTTP2 support
|
||||
endif()
|
||||
|
||||
vcpkg_find_acquire_program(PERL)
|
||||
@ -54,12 +78,17 @@ vcpkg_configure_cmake(
|
||||
${UWP_OPTIONS}
|
||||
${HTTP2_OPTIONS}
|
||||
-DBUILD_TESTING=OFF
|
||||
-DBUILD_CURL_EXE=OFF
|
||||
-DBUILD_CURL_EXE=${BUILD_CURL_EXE}
|
||||
-DENABLE_MANUAL=OFF
|
||||
-DCURL_STATICLIB=${CURL_STATICLIB}
|
||||
-DCMAKE_USE_OPENSSL=${USE_OPENSSL}
|
||||
-DCMAKE_USE_WINSSL=${USE_WINSSL}
|
||||
-DCMAKE_USE_LIBSSH2=${USE_LIBSSH2}
|
||||
-DHTTP_ONLY=${USE_HTTP_ONLY}
|
||||
OPTIONS_RELEASE
|
||||
-DBUILD_CURL_EXE=${BUILD_CURL_EXE}
|
||||
OPTIONS_DEBUG
|
||||
-DBUILD_CURL_EXE=OFF
|
||||
-DENABLE_DEBUG=ON
|
||||
)
|
||||
|
||||
@ -68,17 +97,27 @@ vcpkg_install_cmake()
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/curl RENAME copyright)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/curl.exe")
|
||||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/curl")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/curl.exe ${CURRENT_PACKAGES_DIR}/tools/curl/curl.exe)
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/curl)
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
# Drop debug suffix, as FindCURL.cmake does not look for it
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl.lib)
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d.lib")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl.lib)
|
||||
endif()
|
||||
else()
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/curl-config ${CURRENT_PACKAGES_DIR}/debug/bin/curl-config)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libcurl_imp.lib ${CURRENT_PACKAGES_DIR}/lib/libcurl.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d_imp.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl.lib)
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/libcurl_imp.lib")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libcurl_imp.lib ${CURRENT_PACKAGES_DIR}/lib/libcurl.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d_imp.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl.lib)
|
||||
endif()
|
||||
endif()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/include/curl/curl.h CURL_H)
|
||||
|
Loading…
x
Reference in New Issue
Block a user