karafka-rdkafka 0.20.0.rc3-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/CODEOWNERS +3 -0
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/ci_linux_x86_64_gnu.yml +248 -0
- data/.github/workflows/ci_macos_arm64.yml +301 -0
- data/.github/workflows/push_linux_x86_64_gnu.yml +60 -0
- data/.github/workflows/push_macos_arm64.yml +50 -0
- data/.github/workflows/push_ruby.yml +37 -0
- data/.github/workflows/verify-action-pins.yml +16 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +323 -0
- data/Gemfile +5 -0
- data/MIT-LICENSE +22 -0
- data/README.md +177 -0
- data/Rakefile +96 -0
- data/docker-compose.yml +25 -0
- data/ext/README.md +19 -0
- data/ext/Rakefile +131 -0
- data/ext/build_common.sh +361 -0
- data/ext/build_linux_x86_64_gnu.sh +306 -0
- data/ext/build_macos_arm64.sh +550 -0
- data/ext/librdkafka.dylib +0 -0
- data/karafka-rdkafka.gemspec +63 -0
- data/lib/rdkafka/abstract_handle.rb +116 -0
- data/lib/rdkafka/admin/acl_binding_result.rb +51 -0
- data/lib/rdkafka/admin/config_binding_result.rb +30 -0
- data/lib/rdkafka/admin/config_resource_binding_result.rb +18 -0
- data/lib/rdkafka/admin/create_acl_handle.rb +28 -0
- data/lib/rdkafka/admin/create_acl_report.rb +24 -0
- data/lib/rdkafka/admin/create_partitions_handle.rb +30 -0
- data/lib/rdkafka/admin/create_partitions_report.rb +6 -0
- data/lib/rdkafka/admin/create_topic_handle.rb +32 -0
- data/lib/rdkafka/admin/create_topic_report.rb +24 -0
- data/lib/rdkafka/admin/delete_acl_handle.rb +30 -0
- data/lib/rdkafka/admin/delete_acl_report.rb +23 -0
- data/lib/rdkafka/admin/delete_groups_handle.rb +28 -0
- data/lib/rdkafka/admin/delete_groups_report.rb +24 -0
- data/lib/rdkafka/admin/delete_topic_handle.rb +32 -0
- data/lib/rdkafka/admin/delete_topic_report.rb +24 -0
- data/lib/rdkafka/admin/describe_acl_handle.rb +30 -0
- data/lib/rdkafka/admin/describe_acl_report.rb +24 -0
- data/lib/rdkafka/admin/describe_configs_handle.rb +33 -0
- data/lib/rdkafka/admin/describe_configs_report.rb +48 -0
- data/lib/rdkafka/admin/incremental_alter_configs_handle.rb +33 -0
- data/lib/rdkafka/admin/incremental_alter_configs_report.rb +48 -0
- data/lib/rdkafka/admin.rb +832 -0
- data/lib/rdkafka/bindings.rb +582 -0
- data/lib/rdkafka/callbacks.rb +415 -0
- data/lib/rdkafka/config.rb +398 -0
- data/lib/rdkafka/consumer/headers.rb +79 -0
- data/lib/rdkafka/consumer/message.rb +86 -0
- data/lib/rdkafka/consumer/partition.rb +57 -0
- data/lib/rdkafka/consumer/topic_partition_list.rb +190 -0
- data/lib/rdkafka/consumer.rb +663 -0
- data/lib/rdkafka/error.rb +201 -0
- data/lib/rdkafka/helpers/oauth.rb +58 -0
- data/lib/rdkafka/helpers/time.rb +14 -0
- data/lib/rdkafka/metadata.rb +115 -0
- data/lib/rdkafka/native_kafka.rb +139 -0
- data/lib/rdkafka/producer/delivery_handle.rb +48 -0
- data/lib/rdkafka/producer/delivery_report.rb +45 -0
- data/lib/rdkafka/producer/partitions_count_cache.rb +216 -0
- data/lib/rdkafka/producer.rb +492 -0
- data/lib/rdkafka/version.rb +7 -0
- data/lib/rdkafka.rb +54 -0
- data/renovate.json +92 -0
- data/spec/rdkafka/abstract_handle_spec.rb +117 -0
- data/spec/rdkafka/admin/create_acl_handle_spec.rb +56 -0
- data/spec/rdkafka/admin/create_acl_report_spec.rb +18 -0
- data/spec/rdkafka/admin/create_topic_handle_spec.rb +54 -0
- data/spec/rdkafka/admin/create_topic_report_spec.rb +16 -0
- data/spec/rdkafka/admin/delete_acl_handle_spec.rb +85 -0
- data/spec/rdkafka/admin/delete_acl_report_spec.rb +72 -0
- data/spec/rdkafka/admin/delete_topic_handle_spec.rb +54 -0
- data/spec/rdkafka/admin/delete_topic_report_spec.rb +16 -0
- data/spec/rdkafka/admin/describe_acl_handle_spec.rb +85 -0
- data/spec/rdkafka/admin/describe_acl_report_spec.rb +73 -0
- data/spec/rdkafka/admin_spec.rb +769 -0
- data/spec/rdkafka/bindings_spec.rb +222 -0
- data/spec/rdkafka/callbacks_spec.rb +20 -0
- data/spec/rdkafka/config_spec.rb +258 -0
- data/spec/rdkafka/consumer/headers_spec.rb +73 -0
- data/spec/rdkafka/consumer/message_spec.rb +139 -0
- data/spec/rdkafka/consumer/partition_spec.rb +57 -0
- data/spec/rdkafka/consumer/topic_partition_list_spec.rb +248 -0
- data/spec/rdkafka/consumer_spec.rb +1299 -0
- data/spec/rdkafka/error_spec.rb +95 -0
- data/spec/rdkafka/metadata_spec.rb +79 -0
- data/spec/rdkafka/native_kafka_spec.rb +130 -0
- data/spec/rdkafka/producer/delivery_handle_spec.rb +60 -0
- data/spec/rdkafka/producer/delivery_report_spec.rb +25 -0
- data/spec/rdkafka/producer/partitions_count_cache_spec.rb +359 -0
- data/spec/rdkafka/producer/partitions_count_spec.rb +359 -0
- data/spec/rdkafka/producer_spec.rb +1234 -0
- data/spec/spec_helper.rb +181 -0
- metadata +273 -0
@@ -0,0 +1,306 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
#
|
3
|
+
# Build self-contained librdkafka.so for Linux x86_64 with checksum verification
|
4
|
+
# Usage: ./build-librdkafka-linux.sh
|
5
|
+
#
|
6
|
+
# Expected directory structure:
|
7
|
+
# ext/build_linux_x86_64_gnu.sh (this script)
|
8
|
+
# ext/build-common.sh (shared functions)
|
9
|
+
# dist/librdkafka-*.tar.gz (librdkafka source tarball)
|
10
|
+
# dist/patches/*.patch (optional Ruby-specific patches)
|
11
|
+
#
|
12
|
+
set -euo pipefail
|
13
|
+
|
14
|
+
# Source common functions and constants
|
15
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
16
|
+
source "$SCRIPT_DIR/build_common.sh"
|
17
|
+
|
18
|
+
# Platform-specific paths
|
19
|
+
DIST_DIR="$SCRIPT_DIR/../dist"
|
20
|
+
PATCHES_DIR="$DIST_DIR/patches"
|
21
|
+
BUILD_DIR="$(pwd)/build-tmp"
|
22
|
+
DEPS_PREFIX="/tmp"
|
23
|
+
|
24
|
+
# Check common dependencies
|
25
|
+
check_common_dependencies
|
26
|
+
|
27
|
+
# Linux-specific dependency check
|
28
|
+
log "Checking Linux-specific build dependencies..."
|
29
|
+
command -v gcc &> /dev/null || error "gcc not found. Install with: apt-get install build-essential"
|
30
|
+
|
31
|
+
# Auto-detect librdkafka tarball
|
32
|
+
log "Looking for librdkafka tarball in $DIST_DIR..."
|
33
|
+
LIBRDKAFKA_TARBALL=$(find_librdkafka_tarball "$DIST_DIR")
|
34
|
+
log "Found librdkafka tarball: $LIBRDKAFKA_TARBALL"
|
35
|
+
|
36
|
+
# Verify librdkafka tarball checksum if available
|
37
|
+
verify_librdkafka_checksum "$LIBRDKAFKA_TARBALL"
|
38
|
+
|
39
|
+
# Find patches
|
40
|
+
PATCHES_FOUND=()
|
41
|
+
find_patches "$PATCHES_DIR" PATCHES_FOUND
|
42
|
+
|
43
|
+
security_log "Starting secure build with checksum verification enabled"
|
44
|
+
log "Building self-contained librdkafka.so for Linux x86_64 GNU"
|
45
|
+
log "Dependencies to build:"
|
46
|
+
log " - OpenSSL: $OPENSSL_VERSION"
|
47
|
+
log " - Cyrus SASL: $CYRUS_SASL_VERSION"
|
48
|
+
log " - MIT Kerberos: $KRB5_VERSION"
|
49
|
+
log " - zlib: $ZLIB_VERSION"
|
50
|
+
log " - ZStd: $ZSTD_VERSION"
|
51
|
+
log "librdkafka source: $LIBRDKAFKA_TARBALL"
|
52
|
+
log "Build directory: $BUILD_DIR"
|
53
|
+
|
54
|
+
# Create build directory
|
55
|
+
mkdir -p "$BUILD_DIR"
|
56
|
+
cd "$BUILD_DIR"
|
57
|
+
|
58
|
+
# Build OpenSSL
|
59
|
+
log "Building OpenSSL $OPENSSL_VERSION..."
|
60
|
+
OPENSSL_PREFIX="$DEPS_PREFIX/static-openssl-$OPENSSL_VERSION"
|
61
|
+
OPENSSL_TARBALL="openssl-$OPENSSL_VERSION.tar.gz"
|
62
|
+
OPENSSL_DIR="openssl-$OPENSSL_VERSION"
|
63
|
+
|
64
|
+
secure_download "$(get_openssl_url)" "$OPENSSL_TARBALL"
|
65
|
+
extract_if_needed "$OPENSSL_TARBALL" "$OPENSSL_DIR"
|
66
|
+
cd "$OPENSSL_DIR"
|
67
|
+
|
68
|
+
# Check if OpenSSL lib directory exists (lib or lib64)
|
69
|
+
if [ ! -f "$OPENSSL_PREFIX/lib/libssl.a" ] && [ ! -f "$OPENSSL_PREFIX/lib64/libssl.a" ]; then
|
70
|
+
log "Configuring and building OpenSSL..."
|
71
|
+
export CFLAGS="-fPIC"
|
72
|
+
./Configure linux-x86_64 \
|
73
|
+
no-shared \
|
74
|
+
no-dso \
|
75
|
+
--prefix="$OPENSSL_PREFIX"
|
76
|
+
make clean || true
|
77
|
+
make -j$(get_cpu_count)
|
78
|
+
make install
|
79
|
+
unset CFLAGS
|
80
|
+
log "OpenSSL built successfully"
|
81
|
+
else
|
82
|
+
log "OpenSSL already built, skipping..."
|
83
|
+
fi
|
84
|
+
|
85
|
+
# Determine OpenSSL lib directory
|
86
|
+
if [ -f "$OPENSSL_PREFIX/lib64/libssl.a" ]; then
|
87
|
+
OPENSSL_LIB_DIR="$OPENSSL_PREFIX/lib64"
|
88
|
+
else
|
89
|
+
OPENSSL_LIB_DIR="$OPENSSL_PREFIX/lib"
|
90
|
+
fi
|
91
|
+
log "OpenSSL libraries in: $OPENSSL_LIB_DIR"
|
92
|
+
|
93
|
+
cd "$BUILD_DIR"
|
94
|
+
|
95
|
+
# Build MIT Kerberos (krb5)
|
96
|
+
log "Building MIT Kerberos $KRB5_VERSION..."
|
97
|
+
KRB5_PREFIX="$DEPS_PREFIX/static-krb5-$KRB5_VERSION"
|
98
|
+
KRB5_TARBALL="krb5-$KRB5_VERSION.tar.gz"
|
99
|
+
KRB5_DIR="krb5-$KRB5_VERSION"
|
100
|
+
|
101
|
+
secure_download "$(get_krb5_url)" "$KRB5_TARBALL"
|
102
|
+
extract_if_needed "$KRB5_TARBALL" "$KRB5_DIR"
|
103
|
+
cd "$KRB5_DIR/src"
|
104
|
+
|
105
|
+
if [ ! -f "$KRB5_PREFIX/lib/libgssapi_krb5.a" ]; then
|
106
|
+
log "Configuring and building MIT Kerberos..."
|
107
|
+
make clean 2>/dev/null || true
|
108
|
+
./configure --disable-shared --enable-static --prefix="$KRB5_PREFIX" \
|
109
|
+
--without-ldap --without-tcl --without-keyutils \
|
110
|
+
--disable-rpath --without-system-verto \
|
111
|
+
CFLAGS="-fPIC" CXXFLAGS="-fPIC"
|
112
|
+
|
113
|
+
# Build everything except the problematic kadmin tools
|
114
|
+
log "Building Kerberos (will ignore kadmin build failures)..."
|
115
|
+
make -j$(get_cpu_count) || {
|
116
|
+
log "Full build failed (expected due to kadmin), continuing with libraries..."
|
117
|
+
# The libraries should be built even if kadmin fails
|
118
|
+
true
|
119
|
+
}
|
120
|
+
|
121
|
+
# Install what was successfully built
|
122
|
+
make install || {
|
123
|
+
log "Full install failed, installing individual components..."
|
124
|
+
# Try to install the core libraries manually
|
125
|
+
make install-mkdirs 2>/dev/null || true
|
126
|
+
make -C util install 2>/dev/null || true
|
127
|
+
make -C lib install 2>/dev/null || true
|
128
|
+
make -C plugins/kdb/db2 install 2>/dev/null || true
|
129
|
+
}
|
130
|
+
|
131
|
+
# Verify we got the essential libraries
|
132
|
+
if [ ! -f "$KRB5_PREFIX/lib/libgssapi_krb5.a" ]; then
|
133
|
+
error "Failed to build essential Kerberos libraries"
|
134
|
+
fi
|
135
|
+
|
136
|
+
log "MIT Kerberos libraries built successfully"
|
137
|
+
else
|
138
|
+
log "MIT Kerberos already built, skipping..."
|
139
|
+
fi
|
140
|
+
|
141
|
+
cd "$BUILD_DIR"
|
142
|
+
|
143
|
+
# Build SASL
|
144
|
+
log "Building Cyrus SASL $CYRUS_SASL_VERSION..."
|
145
|
+
SASL_PREFIX="$DEPS_PREFIX/static-sasl-$CYRUS_SASL_VERSION"
|
146
|
+
SASL_TARBALL="cyrus-sasl-$CYRUS_SASL_VERSION.tar.gz"
|
147
|
+
SASL_DIR="cyrus-sasl-$CYRUS_SASL_VERSION"
|
148
|
+
|
149
|
+
secure_download "$(get_sasl_url)" "$SASL_TARBALL"
|
150
|
+
extract_if_needed "$SASL_TARBALL" "$SASL_DIR"
|
151
|
+
cd "$SASL_DIR"
|
152
|
+
|
153
|
+
if [ ! -f "$SASL_PREFIX/lib/libsasl2.a" ]; then
|
154
|
+
log "Configuring and building SASL..."
|
155
|
+
make clean 2>/dev/null || true
|
156
|
+
./configure --disable-shared --enable-static --prefix="$SASL_PREFIX" \
|
157
|
+
--without-dblib --disable-gdbm \
|
158
|
+
--enable-gssapi="$KRB5_PREFIX" \
|
159
|
+
CFLAGS="-fPIC" CXXFLAGS="-fPIC" \
|
160
|
+
CPPFLAGS="-I$KRB5_PREFIX/include" \
|
161
|
+
LDFLAGS="-L$KRB5_PREFIX/lib"
|
162
|
+
make -j$(get_cpu_count)
|
163
|
+
make install
|
164
|
+
log "SASL built successfully"
|
165
|
+
else
|
166
|
+
log "SASL already built, skipping..."
|
167
|
+
fi
|
168
|
+
|
169
|
+
cd "$BUILD_DIR"
|
170
|
+
|
171
|
+
# Build zlib
|
172
|
+
log "Building zlib $ZLIB_VERSION..."
|
173
|
+
ZLIB_PREFIX="$DEPS_PREFIX/static-zlib-$ZLIB_VERSION"
|
174
|
+
ZLIB_TARBALL="zlib-$ZLIB_VERSION.tar.gz"
|
175
|
+
ZLIB_DIR="zlib-$ZLIB_VERSION"
|
176
|
+
|
177
|
+
secure_download "$(get_zlib_url)" "$ZLIB_TARBALL"
|
178
|
+
extract_if_needed "$ZLIB_TARBALL" "$ZLIB_DIR"
|
179
|
+
cd "$ZLIB_DIR"
|
180
|
+
|
181
|
+
if [ ! -f "$ZLIB_PREFIX/lib/libz.a" ]; then
|
182
|
+
log "Configuring and building zlib..."
|
183
|
+
make clean 2>/dev/null || true
|
184
|
+
export CFLAGS="-fPIC"
|
185
|
+
./configure --prefix="$ZLIB_PREFIX" --static
|
186
|
+
make -j$(get_cpu_count)
|
187
|
+
make install
|
188
|
+
unset CFLAGS
|
189
|
+
log "zlib built successfully"
|
190
|
+
else
|
191
|
+
log "zlib already built, skipping..."
|
192
|
+
fi
|
193
|
+
|
194
|
+
cd "$BUILD_DIR"
|
195
|
+
|
196
|
+
# Build ZStd
|
197
|
+
log "Building ZStd $ZSTD_VERSION..."
|
198
|
+
ZSTD_PREFIX="$DEPS_PREFIX/static-zstd-$ZSTD_VERSION"
|
199
|
+
ZSTD_TARBALL="zstd-$ZSTD_VERSION.tar.gz"
|
200
|
+
ZSTD_DIR="zstd-$ZSTD_VERSION"
|
201
|
+
|
202
|
+
secure_download "$(get_zstd_url)" "$ZSTD_TARBALL"
|
203
|
+
extract_if_needed "$ZSTD_TARBALL" "$ZSTD_DIR"
|
204
|
+
cd "$ZSTD_DIR"
|
205
|
+
|
206
|
+
if [ ! -f "$ZSTD_PREFIX/lib/libzstd.a" ]; then
|
207
|
+
log "Building ZStd..."
|
208
|
+
make clean 2>/dev/null || true
|
209
|
+
make lib-mt CFLAGS="-fPIC" PREFIX="$ZSTD_PREFIX" -j$(get_cpu_count)
|
210
|
+
# Use standard install target - install-pc may not exist in all versions
|
211
|
+
make install PREFIX="$ZSTD_PREFIX"
|
212
|
+
log "ZStd built successfully"
|
213
|
+
else
|
214
|
+
log "ZStd already built, skipping..."
|
215
|
+
fi
|
216
|
+
|
217
|
+
cd "$BUILD_DIR"
|
218
|
+
|
219
|
+
# Extract and patch librdkafka
|
220
|
+
log "Extracting librdkafka..."
|
221
|
+
tar xzf "$LIBRDKAFKA_TARBALL"
|
222
|
+
cd "librdkafka-$LIBRDKAFKA_VERSION"
|
223
|
+
|
224
|
+
# Fix permissions and apply patches
|
225
|
+
fix_configure_permissions
|
226
|
+
apply_patches PATCHES_FOUND
|
227
|
+
|
228
|
+
# Configure librdkafka
|
229
|
+
log "Configuring librdkafka..."
|
230
|
+
|
231
|
+
if [ -f configure ]; then
|
232
|
+
log "Using standard configure (autotools)"
|
233
|
+
# Export environment variables for configure to pick up
|
234
|
+
export CPPFLAGS="-I$KRB5_PREFIX/include"
|
235
|
+
export LDFLAGS="-L$KRB5_PREFIX/lib"
|
236
|
+
|
237
|
+
./configure --enable-static --disable-shared --disable-curl \
|
238
|
+
--enable-gssapi
|
239
|
+
|
240
|
+
# Clean up environment variables
|
241
|
+
unset CPPFLAGS LDFLAGS
|
242
|
+
else
|
243
|
+
error "No configure script found (checked: configure.self, configure)"
|
244
|
+
fi
|
245
|
+
|
246
|
+
# Build librdkafka
|
247
|
+
log "Compiling librdkafka..."
|
248
|
+
make clean || true
|
249
|
+
make -j$(get_cpu_count)
|
250
|
+
|
251
|
+
# Verify librdkafka.a exists
|
252
|
+
if [ ! -f src/librdkafka.a ]; then
|
253
|
+
error "librdkafka.a not found after build"
|
254
|
+
fi
|
255
|
+
|
256
|
+
log "librdkafka.a built successfully"
|
257
|
+
|
258
|
+
# Create self-contained shared library
|
259
|
+
log "Creating self-contained librdkafka.so..."
|
260
|
+
|
261
|
+
gcc -shared -fPIC -Wl,--whole-archive src/librdkafka.a -Wl,--no-whole-archive \
|
262
|
+
-o librdkafka.so \
|
263
|
+
"$SASL_PREFIX/lib/libsasl2.a" \
|
264
|
+
"$KRB5_PREFIX/lib/libgssapi_krb5.a" \
|
265
|
+
"$KRB5_PREFIX/lib/libkrb5.a" \
|
266
|
+
"$KRB5_PREFIX/lib/libk5crypto.a" \
|
267
|
+
"$KRB5_PREFIX/lib/libcom_err.a" \
|
268
|
+
"$KRB5_PREFIX/lib/libkrb5support.a" \
|
269
|
+
"$OPENSSL_LIB_DIR/libssl.a" \
|
270
|
+
"$OPENSSL_LIB_DIR/libcrypto.a" \
|
271
|
+
"$ZLIB_PREFIX/lib/libz.a" \
|
272
|
+
"$ZSTD_PREFIX/lib/libzstd.a" \
|
273
|
+
-lpthread -lm -ldl -lresolv
|
274
|
+
|
275
|
+
if [ ! -f librdkafka.so ]; then
|
276
|
+
error "Failed to create librdkafka.so"
|
277
|
+
fi
|
278
|
+
|
279
|
+
log "librdkafka.so created successfully"
|
280
|
+
|
281
|
+
# Verify the build
|
282
|
+
log "Verifying build..."
|
283
|
+
file librdkafka.so
|
284
|
+
|
285
|
+
log "Checking dependencies with ldd:"
|
286
|
+
ldd librdkafka.so
|
287
|
+
|
288
|
+
log "Checking for external dependencies (should only show system libraries):"
|
289
|
+
EXTERNAL_DEPS=$(nm -D librdkafka.so | grep " U " | grep -v "@GLIBC" || true)
|
290
|
+
if [ -n "$EXTERNAL_DEPS" ]; then
|
291
|
+
error "Found external dependencies - library is not self-contained: $EXTERNAL_DEPS"
|
292
|
+
else
|
293
|
+
log "✅ No external dependencies found - library is self-contained!"
|
294
|
+
fi
|
295
|
+
|
296
|
+
# Copy to output directory
|
297
|
+
OUTPUT_DIR="$SCRIPT_DIR"
|
298
|
+
cp librdkafka.so "$OUTPUT_DIR/"
|
299
|
+
log "librdkafka.so copied to: $OUTPUT_DIR/librdkafka.so"
|
300
|
+
|
301
|
+
# Print summaries
|
302
|
+
print_security_summary
|
303
|
+
print_build_summary "Linux" "x86_64" "$OUTPUT_DIR" "librdkafka.so"
|
304
|
+
|
305
|
+
# Cleanup
|
306
|
+
cleanup_build_dir "$BUILD_DIR"
|