From b9f003fb4930899b76710e58ae254c07377ce439 Mon Sep 17 00:00:00 2001 From: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:53:49 +0800 Subject: [redis-plus-plus] Update to 1.2.1 and support Windows (#14180) * [redis-plus-plus] Update to 1.2.1 and support Windows * [redis-plus-plus] Update to 1.2.1 and support Windows * [redis-plus-plus] Update to 1.2.1 and support Windows --- ports/redis-plus-plus/CONTROL | 2 +- ports/redis-plus-plus/fix-conversion.patch | 13 +++++++++++++ ports/redis-plus-plus/fix-ws2-linking-windows.patch | 12 ++++++++++++ ports/redis-plus-plus/portfile.cmake | 21 ++++++++++++++++----- 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 ports/redis-plus-plus/fix-conversion.patch create mode 100644 ports/redis-plus-plus/fix-ws2-linking-windows.patch diff --git a/ports/redis-plus-plus/CONTROL b/ports/redis-plus-plus/CONTROL index 77a355f40..d3b824f60 100644 --- a/ports/redis-plus-plus/CONTROL +++ b/ports/redis-plus-plus/CONTROL @@ -1,5 +1,5 @@ Source: redis-plus-plus -Version: 1.1.2 +Version: 1.2.1 Homepage: https://github.com/sewenew/redis-plus-plus Description: This is a C++ client for Redis. It's based on hiredis, and written in C++ 11. Build-Depends: hiredis \ No newline at end of file diff --git a/ports/redis-plus-plus/fix-conversion.patch b/ports/redis-plus-plus/fix-conversion.patch new file mode 100644 index 000000000..cc11d247a --- /dev/null +++ b/ports/redis-plus-plus/fix-conversion.patch @@ -0,0 +1,13 @@ +diff --git a/src/sw/redis++/shards.cpp b/src/sw/redis++/shards.cpp +index e06d2a7..273d039 100644 +--- a/src/sw/redis++/shards.cpp ++++ b/src/sw/redis++/shards.cpp +@@ -39,7 +39,7 @@ std::pair RedirectionError::_parse_error(const std::string &msg) con + auto host = msg.substr(space_pos + 1, colon_pos - space_pos - 1); + auto port = std::stoi(msg.substr(colon_pos + 1)); + +- return {slot, {host, port}}; ++ return {static_cast(slot), {host, port}}; + } catch (const std::exception &e) { + throw ProtoError("Invalid ASK error message: " + msg); + } diff --git a/ports/redis-plus-plus/fix-ws2-linking-windows.patch b/ports/redis-plus-plus/fix-ws2-linking-windows.patch new file mode 100644 index 000000000..da3e119c4 --- /dev/null +++ b/ports/redis-plus-plus/fix-ws2-linking-windows.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index eb3ff66..1309213 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -77,6 +77,7 @@ if (REDIS_PLUS_PLUS_BUILD_SHARED) + target_compile_definitions(${SHARED_LIB} PRIVATE NOMINMAX) + set_target_properties(${SHARED_LIB} PROPERTIES CXX_STANDARD ${REDIS_PLUS_PLUS_CXX_STANDARD} CXX_EXTENSIONS OFF) + set_target_properties(${SHARED_LIB} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++ target_link_libraries(${SHARED_LIB} Ws2_32.lib) + endif() + + target_link_libraries(${SHARED_LIB} ${HIREDIS_LIB}) diff --git a/ports/redis-plus-plus/portfile.cmake b/ports/redis-plus-plus/portfile.cmake index 5878671e4..fae747289 100644 --- a/ports/redis-plus-plus/portfile.cmake +++ b/ports/redis-plus-plus/portfile.cmake @@ -1,18 +1,29 @@ -#Blocked by ninja: error: build.ninja:348: multiple rules generate lib/redis++.lib [-w dupbuild=err] -vcpkg_fail_port_install(ON_TARGET "Windows") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO sewenew/redis-plus-plus - REF b08b36a9a91de00636e583307610f49af7876f50 # 1.1.2 - SHA512 6dcead9fca9e7082ace28dcd72a1b325e229297080eea3e5a28ef5e6b9e4a7d1bcb3568997a5e7a031d7937a025a017ed92d7869db5829ba6113783c84bc5a68 + REF a9f9c301f8de1c181e6d45c573b5d1fe7b8200b1 # 1.2.1 + SHA512 038641a91a2d62f8b07b548fb16f03e87a014fc3a53e59d95e9d31d707e800de4922838bc1bc181d642bb6ac23eae877e0a8724548d9d8f113ebc8d744384abf HEAD_REF master + PATCHES + fix-ws2-linking-windows.patch + fix-conversion.patch ) +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(REDIS_PLUS_PLUS_BUILD_STATIC ON) + set(REDIS_PLUS_PLUS_BUILD_SHARED OFF) +else() + set(REDIS_PLUS_PLUS_BUILD_STATIC OFF) + set(REDIS_PLUS_PLUS_BUILD_SHARED ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS + -DREDIS_PLUS_PLUS_USE_TLS=OFF + -DREDIS_PLUS_PLUS_BUILD_STATIC=${REDIS_PLUS_PLUS_BUILD_STATIC} + -DREDIS_PLUS_PLUS_BUILD_SHARED=${REDIS_PLUS_PLUS_BUILD_SHARED} -DREDIS_PLUS_PLUS_BUILD_TEST=OFF ) -- cgit v1.2.3