vcpkg/ports/curl/portfile.cmake

160 lines
6.2 KiB
CMake
Raw Normal View History

string(REPLACE "." "_" curl_version "curl-${VERSION}")
2024-03-29 13:59:27 +08:00
# Fix for HTTP compression introduced in 8.7.1; should be fixed the following release
vcpkg_download_distfile(
COMPRESSION_FIX
URLS https://github.com/curl/curl/commit/b30d694a027eb771c02a3db0dee0ca03ccab7377.patch?full_index=1
FILENAME curl-compression-fix-b30d694a027eb771c02a3db0dee0ca03ccab7377.patch
SHA512 2658826a7331adb86cd7cd692dac6c7bf79bbd9c76c11780f33b1143b6d04edfe64223356701343c31209261decffc883ddba061d5370d7872a81f2a18780c33
)
2017-08-11 03:43:50 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO curl/curl
2023-06-02 02:07:32 +08:00
REF "${curl_version}"
2024-03-29 13:59:27 +08:00
SHA512 38a1f7d7f5c83922cd4e0a858ac803d230d691c8f4df7e5086062c6991da740e626aa86675683282bc8555fc4cb962a08ba1a7ce817d78961d749d6d580fb9fa
2017-08-11 03:43:50 +08:00
HEAD_REF master
PATCHES
0002_fix_uwp.patch
0005_remove_imp_suffix.patch
0012-fix-dependency-idn2.patch
0020-fix-pc-file.patch
0022-deduplicate-libs.patch
mbedtls-ws2_32.patch
export-components.patch
dependencies.patch
2024-01-03 06:32:00 +08:00
cmake-config.patch
2024-03-29 13:59:27 +08:00
"${COMPRESSION_FIX}"
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
# Support HTTP2 TLS Download https://curl.haxx.se/ca/cacert.pem rename to curl-ca-bundle.crt, copy it to libcurl.dll location.
http2 USE_NGHTTP2
wolfssl CURL_USE_WOLFSSL
openssl CURL_USE_OPENSSL
mbedtls CURL_USE_MBEDTLS
ssh CURL_USE_LIBSSH2
tool BUILD_CURL_EXE
c-ares ENABLE_ARES
sspi CURL_WINDOWS_SSPI
brotli CURL_BROTLI
schannel CURL_USE_SCHANNEL
sectransp CURL_USE_SECTRANSP
idn2 USE_LIBIDN2
winidn USE_WIN32_IDN
websockets ENABLE_WEBSOCKETS
2023-07-14 02:24:11 +08:00
zstd CURL_ZSTD
[curl] add psl feature (#38345) <!-- 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) -->
2024-04-24 22:57:12 +08:00
psl CURL_USE_LIBPSL
[krb5, curl] Add new port, and add new feature curl[gssapi] (#38402) - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] 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. - [x] 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). - [x] The versioning scheme in `vcpkg.json` matches what upstream says. - [x] The license declaration in `vcpkg.json` matches what upstream says. - [x] The installed as the "copyright" file matches what upstream says. - [x] The source code of the component installed comes from an authoritative source. - [x] The generated "usage text" is accurate. See [adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md) for context. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is in the new port's versions file. - [x] Only one version is added to each modified port's versions file. krb5 have an issue of absolute paths that I am not sure how to fix, also I didn't succeeded to compile it on windows, but this PR is a good start. ``` warning: There should be no absolute paths, such as the following, in an installed package: /home/tal/vcpkg/packages/krb5_x64-linux /home/tal/vcpkg/installed /home/tal/vcpkg/buildtrees/krb5 /home/tal/vcpkg/downloads Absolute paths were found in the following files: /home/tal/vcpkg/packages/krb5_x64-linux/tools/krb5/bin/compile_et /home/tal/vcpkg/packages/krb5_x64-linux/tools/krb5/bin/krb5-config /home/tal/vcpkg/packages/krb5_x64-linux/tools/krb5/debug/bin/compile_et /home/tal/vcpkg/packages/krb5_x64-linux/tools/krb5/debug/bin/krb5-config error: Found 1 post-build check problem(s). To submit these ports to curated catalogs, please first correct the portfile: /home/tal/vcpkg/ports/krb5/portfile.cmake ```
2024-05-07 03:59:50 +08:00
gssapi CURL_USE_GSSAPI
INVERTED_FEATURES
ldap CURL_DISABLE_LDAP
ldap CURL_DISABLE_LDAPS
non-http HTTP_ONLY
)
set(OPTIONS "")
[curl] Refactor curl port (#38786) 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>
2024-05-23 10:42:11 +08:00
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()
if("sectransp" IN_LIST FEATURES)
list(APPEND OPTIONS -DCURL_CA_PATH=none -DCURL_CA_BUNDLE=none)
2019-07-08 14:11:01 +08:00
endif()
# UWP targets
if(VCPKG_TARGET_IS_UWP)
list(APPEND OPTIONS
2017-08-11 03:43:50 +08:00
-DCURL_DISABLE_TELNET=ON
-DENABLE_IPV6=OFF
-DENABLE_UNIX_SOCKETS=OFF
)
endif()
2016-09-19 11:50:08 +08:00
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS -DENABLE_UNICODE=ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
${FEATURE_OPTIONS}
${OPTIONS}
2017-08-11 03:43:50 +08:00
-DBUILD_TESTING=OFF
-DENABLE_CURL_MANUAL=OFF
2020-09-05 12:18:37 +08:00
-DCURL_CA_FALLBACK=ON
2023-06-02 02:07:32 +08:00
-DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON
OPTIONS_DEBUG
-DENABLE_DEBUG=ON
2017-08-11 03:43:50 +08:00
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
if ("tool" IN_LIST FEATURES)
2020-08-08 07:15:20 +08:00
vcpkg_copy_tools(TOOL_NAMES curl AUTO_CLEAN)
endif()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/CURL)
vcpkg_fixup_pkgconfig()
set(namespec "curl")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(namespec "libcurl")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libcurl.pc" " -lcurl" " -l${namespec}")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libcurl.pc" " -lcurl" " -l${namespec}-d")
endif()
#Fix install path
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_PACKAGES_DIR}" "\${prefix}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_INSTALLED_DIR}" "\${prefix}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "\nprefix=\${prefix}" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../../.. && pwd -P)]=])
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/curl-config")
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/curl-config")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_PACKAGES_DIR}" "\${prefix}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_INSTALLED_DIR}" "\${prefix}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "\nprefix=\${prefix}/debug" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../../../.. && pwd -P)]=])
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "-lcurl" "-l${namespec}-d")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "curl." "curl-d.")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/curl-config")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
2017-08-11 03:43:50 +08:00
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/curl/curl.h"
"#ifdef CURL_STATICLIB"
"#if 1"
)
endif()
file(INSTALL "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(READ "${SOURCE_PATH}/lib/krb5.c" krb5_c)
string(REGEX REPLACE "#i.*" "" krb5_c "${krb5_c}")
set(krb5_copyright "${CURRENT_BUILDTREES_DIR}/krb5.c Notice")
file(WRITE "${krb5_copyright}" "${krb5_c}")
file(READ "${SOURCE_PATH}/lib/inet_ntop.c" inet_ntop_c)
string(REGEX REPLACE "#i.*" "" inet_ntop_c "${inet_ntop_c}")
set(inet_ntop_copyright "${CURRENT_BUILDTREES_DIR}/inet_ntop.c and inet_pton.c Notice")
file(WRITE "${inet_ntop_copyright}" "${inet_ntop_c}")
vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/COPYING"
"${krb5_copyright}"
"${inet_ntop_copyright}"
)