2017-12-24 00:14:20 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO libgit2/libgit2
|
2021-11-05 01:39:06 +08:00
|
|
|
REF v1.3.0
|
|
|
|
SHA512 842a648a67ff23ba9e6bf14b706ba9081164866e14000ebf3858442b7046925f05e1dbf00a7d740dc4bf32280e260730e23a9492e817094aa90736ae335ee76e
|
2018-10-09 15:27:45 +08:00
|
|
|
HEAD_REF master
|
2021-11-28 15:32:06 +08:00
|
|
|
PATCHES
|
|
|
|
fix-configcmake.patch
|
2018-10-09 15:27:45 +08:00
|
|
|
)
|
|
|
|
|
2021-11-28 15:32:06 +08:00
|
|
|
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindPCRE.cmake")
|
|
|
|
|
2018-10-09 15:27:45 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)
|
2017-12-24 00:14:20 +08:00
|
|
|
|
2020-10-21 03:23:12 +08:00
|
|
|
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")
|
2020-03-12 00:16:42 +08:00
|
|
|
endif()
|
|
|
|
|
2020-10-21 03:23:12 +08:00
|
|
|
vcpkg_check_features(
|
|
|
|
OUT_FEATURE_OPTIONS GIT2_FEATURES
|
|
|
|
FEATURES
|
|
|
|
ssh USE_SSH
|
|
|
|
)
|
|
|
|
|
2021-09-08 22:55:21 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2018-08-08 13:47:52 +08:00
|
|
|
OPTIONS
|
2017-12-24 00:14:20 +08:00
|
|
|
-DBUILD_CLAR=OFF
|
2020-10-21 03:23:12 +08:00
|
|
|
-DUSE_HTTP_PARSER=system
|
|
|
|
-DUSE_HTTPS=${USE_HTTPS}
|
2020-03-12 00:16:42 +08:00
|
|
|
-DREGEX_BACKEND=${REGEX_BACKEND}
|
2018-10-09 15:27:45 +08:00
|
|
|
-DSTATIC_CRT=${STATIC_CRT}
|
2020-10-21 03:23:12 +08:00
|
|
|
${GIT2_FEATURES}
|
2017-12-24 00:14:20 +08:00
|
|
|
)
|
|
|
|
|
2021-09-08 22:55:21 +08:00
|
|
|
vcpkg_cmake_install()
|
2021-11-28 15:32:06 +08:00
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-git2 CONFIG_PATH share/unofficial-git2)
|
2021-11-05 01:39:06 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2017-12-24 00:14:20 +08:00
|
|
|
|
2021-09-08 22:55:21 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
2017-12-24 00:14:20 +08:00
|
|
|
|
2021-09-08 22:55:21 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|