aboutsummaryrefslogtreecommitdiff
path: root/ports/libgit2
diff options
context:
space:
mode:
authorKevin Lu <6320810+kevinlul@users.noreply.github.com>2020-10-20 15:23:12 -0400
committerGitHub <noreply@github.com>2020-10-20 12:23:12 -0700
commita4eca5fabc1743e309e75736c6d8a2420f48193d (patch)
tree6de202a69379198b863b277b082a92156ff97b69 /ports/libgit2
parent13af628b03dbb5679d00ae81f6f36c3da6aeb743 (diff)
downloadvcpkg-a4eca5fabc1743e309e75736c6d8a2420f48193d.tar.gz
vcpkg-a4eca5fabc1743e309e75736c6d8a2420f48193d.zip
[libgit2] Devendor bundled dependencies and allow choosing SSL backend (#13074)
Diffstat (limited to 'ports/libgit2')
-rw-r--r--ports/libgit2/CONTROL27
-rw-r--r--ports/libgit2/portfile.cmake59
2 files changed, 79 insertions, 7 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()