Skip to content

Commit

Permalink
[libgit2] Update to 1.4.2 (#23184)
Browse files Browse the repository at this point in the history
* Update libgit2 to 1.4.2

* Update versions jsons

* Update ports/libgit2/vcpkg.json

Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com>

* update version

Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com>
Co-authored-by: Jonliu1993 <13720414433@163.com>
  • Loading branch information
3 people authored Mar 4, 2022
1 parent 89f1922 commit 59f1aea
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 38 deletions.
62 changes: 32 additions & 30 deletions ports/libgit2/fix-configcmake.patch
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fdb3673..da1f972 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,7 +125,6 @@ include(SelectHashes)
target_sources(git2internal PRIVATE ${SRC_SHA1})

diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake
index 2a3a91b8c..cbb409350 100644
--- a/cmake/SelectRegex.cmake
+++ b/cmake/SelectRegex.cmake
@@ -1,5 +1,4 @@
# Specify regular expression implementation
-FIND_PACKAGE(PCRE)
-find_package(PCRE)

IF(REGEX_BACKEND STREQUAL "")
CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
@@ -159,8 +158,8 @@ ELSEIF(REGEX_BACKEND STREQUAL "pcre")
ADD_FEATURE_INFO(regex ON "using system PCRE")
SET(GIT_REGEX_PCRE 1)
if(REGEX_BACKEND STREQUAL "")
check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
@@ -33,8 +32,8 @@ elseif(REGEX_BACKEND STREQUAL "pcre")
add_feature_info(regex ON "using system PCRE")
set(GIT_REGEX_PCRE 1)

- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${PCRE_LIBRARIES})
+ FIND_PACKAGE(unofficial-pcre CONFIG REQUIRED)
+ LIST(APPEND LIBGIT2_LIBS unofficial::pcre::pcre)
LIST(APPEND LIBGIT2_PC_REQUIRES "libpcre")
ELSEIF(REGEX_BACKEND STREQUAL "regcomp")
ADD_FEATURE_INFO(regex ON "using system regcomp")
@@ -424,10 +423,28 @@ IF (MSVC_IDE)
ENDIF ()
- list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
- list(APPEND LIBGIT2_SYSTEM_LIBS ${PCRE_LIBRARIES})
+ find_package(unofficial-pcre CONFIG REQUIRED)
+ list(APPEND LIBGIT2_SYSTEM_LIBS unofficial::pcre::pcre)
list(APPEND LIBGIT2_PC_REQUIRES "libpcre")
elseif(REGEX_BACKEND STREQUAL "regcomp")
add_feature_info(regex ON "using system regcomp")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e7b54d036..6b549deef 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -298,10 +298,28 @@ if(MSVC_IDE)
endif()

# Install
-INSTALL(TARGETS git2
+INSTALL(TARGETS git2 EXPORT unofficial-git2Targets
-install(TARGETS git2
+install(TARGETS git2 EXPORT unofficial-git2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -38,16 +40,16 @@ index fdb3673..da1f972 100644
+)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake.in"
+[[include(CMakeFindDependencyMacro)
+IF(@USE_BUNDLED_ZLIB@ STREQUAL "OFF")
+if(@USE_BUNDLED_ZLIB@ STREQUAL "OFF")
+ find_dependency(ZLIB)
+ENDIF()
+IF(@REGEX_BACKEND@ STREQUAL "pcre")
+endif()
+if(@REGEX_BACKEND@ STREQUAL "pcre")
+ find_dependency(unofficial-pcre CONFIG)
+ENDIF()
+endif()
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-git2Targets.cmake")
+]])
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake" @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake DESTINATION share/unofficial-git2)
+
INSTALL(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
INSTALL(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${PROJECT_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
8 changes: 4 additions & 4 deletions ports/libgit2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libgit2/libgit2
REF v1.3.0
SHA512 842a648a67ff23ba9e6bf14b706ba9081164866e14000ebf3858442b7046925f05e1dbf00a7d740dc4bf32280e260730e23a9492e817094aa90736ae335ee76e
HEAD_REF master
REF v1.4.2
SHA512 144bec7f8e66d97b20335d87d1eb68d522f5e59064b0c557505c088d3c486d45704f023d701f51de572efa8e2eb111e3136eb5d23c035e29d16698206b5ec277
HEAD_REF maint/v1.4
PATCHES
fix-configcmake.patch
)
Expand Down Expand Up @@ -67,7 +67,7 @@ vcpkg_check_features(
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_CLAR=OFF
-DBUILD_TESTS=OFF
-DUSE_HTTP_PARSER=system
-DUSE_HTTPS=${USE_HTTPS}
-DREGEX_BACKEND=${REGEX_BACKEND}
Expand Down
3 changes: 1 addition & 2 deletions ports/libgit2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "libgit2",
"version-semver": "1.3.0",
"port-version": 2,
"version-semver": "1.4.2",
"description": "Git linkable library",
"homepage": "https://github.com/libgit2/libgit2",
"supports": "!uwp",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3529,8 +3529,8 @@
"port-version": 0
},
"libgit2": {
"baseline": "1.3.0",
"port-version": 2
"baseline": "1.4.2",
"port-version": 0
},
"libgnutls": {
"baseline": "3.6.15",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libgit2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e036ca61d2e12b110c920cadf92f0aa4f39cac9b",
"version-semver": "1.4.2",
"port-version": 0
},
{
"git-tree": "37f2b6e92b60481a4db74de9da17385706d7d2e9",
"version-semver": "1.3.0",
Expand Down

0 comments on commit 59f1aea

Please sign in to comment.