From fbec0d7bc4c1c2663dce1eff3331427cf42134fb Mon Sep 17 00:00:00 2001 From: Nikita Vakula <52108696+krjakbrjak@users.noreply.github.com> Date: Tue, 2 May 2023 21:40:04 +0200 Subject: [PATCH] [cppkafka] bumped to 0.4.0 (#31182) In this version some of the issues were solved: 1. No need for dynamic fix patch as it was solved inside the project. 2. CMake configs are installed --- ports/cppkafka/0001-Fix-static-lib.patch | 38 +++++++++++++++++++ .../cppkafka/0002-Remove-min-max-macros.patch | 27 +++++++++++++ ports/cppkafka/fix-dynamic.patch | 12 ------ ports/cppkafka/portfile.cmake | 23 +++++++++-- ports/cppkafka/vcpkg.json | 7 +++- versions/baseline.json | 4 +- versions/c-/cppkafka.json | 5 +++ 7 files changed, 96 insertions(+), 20 deletions(-) create mode 100644 ports/cppkafka/0001-Fix-static-lib.patch create mode 100644 ports/cppkafka/0002-Remove-min-max-macros.patch delete mode 100644 ports/cppkafka/fix-dynamic.patch diff --git a/ports/cppkafka/0001-Fix-static-lib.patch b/ports/cppkafka/0001-Fix-static-lib.patch new file mode 100644 index 0000000000..be5d7c30ad --- /dev/null +++ b/ports/cppkafka/0001-Fix-static-lib.patch @@ -0,0 +1,38 @@ +From fb7cbb0648948b51f71aefaa6b2354846f72439f Mon Sep 17 00:00:00 2001 +From: Nikita Vakula +Date: Mon, 1 May 2023 23:12:09 +0200 +Subject: [PATCH 1/2] Use correct rdkafka .pc + +Signed-off-by: Nikita Vakula +--- + CMakeLists.txt | 1 + + cmake/cppkafka.pc.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c4e44e6..e34c071 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -92,6 +92,7 @@ endif() + + if (CPPKAFKA_RDKAFKA_STATIC_LIB) + add_definitions("-DLIBRDKAFKA_STATICLIB") ++ set(RDKAFKA_STATIC "-static") + endif() + + if (NOT CPPKAFKA_CONFIG_DIR) +diff --git a/cmake/cppkafka.pc.in b/cmake/cppkafka.pc.in +index b5d432c..4e50860 100644 +--- a/cmake/cppkafka.pc.in ++++ b/cmake/cppkafka.pc.in +@@ -9,6 +9,6 @@ Url: https://github.com/mfontanini/cppkafka + Description: C++ wrapper library on top of RdKafka + Version: @CPPKAFKA_VERSION@ + Requires: +-Requires.private: rdkafka >= 0.9.4 ++Requires.private: rdkafka@RDKAFKA_STATIC@ >= 0.9.4 + Libs: -L${libdir} -L${sharedlibdir} -lcppkafka + Cflags: -I${includedir} -I${includedir}/cppkafka -I@Boost_INCLUDE_DIRS@ +-- +2.37.1 (Apple Git-137.1) + diff --git a/ports/cppkafka/0002-Remove-min-max-macros.patch b/ports/cppkafka/0002-Remove-min-max-macros.patch new file mode 100644 index 0000000000..c06277c888 --- /dev/null +++ b/ports/cppkafka/0002-Remove-min-max-macros.patch @@ -0,0 +1,27 @@ +From e2c9c0a1cee07c6cacedd682d3506b447c2c561b Mon Sep 17 00:00:00 2001 +From: Nikita Vakula +Date: Mon, 1 May 2023 23:11:19 +0200 +Subject: [PATCH 2/2] Remove min/max macros + +Signed-off-by: Nikita Vakula +--- + src/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 5b8649b..5c818ee 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -36,6 +36,9 @@ set(NAMESPACE "${PROJECT_NAME}::") + set(TARGET_EXPORT_NAME ${PROJECT_NAME}Targets) + + add_library(${TARGET_NAME} ${CPPKAFKA_LIBRARY_TYPE} ${SOURCES}) ++if (MSVC) ++ target_compile_definitions(${TARGET_NAME} PRIVATE NOMINMAX) ++endif () + target_include_directories(${TARGET_NAME} PUBLIC $) + set_target_properties(${TARGET_NAME} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}" +-- +2.37.1 (Apple Git-137.1) + diff --git a/ports/cppkafka/fix-dynamic.patch b/ports/cppkafka/fix-dynamic.patch deleted file mode 100644 index f18a0fbf76..0000000000 --- a/ports/cppkafka/fix-dynamic.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5d31078..b1d3634 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -43,6 +43,7 @@ target_include_directories(cppkafka PUBLIC ${PROJECT_SOURCE_DIR}/include) - - install( - TARGETS cppkafka -+ RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - COMPONENT dev diff --git a/ports/cppkafka/portfile.cmake b/ports/cppkafka/portfile.cmake index 49f7122665..5fb7f55d1a 100644 --- a/ports/cppkafka/portfile.cmake +++ b/ports/cppkafka/portfile.cmake @@ -1,32 +1,47 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO mfontanini/cppkafka - REF "v${VERSION}" - SHA512 60d01ce1dd9bd9119676be939ed5ab03539abb1f945c1b31e432edfe0f06542778f7fef37696f5ff19c53024f44d5cbd8aeddbbb231c38b098e05285d3ff0cab + REF "${VERSION}" + SHA512 86ac1500bdf6746a5e44e9ca4a4063eabcacec68b26c6846f7e7d47fe947309fc98a47986ab060d793096665d1cdc24044334267eb579cdb191f539bf96a3294 HEAD_REF master - PATCHES fix-dynamic.patch + PATCHES + 0001-Fix-static-lib.patch + 0002-Remove-min-max-macros.patch ) if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") set(CPPKAFKA_BUILD_SHARED OFF) + set(CPPKAFKA_RDKAFKA_STATIC_LIB ON) else() set(CPPKAFKA_BUILD_SHARED ON) + set(CPPKAFKA_RDKAFKA_STATIC_LIB OFF) endif() vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" DISABLE_PARALLEL_CONFIGURE OPTIONS + -DCMAKE_CXX_STANDARD=11 -DCPPKAFKA_BUILD_SHARED=${CPPKAFKA_BUILD_SHARED} -DCPPKAFKA_DISABLE_TESTS=ON -DCPPKAFKA_DISABLE_EXAMPLES=ON + -DCPPKAFKA_PKGCONFIG_DIR=lib/pkgconfig + -DCPPKAFKA_RDKAFKA_STATIC_LIB=${CPPKAFKA_RDKAFKA_STATIC_LIB} ) vcpkg_cmake_install() vcpkg_copy_pdbs() -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +vcpkg_cmake_config_fixup( + CONFIG_PATH lib/cmake/CppKafka +) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) # Handle copyright vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +vcpkg_fixup_pkgconfig() diff --git a/ports/cppkafka/vcpkg.json b/ports/cppkafka/vcpkg.json index 58525c463d..f9be36ab97 100644 --- a/ports/cppkafka/vcpkg.json +++ b/ports/cppkafka/vcpkg.json @@ -1,7 +1,6 @@ { "name": "cppkafka", - "version": "0.3.1", - "port-version": 5, + "version": "0.4.0", "description": "cppkafka allows C++ applications to consume and produce messages using the Apache Kafka protocol. The library is built on top of librdkafka, and provides a high level API that uses modern C++ features to make it easier to write code while keeping the wrapper's performance overhead to a minimum.", "homepage": "https://github.com/mfontanini/cppkafka", "license": "BSD-2-Clause", @@ -11,6 +10,10 @@ { "name": "vcpkg-cmake", "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true } ] } diff --git a/versions/baseline.json b/versions/baseline.json index dffcf77027..3a8568142e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1785,8 +1785,8 @@ "port-version": 3 }, "cppkafka": { - "baseline": "0.3.1", - "port-version": 5 + "baseline": "0.4.0", + "port-version": 0 }, "cppmicroservices": { "baseline": "3.6.0", diff --git a/versions/c-/cppkafka.json b/versions/c-/cppkafka.json index e063e29648..14a93e0232 100644 --- a/versions/c-/cppkafka.json +++ b/versions/c-/cppkafka.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "708cf007605104bc59394d47c9937b203c155b37", + "version": "0.4.0", + "port-version": 0 + }, { "git-tree": "a33f71df221cb16bb2f7b1ce5d9cd0043a525e00", "version": "0.3.1",