aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpravic <ehysta@gmail.com>2018-02-27 23:15:37 +0300
committerRobert Schumacher <roschuma@microsoft.com>2018-02-27 12:15:37 -0800
commitf272a872d40edc2714f0b326e211e9b181aa65cc (patch)
treea97d9cb065b5cc6408e23bfb1cd2ca758ddc927b
parentfd08d14bdbd54a0715dfa1404be5383b01f68187 (diff)
downloadvcpkg-f272a872d40edc2714f0b326e211e9b181aa65cc.tar.gz
vcpkg-f272a872d40edc2714f0b326e211e9b181aa65cc.zip
[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.
-rw-r--r--ports/cpr/CONTROL4
-rw-r--r--ports/curl/CONTROL25
-rw-r--r--ports/curl/portfile.cmake79
3 files changed, 83 insertions, 25 deletions
diff --git a/ports/cpr/CONTROL b/ports/cpr/CONTROL
index f79ef823c..6a2751073 100644
--- a/ports/cpr/CONTROL
+++ b/ports/cpr/CONTROL
@@ -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]
diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL
index 6db37600a..e7f13888d 100644
--- a/ports/curl/CONTROL
+++ b/ports/curl/CONTROL
@@ -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
diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake
index b13cdb309..ffb73b425 100644
--- a/ports/curl/portfile.cmake
+++ b/ports/curl/portfile.cmake
@@ -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)