From ca79ebe4a49e5b860066dcfc4fac5187712ec457 Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Wed, 19 Oct 2022 03:38:59 +0200 Subject: [PATCH] [clickhouse-cpp] Update to 2.2.1 (#27250) * [clickhouse-cpp] Update to 2.2.1 * add feature openssl * Fix patch * use absl::int128 * Fix patch * version * fix UWP * version --- .../fix-deps-and-build-type.patch | 88 +++++++++++++++++++ ports/clickhouse-cpp/fix-error-C4996.patch | 15 ---- ports/clickhouse-cpp/fix-error-c2668.patch | 13 --- ports/clickhouse-cpp/fix-uwp.patch | 13 +++ ports/clickhouse-cpp/portfile.cmake | 24 +++-- ports/clickhouse-cpp/vcpkg.json | 18 ++-- versions/baseline.json | 2 +- versions/c-/clickhouse-cpp.json | 5 ++ 8 files changed, 135 insertions(+), 43 deletions(-) create mode 100644 ports/clickhouse-cpp/fix-deps-and-build-type.patch delete mode 100644 ports/clickhouse-cpp/fix-error-C4996.patch delete mode 100644 ports/clickhouse-cpp/fix-error-c2668.patch create mode 100644 ports/clickhouse-cpp/fix-uwp.patch diff --git a/ports/clickhouse-cpp/fix-deps-and-build-type.patch b/ports/clickhouse-cpp/fix-deps-and-build-type.patch new file mode 100644 index 00000000000000..25717855aa05d9 --- /dev/null +++ b/ports/clickhouse-cpp/fix-deps-and-build-type.patch @@ -0,0 +1,88 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 31cd8a5..d8ee404 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -29,11 +29,12 @@ PROJECT (CLICKHOUSE-CLIENT) + INCLUDE_DIRECTORIES (.) + INCLUDE_DIRECTORIES (contrib) + ++ find_package(absl CONFIG REQUIRED) ++ find_package(cityhash CONFIG REQUIRED) ++ find_package(lz4 CONFIG REQUIRED) ++ + SUBDIRS ( + clickhouse +- contrib/absl +- contrib/cityhash +- contrib/lz4 + ) + + IF (BUILD_BENCHMARK) +diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt +index d96ff88..ad1cb0d 100644 +--- a/clickhouse/CMakeLists.txt ++++ b/clickhouse/CMakeLists.txt +@@ -36,19 +36,21 @@ IF (WITH_OPENSSL) + LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp) + ENDIF () + +-ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src}) +-SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX) +-TARGET_LINK_LIBRARIES (clickhouse-cpp-lib +- absl-lib +- cityhash-lib +- lz4-lib +-) +- +-ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src}) +-TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static +- absl-lib +- cityhash-lib +- lz4-lib ++set(LIB_NAME "") ++ ++if(BUILD_SHARED_LIBS) ++ ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src}) ++ SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX) ++ set(LIB_NAME "clickhouse-cpp-lib") ++else() ++ ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src}) ++ set(LIB_NAME "clickhouse-cpp-lib-static") ++endif() ++ ++TARGET_LINK_LIBRARIES ("${LIB_NAME}" ++ absl::base absl::numeric ++ cityhash ++ lz4::lz4 + ) + + IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +@@ -68,12 +70,11 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0' + # /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line + # FIXME: that workaround breaks clang build on mingw +- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s) +- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s) ++ TARGET_LINK_LIBRARIES (${LIB_NAME} gcc_s) + ENDIF () + ENDIF () + +-INSTALL (TARGETS clickhouse-cpp-lib clickhouse-cpp-lib-static ++INSTALL (TARGETS ${LIB_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + ) +@@ -123,11 +124,9 @@ INSTALL(FILES types/type_parser.h DESTINATION include/clickhouse/types/) + INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/) + + IF (WITH_OPENSSL) +- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL) +- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static OpenSSL::SSL) ++ TARGET_LINK_LIBRARIES (${LIB_NAME} OpenSSL::SSL) + ENDIF () + + IF (WIN32 OR MINGW) +- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib wsock32 ws2_32) +- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static wsock32 ws2_32) ++ TARGET_LINK_LIBRARIES (${LIB_NAME} wsock32 ws2_32) + ENDIF () diff --git a/ports/clickhouse-cpp/fix-error-C4996.patch b/ports/clickhouse-cpp/fix-error-C4996.patch deleted file mode 100644 index 8da054b57f4994..00000000000000 --- a/ports/clickhouse-cpp/fix-error-C4996.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt -index 7e10ffd..cbbffdc 100644 ---- a/clickhouse/CMakeLists.txt -+++ b/clickhouse/CMakeLists.txt -@@ -31,6 +31,10 @@ SET ( clickhouse-cpp-lib-src - query.cpp - ) - -+if (MSVC) -+ add_compile_options(/wd4996) -+endif() -+ - ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src}) - SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX) - TARGET_LINK_LIBRARIES (clickhouse-cpp-lib diff --git a/ports/clickhouse-cpp/fix-error-c2668.patch b/ports/clickhouse-cpp/fix-error-c2668.patch deleted file mode 100644 index 4ad1df95364850..00000000000000 --- a/ports/clickhouse-cpp/fix-error-c2668.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/clickhouse/columns/decimal.cpp b/clickhouse/columns/decimal.cpp -index 7334bb1..41d43b6 100644 ---- a/clickhouse/columns/decimal.cpp -+++ b/clickhouse/columns/decimal.cpp -@@ -27,7 +27,7 @@ inline bool mulOverflow(const Int128 & l, const T & r, Int128 * result) - - #else - template --inline bool getSignBit(const T & v) -+inline bool getSignBit(const T & (long double v)) - { - return std::signbit(v); - } diff --git a/ports/clickhouse-cpp/fix-uwp.patch b/ports/clickhouse-cpp/fix-uwp.patch new file mode 100644 index 00000000000000..9de582c50ee130 --- /dev/null +++ b/ports/clickhouse-cpp/fix-uwp.patch @@ -0,0 +1,13 @@ +diff --git a/clickhouse/base/socket.cpp b/clickhouse/base/socket.cpp +index c6dc920..43bbd02 100644 +--- a/clickhouse/base/socket.cpp ++++ b/clickhouse/base/socket.cpp +@@ -27,7 +27,7 @@ char const* windowsErrorCategory::name() const noexcept { + + std::string windowsErrorCategory::message(int c) const { + char error[UINT8_MAX]; +- auto len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast(c), 0, error, sizeof(error), nullptr); ++ auto len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast(c), 0, error, sizeof(error), nullptr); + if (len == 0) { + return "unknown"; + } diff --git a/ports/clickhouse-cpp/portfile.cmake b/ports/clickhouse-cpp/portfile.cmake index 5837fb88f9d546..4bee29618e63ce 100644 --- a/ports/clickhouse-cpp/portfile.cmake +++ b/ports/clickhouse-cpp/portfile.cmake @@ -1,18 +1,26 @@ -vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ClickHouse/clickhouse-cpp - REF 1415b5936a2ac2f084850b09057e05fb5798b2f1 #v1.5.0 - SHA512 222b31b16744af64f0a874ec956568adcecb553e43f8d4a2d16c00d55b31015d917a4dc7bb30d5430a894459b1be5e05b292e2d0918bf6f5609046a60539f80f + REF v2.2.1 + SHA512 cf9f14e6bdbf2b739a25004c8f30ef8057cf4afa618c91fc2672059869cbbbdafb72f3027863b3f731f7f2cc239d5690e5e87301bf7930b79fe71d7a4ae3f833 HEAD_REF master - PATCHES - fix-error-c2668.patch - fix-error-C4996.patch #fix x64-uwp error:std::uncaught_exception() is deprecated in C++17 + PATCHES + fix-deps-and-build-type.patch + fix-uwp.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + openssl WITH_OPENSSL ) vcpkg_cmake_configure( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} ) vcpkg_cmake_install() @@ -21,4 +29,4 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") -configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/clickhouse-cpp/vcpkg.json b/ports/clickhouse-cpp/vcpkg.json index e3a5b37f190989..0664536ae0a10f 100644 --- a/ports/clickhouse-cpp/vcpkg.json +++ b/ports/clickhouse-cpp/vcpkg.json @@ -1,18 +1,24 @@ { "name": "clickhouse-cpp", - "version": "1.5.0", + "version": "2.2.1", "description": "C++ client for Yandex ClickHouse", "homepage": "https://github.com/ClickHouse/clickhouse-cpp", + "license": "Apache-2.0", "dependencies": [ + "abseil", "cityhash", "lz4", { "name": "vcpkg-cmake", "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true } - ] + ], + "features": { + "openssl": { + "description": "Enable OpenSSL support", + "dependencies": [ + "openssl" + ] + } + } } diff --git a/versions/baseline.json b/versions/baseline.json index 5168bcdc27ccf3..2213cece4ccc26 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1461,7 +1461,7 @@ "port-version": 0 }, "clickhouse-cpp": { - "baseline": "1.5.0", + "baseline": "2.2.1", "port-version": 0 }, "clipboardxx": { diff --git a/versions/c-/clickhouse-cpp.json b/versions/c-/clickhouse-cpp.json index 12cd74ccb40cd0..2e1b3e08c80cfb 100644 --- a/versions/c-/clickhouse-cpp.json +++ b/versions/c-/clickhouse-cpp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "10588d8080311cbc920f1805d3dd51e5b9c27ebe", + "version": "2.2.1", + "port-version": 0 + }, { "git-tree": "14c4074d1a59fbe8b01ebe934698519c63885b8b", "version": "1.5.0",