[curl] Add feature idn2 (#14807)

Thanks for fixing phantom dependencies!
This commit is contained in:
Jack·Boos·Yu 2020-12-22 23:19:50 -08:00 committed by GitHub
parent 4cf45e80e3
commit 3efce9a5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,51 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc7223b..a661cb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -620,9 +620,6 @@ if(NOT CURL_DISABLE_LDAPS)
check_include_file_concat("ldapssl.h" HAVE_LDAPSSL_H)
endif()
-# Check for idn
-check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2)
-
# Check for symbol dlopen (same as HAVE_LIBDL)
check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN)
@@ -870,6 +867,20 @@ if(CURL_CA_PATH_SET AND NOT USE_OPENSSL AND NOT USE_MBEDTLS)
"Set CURL_CA_PATH=none or enable one of those TLS backends.")
endif()
+if (CMAKE_USE_IDN2)
+ include(FindPackageHandleStandardArgs)
+ include(SelectLibraryConfigurations)
+
+ find_path(LIBIDN2_INCLUDE_DIRS idn2.h)
+ find_library(LIBIDN2_LIBRARY_DEBUG NAMES libidn2 idn2 PATHS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib NO_DEFAULT_PATH Release RelWithDebInfo MinSizeRel)
+ find_library(LIBIDN2_LIBRARY_RELEASE NAMES libidn2 idn2 PATHS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib NO_DEFAULT_PATH Debug)
+ select_library_configurations(LIBIDN2)
+
+ add_definitions(-DHAVE_IDN2_H -DHAVE_LIBIDN2)
+ include_directories(${LIBIDN2_INCLUDE_DIRS})
+ link_libraries(${LIBIDN2_LIBRARY})
+endif()
+
# Check for header files
if(NOT UNIX)
check_include_file_concat("windows.h" HAVE_WINDOWS_H)
@@ -906,7 +917,6 @@ check_include_file_concat("crypto.h" HAVE_CRYPTO_H)
check_include_file_concat("err.h" HAVE_ERR_H)
check_include_file_concat("errno.h" HAVE_ERRNO_H)
check_include_file_concat("fcntl.h" HAVE_FCNTL_H)
-check_include_file_concat("idn2.h" HAVE_IDN2_H)
check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H)
check_include_file_concat("io.h" HAVE_IO_H)
check_include_file_concat("krb.h" HAVE_KRB_H)
@@ -1362,7 +1372,6 @@ _add_if("libz" HAVE_LIBZ)
_add_if("brotli" HAVE_BROTLI)
_add_if("zstd" HAVE_ZSTD)
_add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
-_add_if("IDN" HAVE_LIBIDN2)
_add_if("Largefile" (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND
((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
# TODO SSP1 (Schannel) check is missing

View File

@ -1,4 +1,5 @@
Source: curl
Port-Version: 1
Version: 7.74.0
Build-Depends: zlib
Homepage: https://github.com/curl/curl
@ -51,4 +52,8 @@ Description: SSPI support
Feature: brotli
Build-Depends: brotli
Description: brotli support (brotli)
Description: brotli support (brotli)
Feature: idn2
Build-Depends: libidn2
Description: idn2 support (libidn2)

View File

@ -13,6 +13,7 @@ vcpkg_from_github(
0009_fix_openssl_config.patch
0010_fix_othertests_cmake.patch
0011_fix_static_build.patch
0012-fix-dependency-idn2.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CURL_STATICLIB)
@ -41,6 +42,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
brotli CURL_BROTLI
schannel CMAKE_USE_SCHANNEL
sectransp CMAKE_USE_SECTRANSP
idn2 CMAKE_USE_IDN2
INVERTED_FEATURES
non-http HTTP_ONLY
@ -186,4 +188,4 @@ elseif(VCPKG_TARGET_IS_LINUX)
endif()
file(INSTALL ${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)