Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libgit2] Fix feature ssh build error #32435

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions ports/libgit2/fix-findssh.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/cmake/SelectSSH.cmake b/cmake/SelectSSH.cmake
index 23dfc97..df1aa2e 100644
--- a/cmake/SelectSSH.cmake
+++ b/cmake/SelectSSH.cmake
@@ -1,20 +1,21 @@
# Optional external dependency: libssh2
if(USE_SSH)
- find_pkglibraries(LIBSSH2 libssh2)
- if(NOT LIBSSH2_FOUND)
- find_package(LibSSH2)
- set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR})
- get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY)
- set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY})
+ if(1)
+ find_package(Libssh2 CONFIG REQUIRED)
+ if(BUILD_SHARED_LIBS)
+ set(LIBSSH2_LIBRARIES Libssh2::libssh2_shared)
+ else()
+ set(LIBSSH2_LIBRARIES Libssh2::libssh2_static)
+ endif()
set(LIBSSH2_LDFLAGS "-lssh2")
endif()

- if(NOT LIBSSH2_FOUND)
+ if(0)
message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
endif()
endif()

-if(LIBSSH2_FOUND)
+if(USE_SSH)
set(GIT_SSH 1)
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES})
diff --git a/src/libgit2/CMakeLists.txt b/src/libgit2/CMakeLists.txt
index 9ed2cae..04d3c50 100644
--- a/src/libgit2/CMakeLists.txt
+++ b/src/libgit2/CMakeLists.txt
@@ -145,6 +145,9 @@ endif()
if(@REGEX_BACKEND@ STREQUAL "pcre")
find_dependency(unofficial-pcre CONFIG)
endif()
+if(@USE_SSH@ STREQUAL "ON")
+ find_dependency(Libssh2 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)
3 changes: 2 additions & 1 deletion ports/libgit2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF maint/v1.6
PATCHES
fix-configcmake.patch
fix-findssh.patch
)

file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindPCRE.cmake")
Expand Down Expand Up @@ -78,4 +79,4 @@ vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
1 change: 1 addition & 0 deletions ports/libgit2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "libgit2",
"version-semver": "1.6.4",
"port-version": 1,
"description": "Git linkable library",
"homepage": "https://github.com/libgit2/libgit2",
"supports": "!uwp",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4102,7 +4102,7 @@
},
"libgit2": {
"baseline": "1.6.4",
"port-version": 0
"port-version": 1
},
"libgme": {
"baseline": "0.6.3",
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": "ad5ccc71a057ffc3ea3d0ee4d3d648356e90c245",
"version-semver": "1.6.4",
"port-version": 1
},
{
"git-tree": "e400f294d284f6a7ff3a19b2454c919873405f08",
"version-semver": "1.6.4",
Expand Down