Skip to content

Commit

Permalink
[curl] Refactor curl port (#38786)
Browse files Browse the repository at this point in the history
Refactor curl port:
- Add test
- Refine dependencies patch
- gssapi feature is not for windows

<!-- If your PR fixes issues, please note that here by adding "Fixes
#NNNNNN." for each fixed issue on separate lines. -->

<!-- If you are still working on the PR, open it as a Draft:
https://github.blog/2019-02-14-introducing-draft-pull-requests/. -->


- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [x] The "supports" clause reflects platforms that may be fixed by this
new version.
- [x] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [x] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.


<!-- If this PR adds a new port, please uncomment and fill out this
checklist:

- [ ] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] The name of the port matches an existing name for this component
on https://repology.org/ if possible, and/or is strongly associated with
that component on search engines.
- [ ] Optional dependencies are resolved in exactly one way. For
example, if the component is built with CMake, all `find_package` calls
are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or
disabled with
[CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [ ] The versioning scheme in `vcpkg.json` matches what upstream says.
- [ ] The license declaration in `vcpkg.json` matches what upstream
says.
- [ ] The installed as the "copyright" file matches what upstream says.
- [ ] The source code of the component installed comes from an
authoritative source.
- [ ] The generated "usage text" is accurate. See
[adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md)
for context.
- [ ] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [ ] Only one version is in the new port's versions file.
- [ ] Only one version is added to each modified port's versions file.

END OF NEW PORT CHECKLIST (delete this line) -->

Co-authored-by: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com>
  • Loading branch information
talregev and WangWeiLin-MV committed May 23, 2024
1 parent 4215306 commit 829c9e3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
12 changes: 6 additions & 6 deletions ports/curl/dependencies.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
index 056907c..c89c686 100644
index 9adb96e0a..a013adf7a 100644
--- a/CMake/curl-config.cmake.in
+++ b/CMake/curl-config.cmake.in
@@ -31,6 +31,16 @@ if(@USE_ZLIB@)
Expand All @@ -20,7 +20,7 @@ index 056907c..c89c686 100644
check_required_components("@PROJECT_NAME@")

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 049ac34..cc0fe19 100644
index 656aa7c74..90a7c1371 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,8 @@ set(CURL_LIBS "")
Expand Down Expand Up @@ -74,16 +74,16 @@ index 049ac34..cc0fe19 100644
if(LIBSSH2_FOUND)
list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY})
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}")
@@ -917,6 +917,14 @@ option(CURL_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is sup
@@ -917,6 +925,14 @@ option(CURL_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is sup
mark_as_advanced(CURL_USE_GSSAPI)

if(CURL_USE_GSSAPI)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(KRB5 REQUIRED krb5 krb5-gssapi)
+ list(APPEND CURL_LIBS ${KRB5_LINK_LIBRARIES} resolv)
+ set(HAVE_GSSAPI_GSSAPI_H ON)
+ set(HAVE_GSSAPI_GSSAPI_GENERIC_H ON)
+ set(HAVE_GSSAPI_GSSAPI_KRB5_H ON)
+ check_include_file_concat("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
+ check_include_file_concat("gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
+ check_include_file_concat("gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H)
+ set(HAVE_GSSAPI ON)
+ elseif(0)
find_package(GSS)
Expand Down
2 changes: 1 addition & 1 deletion ports/curl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
)

set(OPTIONS "")
if("idn2" IN_LIST FEATURES OR ("ldap" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_WINDOWS))
if(("idn2" IN_LIST FEATURES) OR ("gssapi" IN_LIST FEATURES) OR ("ldap" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_WINDOWS))
vcpkg_find_acquire_program(PKGCONFIG)
list(APPEND OPTIONS "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}")
endif()
Expand Down
3 changes: 2 additions & 1 deletion ports/curl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "curl",
"version": "8.7.1",
"port-version": 3,
"port-version": 4,
"description": "A library for transferring data with URLs",
"homepage": "https://curl.se/",
"license": "curl AND ISC AND BSD-3-Clause",
Expand Down Expand Up @@ -35,6 +35,7 @@
},
"gssapi": {
"description": "krb5 support",
"supports": "!windows",
"dependencies": [
"krb5"
]
Expand Down
7 changes: 7 additions & 0 deletions scripts/test_ports/vcpkg-ci-curl/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"tool"
],
"platform": "!android & !uwp"
},
{
"name": "curl",
"features": [
"gssapi"
],
"platform": "linux"
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@
},
"curl": {
"baseline": "8.7.1",
"port-version": 3
"port-version": 4
},
"curlpp": {
"baseline": "2018-06-15",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/curl.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e6772f7da4a8824fd967ec448a3c1f8ca3b8b53b",
"version": "8.7.1",
"port-version": 4
},
{
"git-tree": "32945fcb82088dc4055db602b3ebe95f67f04326",
"version": "8.7.1",
Expand Down

0 comments on commit 829c9e3

Please sign in to comment.