From eceff0e4b134d404074059609ede6f6db6f88106 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 25 Nov 2021 18:37:11 -0800 Subject: [PATCH 1/4] [libgit2] Add Exported CMake Targets --- ports/libgit2/portfile.cmake | 6 +++++- ports/libgit2/vcpkg.json | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/libgit2/portfile.cmake b/ports/libgit2/portfile.cmake index 2949be645ba946..fd1822f879bb11 100644 --- a/ports/libgit2/portfile.cmake +++ b/ports/libgit2/portfile.cmake @@ -1,5 +1,4 @@ # libgit2 uses winapi functions not available in WindowsStore -vcpkg_fail_port_install(ON_TARGET "uwp") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -7,8 +6,12 @@ vcpkg_from_github( REF v1.3.0 SHA512 842a648a67ff23ba9e6bf14b706ba9081164866e14000ebf3858442b7046925f05e1dbf00a7d740dc4bf32280e260730e23a9492e817094aa90736ae335ee76e HEAD_REF master + PATCHES + fix-configcmake.patch ) +file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindPCRE.cmake") + string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT) set(REGEX_BACKEND OFF) @@ -75,6 +78,7 @@ vcpkg_cmake_configure( ) vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-git2 CONFIG_PATH share/unofficial-git2) vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/libgit2/vcpkg.json b/ports/libgit2/vcpkg.json index cc19ad4bc17e4b..7ecca211e2fa78 100644 --- a/ports/libgit2/vcpkg.json +++ b/ports/libgit2/vcpkg.json @@ -1,7 +1,7 @@ { "name": "libgit2", "version-semver": "1.3.0", - "port-version": 1, + "port-version": 2, "description": "Git linkable library", "homepage": "https://github.com/libgit2/libgit2", "supports": "!uwp", @@ -11,6 +11,10 @@ "name": "vcpkg-cmake", "host": true }, + { + "name": "vcpkg-cmake-config", + "host": true + }, "zlib" ], "default-features": [ From 6aa3701dbae158bc05b911684b225cd0eb89c093 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 25 Nov 2021 18:41:05 -0800 Subject: [PATCH 2/4] update version --- ports/libgit2/fix-configcmake.patch | 53 +++++++++++++++++++++++++++++ versions/baseline.json | 2 +- versions/l-/libgit2.json | 5 +++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 ports/libgit2/fix-configcmake.patch diff --git a/ports/libgit2/fix-configcmake.patch b/ports/libgit2/fix-configcmake.patch new file mode 100644 index 00000000000000..3f860a656e0bc7 --- /dev/null +++ b/ports/libgit2/fix-configcmake.patch @@ -0,0 +1,53 @@ +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}) + + # Specify regular expression implementation +-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) + +- 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 () + + # Install +-INSTALL(TARGETS git2 ++INSTALL(TARGETS git2 EXPORT unofficial-git2Targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) ++ ++install(EXPORT unofficial-git2Targets ++ NAMESPACE unofficial::git2:: ++ DESTINATION share/unofficial-git2 ++) ++file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake.in" ++[[include(CMakeFindDependencyMacro) ++IF(@USE_BUNDLED_ZLIB@ STREQUAL "OFF") ++ find_dependency(ZLIB) ++ENDIF() ++IF(@REGEX_BACKEND@ STREQUAL "pcre") ++ find_dependency(unofficial-pcre CONFIG) ++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}) diff --git a/versions/baseline.json b/versions/baseline.json index 9484ca6a8232a5..b4826585903228 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3474,7 +3474,7 @@ }, "libgit2": { "baseline": "1.3.0", - "port-version": 1 + "port-version": 2 }, "libgnutls": { "baseline": "3.6.15", diff --git a/versions/l-/libgit2.json b/versions/l-/libgit2.json index a7276f58631281..76203ba8514788 100644 --- a/versions/l-/libgit2.json +++ b/versions/l-/libgit2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "218bdc4178691017528f101ef4f21add29af0dd1", + "version-semver": "1.3.0", + "port-version": 2 + }, { "git-tree": "608c02285dbac754d7b2a34e67f081879cdee38f", "version-semver": "1.3.0", From 4f10366be4a020c7f02169a6d0088a48856c7781 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 25 Nov 2021 22:53:49 -0800 Subject: [PATCH 3/4] update version --- versions/l-/libgit2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libgit2.json b/versions/l-/libgit2.json index 76203ba8514788..569efb274cadff 100644 --- a/versions/l-/libgit2.json +++ b/versions/l-/libgit2.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "218bdc4178691017528f101ef4f21add29af0dd1", + "git-tree": "db898a66ff6c854875a9df8fc7609e59952ad505", "version-semver": "1.3.0", "port-version": 2 }, From 3c74e57312484c6c0e16818ad4928c597d208061 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 26 Nov 2021 01:22:24 -0800 Subject: [PATCH 4/4] Remove no longer applicable comment. --- ports/libgit2/portfile.cmake | 2 -- versions/l-/libgit2.json | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ports/libgit2/portfile.cmake b/ports/libgit2/portfile.cmake index fd1822f879bb11..1f3a9a0d757085 100644 --- a/ports/libgit2/portfile.cmake +++ b/ports/libgit2/portfile.cmake @@ -1,5 +1,3 @@ -# libgit2 uses winapi functions not available in WindowsStore - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libgit2/libgit2 diff --git a/versions/l-/libgit2.json b/versions/l-/libgit2.json index 569efb274cadff..6eeb5426acfe3b 100644 --- a/versions/l-/libgit2.json +++ b/versions/l-/libgit2.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "db898a66ff6c854875a9df8fc7609e59952ad505", + "git-tree": "37f2b6e92b60481a4db74de9da17385706d7d2e9", "version-semver": "1.3.0", "port-version": 2 },