mirror of https://github.com/microsoft/vcpkg.git
[libssh] Update, fix, cleanup (#39734)
This commit is contained in:
parent
39ed9f9955
commit
2bc6ff38d1
|
|
@ -1,38 +1,47 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 741dc61..42f0e8f 100644
|
||||
index a64b770..716bb34 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -124,8 +124,28 @@ add_subdirectory(include)
|
||||
@@ -43,8 +43,12 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
|
||||
# search for libraries
|
||||
+set(PC_LIBS_PRIVATE "")
|
||||
+set(PC_REQUIRES_PRIVATE "")
|
||||
+
|
||||
if (WITH_ZLIB)
|
||||
find_package(ZLIB REQUIRED)
|
||||
+ string(APPEND PC_REQUIRES_PRIVATE "zlib")
|
||||
endif (WITH_ZLIB)
|
||||
|
||||
if (WITH_GCRYPT)
|
||||
@@ -60,6 +64,7 @@ elseif(WITH_MBEDTLS)
|
||||
else (WITH_GCRYPT)
|
||||
find_package(OpenSSL 1.0.1)
|
||||
if (OPENSSL_FOUND)
|
||||
+ string(APPEND PC_REQUIRES_PRIVATE " libcrypto")
|
||||
# On CMake < 3.16, OPENSSL_CRYPTO_LIBRARIES is usually a synonym for OPENSSL_CRYPTO_LIBRARY, but is not defined
|
||||
# when building on Windows outside of Cygwin. We provide the synonym here, if FindOpenSSL didn't define it already.
|
||||
if (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES)
|
||||
@@ -84,6 +89,9 @@ endif ()
|
||||
set(CMAKE_THREAD_PREFER_PTHREADS ON)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
+if(Threads_FOUND)
|
||||
+ string(APPEND PC_LIBS_PRIVATE " ${CMAKE_THREAD_LIBS_INIT}")
|
||||
+endif()
|
||||
|
||||
if (WITH_GSSAPI)
|
||||
find_package(GSSAPI)
|
||||
@@ -122,7 +130,6 @@ add_subdirectory(include)
|
||||
add_subdirectory(src)
|
||||
|
||||
# pkg-config file
|
||||
-if (UNIX OR MINGW)
|
||||
configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc @ONLY)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc "Requires:")
|
||||
+ if (WITH_ZLIB)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc " zlib")
|
||||
+ endif ()
|
||||
+ if (WITH_GCRYPT)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc "\nLibs.private: -lgcrypt")
|
||||
+ elseif (WITH_MBEDTLS)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc "\nLibs.private: -lmbedcrypto -lpthread")
|
||||
+ else ()
|
||||
+ if (WIN32)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc "\nLibs.private: -llibcrypto -luser32 -lcrypt32")
|
||||
+ else ()
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc " libcrypto\nLibs.private:")
|
||||
+ endif ()
|
||||
+ endif ()
|
||||
+ if (CMAKE_USE_PTHREADS_INIT)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc " -lpthread")
|
||||
+ endif ()
|
||||
+ if (WIN32)
|
||||
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc " -lws2_32 -lshell32 -ladvapi32")
|
||||
+ endif ()
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
|
||||
@@ -134,7 +154,6 @@ install(
|
||||
@@ -132,7 +139,6 @@ install(
|
||||
COMPONENT
|
||||
pkgconfig
|
||||
)
|
||||
|
|
@ -40,3 +49,27 @@ index 741dc61..42f0e8f 100644
|
|||
|
||||
# CMake config files
|
||||
include(CMakePackageConfigHelpers)
|
||||
diff --git a/libssh.pc.cmake b/libssh.pc.cmake
|
||||
index f288b94..759525c 100644
|
||||
--- a/libssh.pc.cmake
|
||||
+++ b/libssh.pc.cmake
|
||||
@@ -7,4 +7,6 @@ Name: @PROJECT_NAME@
|
||||
Description: The SSH Library
|
||||
Version: @PROJECT_VERSION@
|
||||
Libs: -L${libdir} -lssh
|
||||
+Libs.private: @PC_LIBS_PRIVATE@
|
||||
+Requires.private: @PC_REQUIRES_PRIVATE@
|
||||
Cflags: -I${includedir}
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 807313b..72ef059 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -94,6 +94,8 @@ if (WIN32)
|
||||
iphlpapi
|
||||
ws2_32
|
||||
)
|
||||
+ string(APPEND PC_LIBS_PRIVATE " -liphlpapi -lws2_32 -lshell32 -ladvapi32")
|
||||
+ set(PC_LIBS_PRIVATE "${PC_LIBS_PRIVATE}" PARENT_SCOPE)
|
||||
endif (WIN32)
|
||||
|
||||
if (BUILD_STATIC_LIB)
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index a576cf7..1f6a048 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -359,7 +359,7 @@ if (WITH_VISIBILITY_HIDDEN)
|
||||
set_target_properties(ssh PROPERTIES C_VISIBILITY_PRESET hidden)
|
||||
endif (WITH_VISIBILITY_HIDDEN)
|
||||
|
||||
-if (MINGW)
|
||||
+if (MINGW AND NOT ANDROID)
|
||||
target_link_libraries(ssh PRIVATE "-Wl,--enable-stdcall-fixup")
|
||||
target_compile_definitions(ssh PRIVATE "_POSIX_SOURCE")
|
||||
endif ()
|
||||
|
|
@ -1,17 +1,14 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 53e6bd5..51d76c5 100644
|
||||
index d066cde..d2a11cb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -231,10 +231,11 @@ endif (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
|
||||
@@ -224,9 +224,6 @@ endif (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
|
||||
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source DEPENDS ${_SYMBOL_TARGET} VERBATIM)
|
||||
|
||||
# Link compile database for clangd
|
||||
+if(UNIX)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
"${CMAKE_BINARY_DIR}/compile_commands.json"
|
||||
"${CMAKE_SOURCE_DIR}/compile_commands.json")
|
||||
-
|
||||
+endif()
|
||||
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
- "${CMAKE_BINARY_DIR}/compile_commands.json"
|
||||
- "${CMAKE_SOURCE_DIR}/compile_commands.json")
|
||||
|
||||
message(STATUS "********************************************")
|
||||
message(STATUS "********** ${PROJECT_NAME} build options : **********")
|
||||
|
||||
|
|
@ -1,73 +1,55 @@
|
|||
vcpkg_download_distfile(distfile
|
||||
URLS https://www.libssh.org/files/0.10/libssh-${VERSION}.tar.xz
|
||||
FILENAME libssh-${VERSION}.tar.xz
|
||||
SHA512 2b758f9df2b5937865d4aee775ffeafafe3ae6739a89dfc470e38c7394e3c3cb5fcf8f842fdae04929890ee7e47bf8f50e3a38e82dfd26a009f3aae009d589e0
|
||||
SHA512 40c62d63c44e882999b71552c237d73fc7364313bd00b15a211a34aeff1b73693da441d2c8d4e40108d00fb7480ec7c5b6d472f9c0784b2359a179632ab0d6c1
|
||||
)
|
||||
vcpkg_extract_source_archive(SOURCE_PATH
|
||||
ARCHIVE "${distfile}"
|
||||
PATCHES
|
||||
0001-export-pkgconfig-file.patch
|
||||
0002-mingw_for_Android.patch
|
||||
0003-create_symlink_unix_only.patch
|
||||
0003-no-source-write.patch
|
||||
0004-file-permissions-constants.patch
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
pcap WITH_PCAP
|
||||
server WITH_SERVER
|
||||
zlib WITH_ZLIB
|
||||
)
|
||||
|
||||
if (VCPKG_TARGET_IS_ANDROID)
|
||||
set(EXTRA_ARGS "-DWITH_SERVER=FALSE"
|
||||
"-DWITH_PCAP=FALSE")
|
||||
endif ()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${EXTRA_ARGS}
|
||||
${FEATURE_OPTIONS}
|
||||
-DCMAKE_REQUIRE_FIND_PACKAGE_OpenSSL=ON
|
||||
-DWITH_EXAMPLES=OFF
|
||||
-DUNIT_TESTING=OFF
|
||||
-DCLIENT_TESTING=OFF
|
||||
-DSERVER_TESTING=OFF
|
||||
-DWITH_NACL=OFF
|
||||
-DWITH_GSSAPI=OFF
|
||||
-DWITH_SYMBOL_VERSIONING=OFF)
|
||||
-DWITH_NACL=OFF
|
||||
-DWITH_SYMBOL_VERSIONING=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
#Fixup pthread naming
|
||||
if(NOT VCPKG_TARGET_IS_MINGW AND VCPKG_TARGET_IS_WINDOWS)
|
||||
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libssh.pc" "-lpthread" "-lpthreadVC3d" IGNORE_UNCHANGED)
|
||||
endif()
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libssh.pc" "-lpthread" "-lpthreadVC3" IGNORE_UNCHANGED)
|
||||
endif()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
vcpkg_replace_string(
|
||||
"${CURRENT_PACKAGES_DIR}/include/libssh/libssh.h"
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libssh/libssh.h"
|
||||
"#ifdef LIBSSH_STATIC"
|
||||
"#if 1"
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libssh)
|
||||
|
||||
file(READ "${CURRENT_PACKAGES_DIR}/share/libssh/libssh-config.cmake" cmake_config)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
string(REPLACE ".dll" ".lib" cmake_config "${cmake_config}")
|
||||
endif()
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/libssh/libssh-config.cmake"
|
||||
"include(CMakeFindDependencyMacro)
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/libssh/libssh-config.cmake" "
|
||||
include(CMakeFindDependencyMacro)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_dependency(Threads)
|
||||
${cmake_config}
|
||||
")
|
||||
${cmake_config}"
|
||||
)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
libssh provides CMake targets:
|
||||
|
||||
find_package(libssh CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE ssh)
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "libssh",
|
||||
"version": "0.10.5",
|
||||
"port-version": 2,
|
||||
"version": "0.10.6",
|
||||
"description": "libssh is a multiplatform C library implementing the SSHv2 protocol on client and server side",
|
||||
"homepage": "https://www.libssh.org/",
|
||||
"license": "LGPL-2.1-only",
|
||||
|
|
@ -20,9 +19,25 @@
|
|||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
{
|
||||
"name": "pcap",
|
||||
"platform": "!android"
|
||||
},
|
||||
{
|
||||
"name": "server",
|
||||
"platform": "!android"
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"pcap": {
|
||||
"description": "SSH server support"
|
||||
},
|
||||
"server": {
|
||||
"description": "Pcap generation support"
|
||||
},
|
||||
"zlib": {
|
||||
"description": "libssh with zlib",
|
||||
"description": "zlib compression support",
|
||||
"dependencies": [
|
||||
"zlib"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5049,8 +5049,8 @@
|
|||
"port-version": 1
|
||||
},
|
||||
"libssh": {
|
||||
"baseline": "0.10.5",
|
||||
"port-version": 2
|
||||
"baseline": "0.10.6",
|
||||
"port-version": 0
|
||||
},
|
||||
"libssh2": {
|
||||
"baseline": "1.11.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "0e899f7f2836ea17c95413604158205e5afb8378",
|
||||
"version": "0.10.6",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "ceea3a79b4ab71a4cb342b33b1c9f95137b87a1b",
|
||||
"version": "0.10.5",
|
||||
|
|
|
|||
Loading…
Reference in New Issue