mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 22:29:01 +08:00
Merge pull request #5921 from myd7349/rdkafka-init
[librdkafka] Add new port
This commit is contained in:
commit
59995facab
20
ports/librdkafka/CONTROL
Normal file
20
ports/librdkafka/CONTROL
Normal file
@ -0,0 +1,20 @@
|
||||
Source: librdkafka
|
||||
Version: 1.1.0
|
||||
Description: The Apache Kafka C/C++ library
|
||||
Homepage: https://github.com/edenhill/librdkafka
|
||||
|
||||
Feature: lz4
|
||||
Description: Enable external LZ4 library support
|
||||
Build-Depends: lz4
|
||||
|
||||
Feature: ssl
|
||||
Description: Build with OpenSSL
|
||||
Build-Depends: openssl
|
||||
|
||||
Feature: zlib
|
||||
Description: Build with zlib
|
||||
Build-Depends: zlib
|
||||
|
||||
Feature: zstd
|
||||
Description: Build with zstd
|
||||
Build-Depends: zstd
|
21
ports/librdkafka/fix-arm64.patch
Normal file
21
ports/librdkafka/fix-arm64.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff --git a/src/snappy_compat.h b/src/snappy_compat.h
|
||||
index acda21ec..bf2fe4c7 100644
|
||||
--- a/src/snappy_compat.h
|
||||
+++ b/src/snappy_compat.h
|
||||
@@ -89,7 +89,7 @@ struct iovec {
|
||||
// x86, PowerPC, and ARM64 can simply do these loads and stores native.
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
|
||||
defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||
- defined(__aarch64__)
|
||||
+ defined(__arm64) || defined(__aarch64__) || defined(__AARCH64EL__) || defined(_M_ARM64)
|
||||
|
||||
#define get_unaligned get_unaligned_direct
|
||||
#define put_unaligned put_unaligned_direct
|
||||
@@ -115,6 +115,7 @@ struct iovec {
|
||||
!defined(__ARM_ARCH_6J__) && \
|
||||
!defined(__ARM_ARCH_6K__) && \
|
||||
!defined(__ARM_ARCH_6Z__) && \
|
||||
+ !defined(__ARM_ARCH_6KZ__) && \
|
||||
!defined(__ARM_ARCH_6ZK__) && \
|
||||
!defined(__ARM_ARCH_6T2__)
|
||||
|
82
ports/librdkafka/portfile.cmake
Normal file
82
ports/librdkafka/portfile.cmake
Normal file
@ -0,0 +1,82 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO edenhill/librdkafka
|
||||
REF v1.1.0
|
||||
SHA512 35561399b07278a09a51245c5503c86eb0cc8971692b4e65a332144bfb71e2e86d4ceaf1804534b6a416bcace74cef493b6465c20b32c14de97f45f2854359c6
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-arm64.patch
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" RDKAFKA_BUILD_STATIC)
|
||||
|
||||
vcpkg_check_features(
|
||||
lz4 ENABLE_LZ4_EXT
|
||||
ssl WITH_SSL
|
||||
zlib WITH_ZLIB
|
||||
zstd WITH_ZSTD
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DRDKAFKA_BUILD_STATIC=${RDKAFKA_BUILD_STATIC}
|
||||
-DRDKAFKA_BUILD_EXAMPLES=OFF
|
||||
-DRDKAFKA_BUILD_TESTS=OFF
|
||||
-DWITH_BUNDLED_SSL=OFF
|
||||
${FEATURE_OPTIONS}
|
||||
OPTIONS_DEBUG
|
||||
-DENABLE_DEVEL=ON
|
||||
-DENABLE_REFCNT_DEBUG=ON
|
||||
-DENABLE_SHAREDPTR_DEBUG=ON
|
||||
-DWITHOUT_OPTIMIZATION=ON
|
||||
OPTIONS_RELEASE
|
||||
-DENABLE_DEVEL=OFF
|
||||
-DENABLE_REFCNT_DEBUG=OFF
|
||||
-DENABLE_SHAREDPTR_DEBUG=OFF
|
||||
-DWITHOUT_OPTIMIZATION=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_fixup_cmake_targets(
|
||||
CONFIG_PATH lib/cmake/RdKafka
|
||||
TARGET_PATH share/rdkafka
|
||||
)
|
||||
|
||||
if(ENABLE_LZ4_EXT)
|
||||
vcpkg_replace_string(
|
||||
${CURRENT_PACKAGES_DIR}/share/rdkafka/RdKafkaConfig.cmake
|
||||
"find_dependency(LZ4)"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/FindLZ4.cmake\")\n find_dependency(LZ4)"
|
||||
)
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE
|
||||
${CURRENT_PACKAGES_DIR}/debug/include
|
||||
${CURRENT_PACKAGES_DIR}/debug/share
|
||||
)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
foreach(hdr rdkafka.h rdkafkacpp.h)
|
||||
vcpkg_replace_string(
|
||||
${CURRENT_PACKAGES_DIR}/include/librdkafka/${hdr}
|
||||
"#ifdef LIBRDKAFKA_STATICLIB"
|
||||
"#if 1 // #ifdef LIBRDKAFKA_STATICLIB"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Handle copyright
|
||||
configure_file(${SOURCE_PATH}/LICENSES.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
|
||||
|
||||
# Install usage
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
|
||||
|
||||
# CMake integration test
|
||||
vcpkg_test_cmake(PACKAGE_NAME RdKafka)
|
4
ports/librdkafka/usage
Normal file
4
ports/librdkafka/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package @PORT@:@TARGET_TRIPLET@ provides CMake targets:
|
||||
|
||||
find_package(RdKafka CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE RdKafka::rdkafka RdKafka::rdkafka++)
|
Loading…
Reference in New Issue
Block a user