Skip to content

Commit

Permalink
[curl] Update (#18971)
Browse files Browse the repository at this point in the history
* Modernize portfile

* Don't export implicit link libraries

* Revise osx framework handling

* Fix exported per-config location of dependencies

* Move curl-config to tools, incl. debug variant

* Update to 7.77.0

* Add WinIDN support and default IDN selection

* Use pkgconfig for libidn2 configuration

* Update to 0.78.0

* Remove obsolete nghttp2 staticlib patch

* Fix libs duplication in pc file

* Resolve transitive deps for pc file/curl-config

* x-add-version

* Fix winssl dependencies

* Add winldap feature, not default

* Update git-tree

Co-authored-by: past-due <30942300+past-due@users.noreply.github.com>
  • Loading branch information
dg0yt and past-due authored Aug 12, 2021
1 parent ad42c88 commit 6a9ecfd
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 161 deletions.
12 changes: 0 additions & 12 deletions ports/curl/0002_fix_uwp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,4 @@ index 62b7b33..8a4bd71 100644
if(WIN32)
add_definitions(-D_USRDLL)
endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e47967..7694f04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -505,7 +505,7 @@ if(USE_QUICHE)
cmake_pop_check_state()
endif()

-if(WIN32)
+if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(USE_WIN32_CRYPTO ON)
endif()

14 changes: 0 additions & 14 deletions ports/curl/0004_nghttp2_staticlib.patch

This file was deleted.

5 changes: 3 additions & 2 deletions ports/curl/0005_remove_imp_suffix.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ index 1d71e14..62b7b33 100644
-if(WIN32)
+if(WIN32 AND 0)
if(BUILD_SHARED_LIBS)
# Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib"
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
if(MSVC)
# Add "_imp" as a suffix before the extension to avoid conflicting with
# the statically linked "libcurl.lib"
55 changes: 9 additions & 46 deletions ports/curl/0012-fix-dependency-idn2.patch
Original file line number Diff line number Diff line change
@@ -1,51 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc7223b..a661cb8 100644
index 9f6de81..6702845 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)
@@ -632,6 +632,9 @@ endif()
option(USE_LIBIDN2 "Use libidn2 for IDN support" ON)
set(HAVE_LIBIDN2 OFF)
if(USE_LIBIDN2)
+ set(HAVE_LIBIDN2 TRUE)
+ list(APPEND CURL_LIBS ${LIBIDN2_LIBRARIES})
+elseif(0)
check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2)
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
55 changes: 49 additions & 6 deletions ports/curl/0020-fix-pc-file.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,59 @@
diff -urw a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2021-05-10 20:46:52.204346972 +0200
+++ b/CMakeLists.txt 2021-05-11 19:39:00.065235266 +0200
@@ -1482,6 +1482,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b2e428..ea430f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1462,7 +1462,26 @@ 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})
+function(flatten input output)
+ set(output_libs "${${output}}")
+ set(input_libs "${${input}}")
+ while(input_libs)
+ list(POP_BACK input_libs lib)
+ if(NOT "${lib}" IN_LIST output_libs)
+ if(TARGET "${lib}")
+ get_target_property(link_libs "${lib}" INTERFACE_LINK_LIBRARIES)
+ if(link_libs)
+ flatten(link_libs output_libs)
+ endif()
+ endif()
+ list(PREPEND output_libs "${lib}")
+ endif()
+ endwhile()
+ set("${output}" "${output_libs}" PARENT_SCOPE)
+endfunction()
+set(CURL_LIBS_FLAT "")
+flatten(CURL_LIBS CURL_LIBS_FLAT)
+foreach(_lib ${CURL_LIBS_FLAT})
if(TARGET "${_lib}")
set(_libname "${_lib}")
get_target_property(_libtype "${_libname}" TYPE)
@@ -1473,12 +1492,26 @@ foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
# this information in the .pc file.
continue()
endif()
+ set(_lib NOTFOUND)
+ if(DEFINED CMAKE_BUILD_TYPE)
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" config)
+ get_target_property(_lib "${_libname}" IMPORTED_LOCATION_${config})
+ endif()
+ if(NOT _lib)
get_target_property(_lib "${_libname}" LOCATION)
+ endif()
if(NOT _lib)
message(WARNING "Bad lib in library list: ${_libname}")
continue()
endif()
+ elseif(_lib MATCHES "^(.*)/([^/]*)[.]framework$")
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()
endif()
+ endif()
if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-")
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
else()
13 changes: 13 additions & 0 deletions ports/curl/0021-normaliz.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d209be..9f6de81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -638,7 +638,7 @@ endif()
if(WIN32)
option(USE_WIN32_IDN "Use WinIDN for IDN support" OFF)
if(USE_WIN32_IDN)
- list(APPEND CURL_LIBS "Normaliz")
+ list(APPEND CURL_LIBS "normaliz")
set(WANT_IDN_PROTOTYPES ON)
endif()
endif()
25 changes: 25 additions & 0 deletions ports/curl/0022-deduplicate-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09d82f1..f0d99e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1507,6 +1507,7 @@ else()
set(ENABLE_SHARED "no")
set(ENABLE_STATIC "yes")
set(LIBCURL_NO_SHARED "${LIBCURL_LIBS}")
+ set(LIBCURL_LIBS "")
endif()
# "a" (Linux) or "lib" (Windows)
string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}")
diff --git a/curl-config.in b/curl-config.in
index 8b4a29a..e756ae8 100644
--- a/curl-config.in
+++ b/curl-config.in
@@ -172,7 +172,7 @@ while test $# -gt 0; do

--static-libs)
if test "X@ENABLE_STATIC@" != "Xno" ; then
- echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@
+ echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_NO_SHARED@
else
echo "curl was built with static libraries disabled" >&2
exit 1
Loading

0 comments on commit 6a9ecfd

Please sign in to comment.