From a4eca5fabc1743e309e75736c6d8a2420f48193d Mon Sep 17 00:00:00 2001 From: Kevin Lu <6320810+kevinlul@users.noreply.github.com> Date: Tue, 20 Oct 2020 15:23:12 -0400 Subject: [libgit2] Devendor bundled dependencies and allow choosing SSL backend (#13074) --- ports/libgit2/CONTROL | 27 +++++++++++++++++++- ports/libgit2/portfile.cmake | 59 +++++++++++++++++++++++++++++++++++++++----- ports/pcre2/CONTROL | 2 +- ports/pcre2/portfile.cmake | 6 ----- 4 files changed, 80 insertions(+), 14 deletions(-) diff --git a/ports/libgit2/CONTROL b/ports/libgit2/CONTROL index 1c16caf88..0077410d5 100644 --- a/ports/libgit2/CONTROL +++ b/ports/libgit2/CONTROL @@ -1,8 +1,10 @@ Source: libgit2 Version: 1.0.1 +Port-Version: 1 Homepage: https://github.com/libgit2/libgit2 -Build-Depends: zlib, openssl (!windows&&!uwp) +Build-Depends: zlib, http-parser Description: Git linkable library +Default-Features: pcre, ssl Supports: !uwp Feature: pcre @@ -12,3 +14,26 @@ Build-Depends: pcre Feature: pcre2 Description: Build against external libpcre2 Build-Depends: pcre2 + +Feature: ssh +Build-Depends: libgit2[core,openssl], libssh2 +Description: SSH support via libssh2 + +Feature: ssl +Build-Depends: libgit2[core,openssl] (!windows&!osx), libgit2[core,winhttp] (windows), libgit2[core,sectransp] (osx) +Description: Default SSL backend + +# SSL backends +Feature: openssl +Build-Depends: openssl +Description: SSL support (OpenSSL) + +Feature: winhttp +Description: SSL support (WinHTTP) + +Feature: sectransp +Description: SSL support (sectransp) + +Feature: mbedtls +Build-Depends: mbedtls +Description: SSL support (mbedTLS) diff --git a/ports/libgit2/portfile.cmake b/ports/libgit2/portfile.cmake index c24652548..f4fb91907 100644 --- a/ports/libgit2/portfile.cmake +++ b/ports/libgit2/portfile.cmake @@ -11,21 +11,68 @@ vcpkg_from_github( string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT) -if ("pcre" IN_LIST FEATURES) - set(REGEX_BACKEND pcre) -elseif ("pcre2" IN_LIST FEATURES) - set(REGEX_BACKEND pcre2) -else() - set(REGEX_BACKEND builtin) +set(REGEX_BACKEND OFF) +set(USE_HTTPS OFF) + +function(set_regex_backend VALUE) + if(REGEX_BACKEND) + message(FATAL_ERROR "Only one regex backend (pcre,pcre2) is allowed") + endif() + set(REGEX_BACKEND ${VALUE} PARENT_SCOPE) +endfunction() + +function(set_tls_backend VALUE) + if(USE_HTTPS) + message(FATAL_ERROR "Only one TLS backend (openssl,winhttp,sectransp,mbedtls) is allowed") + endif() + set(USE_HTTPS ${VALUE} PARENT_SCOPE) +endfunction() + +foreach(GIT2_FEATURE ${FEATURES}) + if(GIT2_FEATURE STREQUAL "pcre") + set_regex_backend("pcre") + elseif(GIT2_FEATURE STREQUAL "pcre2") + set_regex_backend("pcre2") + elseif(GIT2_FEATURE STREQUAL "openssl") + set_tls_backend("OpenSSL") + elseif(GIT2_FEATURE STREQUAL "winhttp") + if(NOT VCPKG_TARGET_IS_WINDOWS) + message(FATAL_ERROR "winhttp is not supported on non-Windows and uwp platforms") + endif() + set_tls_backend("WinHTTP") + elseif(GIT2_FEATURE STREQUAL "sectransp") + if(NOT VCPKG_TARGET_IS_OSX) + message(FATAL_ERROR "sectransp is not supported on non-Apple platforms") + endif() + set_tls_backend("SecureTransport") + elseif(GIT2_FEATURE STREQUAL "mbedtls") + if(VCPKG_TARGET_IS_WINDOWS) + message(FATAL_ERROR "mbedtls is not supported on Windows because a certificate file must be specified at compile time") + endif() + set_tls_backend("mbedTLS") + endif() +endforeach() + +if(NOT REGEX_BACKEND) + message(FATAL_ERROR "Must choose pcre or pcre2 regex backend") endif() +vcpkg_check_features( + OUT_FEATURE_OPTIONS GIT2_FEATURES + FEATURES + ssh USE_SSH +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DBUILD_CLAR=OFF + -DUSE_HTTP_PARSER=system + -DUSE_HTTPS=${USE_HTTPS} -DREGEX_BACKEND=${REGEX_BACKEND} -DSTATIC_CRT=${STATIC_CRT} + ${GIT2_FEATURES} ) vcpkg_install_cmake() diff --git a/ports/pcre2/CONTROL b/ports/pcre2/CONTROL index 75fd95488..ca6c84574 100644 --- a/ports/pcre2/CONTROL +++ b/ports/pcre2/CONTROL @@ -1,5 +1,5 @@ Source: pcre2 Version: 10.35 -Port-Version: 1 +Port-Version: 2 Homepage: https://pcre.org/ Description: PCRE2 is a re-working of the original Perl Compatible Regular Expressions library diff --git a/ports/pcre2/portfile.cmake b/ports/pcre2/portfile.cmake index 3395cccf0..e8ddb6a23 100644 --- a/ports/pcre2/portfile.cmake +++ b/ports/pcre2/portfile.cmake @@ -59,12 +59,6 @@ else() endif() file(WRITE ${CURRENT_PACKAGES_DIR}/include/pcre2.h "${PCRE2_H}") -# don't install POSIX wrapper -file(REMOVE ${CURRENT_PACKAGES_DIR}/include/pcre2posix.h) -file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/pcre2-posix.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pcre2-posixd.lib) -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/pcre2-posix.dll ${CURRENT_PACKAGES_DIR}/debug/bin/pcre2-posixd.dll) -file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcre2-posix.pc ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre2-posix.pc) - vcpkg_fixup_pkgconfig() vcpkg_copy_pdbs() -- cgit v1.2.3