summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm
diff options
context:
space:
mode:
Diffstat (limited to 'src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm')
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/.gitignore7
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/Makefile92
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/README.md23
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/el7-x86_64.cfg40
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/librdkafka.spec118
-rwxr-xr-xsrc/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/mock-on-docker.sh97
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/.gitignore2
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/Makefile25
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/README.md8
-rwxr-xr-xsrc/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/run-test.sh49
-rwxr-xr-xsrc/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test-on-docker.sh56
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.c77
-rw-r--r--src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.cpp34
13 files changed, 628 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/.gitignore b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/.gitignore
new file mode 100644
index 000000000..4bfdf21ed
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/.gitignore
@@ -0,0 +1,7 @@
+*.log
+available_pkgs
+installed_pkgs
+pkgs-*
+arts-*
+cache
+output
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/Makefile b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/Makefile
new file mode 100644
index 000000000..c5c8f8c10
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/Makefile
@@ -0,0 +1,92 @@
+PACKAGE_NAME?= librdkafka
+VERSION?= $(shell ../get_version.py ../../src/rdkafka.h)
+
+# Jenkins CI integration
+BUILD_NUMBER?= 1
+
+MOCK_CONFIG?=default
+
+RESULT_DIR?=pkgs-$(VERSION)-$(BUILD_NUMBER)-$(MOCK_CONFIG)
+
+# Where built packages are copied with `make copy-artifacts`
+ARTIFACTS_DIR?=../../artifacts
+
+all: rpm
+
+
+SOURCES:
+ mkdir -p SOURCES
+
+archive: SOURCES
+ cd ../../ && \
+ git archive --prefix=$(PACKAGE_NAME)-$(VERSION)/ \
+ -o packaging/rpm/SOURCES/$(PACKAGE_NAME)-$(VERSION).tar.gz HEAD
+
+
+build_prepare: archive
+ mkdir -p $(RESULT_DIR)
+ rm -f $(RESULT_DIR)/$(PACKAGE_NAME)*.rpm
+
+
+srpm: build_prepare
+ /usr/bin/mock \
+ -r $(MOCK_CONFIG) \
+ $(MOCK_OPTIONS) \
+ --define "__version $(VERSION)" \
+ --define "__release $(BUILD_NUMBER)" \
+ --enable-network \
+ --resultdir=$(RESULT_DIR) \
+ --no-clean --no-cleanup-after \
+ --install epel-release \
+ --buildsrpm \
+ --spec=librdkafka.spec \
+ --sources=SOURCES || \
+ (tail -n 100 pkgs-$(VERSION)*/*log ; false)
+ @echo "======= Source RPM now available in $(RESULT_DIR) ======="
+
+rpm: srpm
+ /usr/bin/mock \
+ -r $(MOCK_CONFIG) \
+ $(MOCK_OPTIONS) \
+ --define "__version $(VERSION)"\
+ --define "__release $(BUILD_NUMBER)"\
+ --enable-network \
+ --resultdir=$(RESULT_DIR) \
+ --no-clean --no-cleanup-after \
+ --rebuild $(RESULT_DIR)/$(PACKAGE_NAME)*.src.rpm || \
+ (tail -n 100 pkgs-$(VERSION)*/*log ; false)
+ @echo "======= Binary RPMs now available in $(RESULT_DIR) ======="
+
+copy-artifacts:
+ cp $(RESULT_DIR)/*rpm $(ARTIFACTS_DIR)
+
+clean:
+ rm -rf SOURCES
+ /usr/bin/mock -r $(MOCK_CONFIG) --clean
+
+distclean: clean
+ rm -f build.log root.log state.log available_pkgs installed_pkgs \
+ *.rpm *.tar.gz
+
+# Prepare ubuntu 14.04 for building RPMs with mock.
+# - older versions of mock needs the config file to reside in /etc/mock,
+# so we copy it there.
+# - add a mock system group (if not already exists)
+# - add the current user to the mock group.
+# - prepare mock environment with some needed packages.
+# NOTE: This target should be run with sudo.
+prepare_ubuntu:
+ apt-get -qq update
+ apt-get install -y -qq mock make git python-lzma
+ cp *.cfg /etc/mock/
+ addgroup --system mock || true
+ adduser $$(whoami) mock
+ /usr/bin/mock -r $(MOCK_CONFIG) --init
+ /usr/bin/mock -r $(MOCK_CONFIG) \
+ --enable-network \
+ --no-cleanup-after \
+ --install epel-release shadow-utils
+
+prepare_centos:
+ yum install -y -q mock make git
+ cp *.cfg /etc/mock/
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/README.md b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/README.md
new file mode 100644
index 000000000..92a6eca95
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/README.md
@@ -0,0 +1,23 @@
+# RPM packages for librdkafka
+
+On a system with RPM mock installed, simply run make to create RPM packages:
+
+ $ make
+
+Additional mock options may be specified using MOCK_OPTIONS:
+
+ $ make MOCK_OPTIONS='--bootstrap-chroot'
+
+
+## Build with Mock on docker
+
+From the librdkafka top-level directory:
+
+ $ packaging/rpm/mock-on-docker.sh
+
+Wait for packages to build, they will be copied to top-level dir artifacts/
+
+Test the packages:
+
+ $ packaging/rpm/tests/test-on-docker.sh
+
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/el7-x86_64.cfg b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/el7-x86_64.cfg
new file mode 100644
index 000000000..502282749
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/el7-x86_64.cfg
@@ -0,0 +1,40 @@
+config_opts['root'] = 'el7-x86_64'
+config_opts['target_arch'] = 'x86_64'
+config_opts['legal_host_arches'] = ('x86_64',)
+config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
+config_opts['dist'] = 'el7' # only useful for --resultdir variable subst
+config_opts['releasever'] = '7'
+config_opts['docker_unshare_warning'] = False
+config_opts['nosync'] = True
+
+config_opts['yum.conf'] = """
+[main]
+keepcache=1
+debuglevel=2
+reposdir=/dev/null
+logfile=/var/log/yum.log
+retries=15
+obsoletes=1
+gpgcheck=0
+assumeyes=1
+syslog_ident=mock
+syslog_device=
+mdpolicy=group:primary
+
+# repos
+[base]
+name=BaseOS
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os
+failovermethod=priority
+
+[updates]
+name=updates
+enabled=1
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates
+failovermethod=priority
+
+[epel]
+name=epel
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-7&arch=x86_64
+failovermethod=priority
+"""
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/librdkafka.spec b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/librdkafka.spec
new file mode 100644
index 000000000..4f9e8c0d0
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/librdkafka.spec
@@ -0,0 +1,118 @@
+Name: librdkafka
+Version: %{__version}
+Release: %{__release}%{?dist}
+%define soname 1
+
+Summary: The Apache Kafka C library
+Group: Development/Libraries/C and C++
+License: BSD-2-Clause
+URL: https://github.com/edenhill/librdkafka
+Source: librdkafka-%{version}.tar.gz
+
+BuildRequires: zlib-devel libstdc++-devel gcc >= 4.1 gcc-c++ cyrus-sasl-devel
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+%define _source_payload w9.gzdio
+%define _binary_payload w9.gzdio
+
+%description
+librdkafka is the C/C++ client library implementation of the Apache Kafka protocol, containing both Producer and Consumer support.
+
+
+%package -n %{name}%{soname}
+Summary: The Apache Kafka C library
+Group: Development/Libraries/C and C++
+Requires: zlib libstdc++ cyrus-sasl
+# openssl libraries were extract to openssl-libs in RHEL7
+%if 0%{?rhel} >= 7
+Requires: openssl-libs >= 1.0.2
+BuildRequires: openssl-devel >= 1.0.2 python3
+%else
+Requires: openssl
+# python34 is provided from epel-release, but that package needs to be installed
+# prior to rpmbuild working out these dependencies (such as from mock).
+BuildRequires: openssl-devel python34
+%endif
+
+%description -n %{name}%{soname}
+librdkafka is the C/C++ client library implementation of the Apache Kafka protocol, containing both Producer and Consumer support.
+
+
+%package -n %{name}-devel
+Summary: The Apache Kafka C library (Development Environment)
+Group: Development/Libraries/C and C++
+Requires: %{name}%{soname} = %{version}
+
+%description -n %{name}-devel
+librdkafka is the C/C++ client library implementation of the Apache Kafka protocol, containing both Producer and Consumer support.
+
+This package contains headers and libraries required to build applications
+using librdkafka.
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+# --install-deps will install missing dependencies that are not available
+# through BuildRequires, such as libzstd, which will be linked statically.
+%configure --install-deps --disable-lz4-ext
+
+%build
+cat config.log
+make
+examples/rdkafka_example -X builtin.features
+
+%install
+rm -rf %{buildroot}
+DESTDIR=%{buildroot} make install
+
+%clean
+rm -rf %{buildroot}
+
+%post -n %{name}%{soname} -p /sbin/ldconfig
+%postun -n %{name}%{soname} -p /sbin/ldconfig
+
+%files -n %{name}%{soname}
+%defattr(444,root,root)
+%{_libdir}/librdkafka.so.%{soname}
+%{_libdir}/librdkafka++.so.%{soname}
+%defattr(-,root,root)
+%doc %{_docdir}/librdkafka/README.md
+%doc %{_docdir}/librdkafka/LICENSE
+%doc %{_docdir}/librdkafka/CONFIGURATION.md
+%doc %{_docdir}/librdkafka/INTRODUCTION.md
+%doc %{_docdir}/librdkafka/STATISTICS.md
+%doc %{_docdir}/librdkafka/CHANGELOG.md
+%doc %{_docdir}/librdkafka/LICENSES.txt
+
+%defattr(-,root,root)
+#%{_bindir}/rdkafka_example
+#%{_bindir}/rdkafka_performance
+
+
+%files -n %{name}-devel
+%defattr(-,root,root)
+%{_includedir}/librdkafka
+%defattr(444,root,root)
+%{_libdir}/librdkafka.a
+%{_libdir}/librdkafka-static.a
+%{_libdir}/librdkafka.so
+%{_libdir}/librdkafka++.a
+%{_libdir}/librdkafka++.so
+%{_libdir}/pkgconfig/rdkafka++.pc
+%{_libdir}/pkgconfig/rdkafka.pc
+%{_libdir}/pkgconfig/rdkafka-static.pc
+%{_libdir}/pkgconfig/rdkafka++-static.pc
+
+%changelog
+* Thu Apr 09 2015 Eduard Iskandarov <e.iskandarov@corp.mail.ru> 0.8.6-0
+- 0.8.6 simplify build process
+
+* Fri Oct 24 2014 Magnus Edenhill <rdkafka@edenhill.se> 0.8.5-0
+- 0.8.5 release
+
+* Mon Aug 18 2014 Magnus Edenhill <rdkafka@edenhill.se> 0.8.4-0
+- 0.8.4 release
+
+* Mon Mar 17 2014 Magnus Edenhill <vk@edenhill.se> 0.8.3-0
+- Initial RPM package
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/mock-on-docker.sh b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/mock-on-docker.sh
new file mode 100755
index 000000000..eec3d54a7
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/mock-on-docker.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+#
+#
+# Run mock in docker to create RPM packages of librdkafka.
+#
+# Usage:
+# packaging/rpm/mock-on-docker.sh [<mock configs ..>]
+#
+
+set -ex
+
+_DOCKER_IMAGE=fedora:35
+_MOCK_CONFIGS="centos+epel-7-x86_64 centos-stream+epel-8-x86_64"
+
+if [[ $1 == "--build" ]]; then
+ on_builder=1
+ shift
+else
+ on_builder=0
+fi
+
+
+if [[ -n $* ]]; then
+ _MOCK_CONFIGS="$*"
+fi
+
+
+if [[ $on_builder == 0 ]]; then
+ #
+ # Running on host, fire up a docker container and run the latter
+ # part of this script in docker.
+ #
+
+ if [[ ! -f configure.self ]]; then
+ echo "$0 must be run from librdkafka top directory"
+ exit 1
+ fi
+
+ mkdir -p ${PWD}/packaging/rpm/cache/mock
+
+ docker run \
+ --privileged \
+ -t \
+ -v ${PWD}/packaging/rpm/cache/mock:/var/cache/mock \
+ -v ${PWD}:/io \
+ $_DOCKER_IMAGE \
+ /io/packaging/rpm/mock-on-docker.sh --build $_MOCK_CONFIGS
+
+ mkdir -p artifacts
+ for MOCK_CONFIG in $_MOCK_CONFIGS ; do
+ cp -vr --no-preserve=ownership packaging/rpm/arts-${MOCK_CONFIG}/*rpm artifacts/
+ done
+
+ echo "All Done"
+
+else
+ #
+ # Running in docker container.
+ #
+
+ dnf install -y -q mock mock-core-configs make git
+
+ echo "%_netsharedpath /sys:/proc" >> /etc/rpm/macros.netshared
+
+ pushd /io/packaging/rpm
+
+ for MOCK_CONFIG in $_MOCK_CONFIGS ; do
+ cfg_file=/etc/mock/${MOCK_CONFIG}.cfg
+ if [[ ! -f $cfg_file ]]; then
+ echo "Error: Mock config $cfg_file does not exist"
+ exit 1
+ fi
+
+ echo "config_opts['plugin_conf']['bind_mount_enable'] = False" >> $cfg_file
+ echo "config_opts['docker_unshare_warning'] = False" >> $cfg_file
+ echo "Building $MOCK_CONFIG in $PWD"
+ cat $cfg_file
+
+ echo "Setting git safe.directory"
+ git config --global --add safe.directory /io
+
+ export MOCK_CONFIG=$MOCK_CONFIG
+ make all
+
+ echo "Done building $MOCK_CONFIG: copying artifacts"
+ artdir="arts-$MOCK_CONFIG"
+ mkdir -p "$artdir"
+ make ARTIFACTS_DIR="$artdir" copy-artifacts
+
+ done
+
+ popd
+ echo "Done"
+fi
+
+exit 0
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/.gitignore b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/.gitignore
new file mode 100644
index 000000000..333a2b7ac
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/.gitignore
@@ -0,0 +1,2 @@
+test
+testcpp
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/Makefile b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/Makefile
new file mode 100644
index 000000000..edd457997
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/Makefile
@@ -0,0 +1,25 @@
+
+PROGS?=test test-static testcpp testcpp-static
+
+all: $(PROGS)
+
+test: test.c
+ $(CC) -O2 -Werror -Wall $^ -o $@ $$(pkg-config --libs rdkafka)
+
+test-static: test.c
+ $(CC) -O2 -Werror -Wall $^ -o $@ $$(pkg-config --libs --static rdkafka-static)
+
+testcpp: test.cpp
+ $(CXX) -O2 -Werror -Wall $^ -o $@ $$(pkg-config --libs rdkafka++)
+
+testcpp-static: test.cpp
+ $(CXX) -O2 -Werror -Wall $^ -o $@ $$(pkg-config --libs rdkafka++-static)
+
+run:
+ @(for p in $(PROGS); do \
+ echo "# Running $$p" ; \
+ ./$$p || (echo $$p failed ; exit 1) ; \
+ done)
+
+clean:
+ rm -f $(PROGS)
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/README.md b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/README.md
new file mode 100644
index 000000000..8d1107b66
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/README.md
@@ -0,0 +1,8 @@
+# Test librdkafka RPMs using docker
+
+After building the RPMs (see README.md in parent directory) test
+the RPMs on the supported CentOS/RHEL versions using:
+
+ $ packaging/rpm/tests/test-on-docker.sh
+
+
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/run-test.sh b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/run-test.sh
new file mode 100755
index 000000000..c1234a945
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/run-test.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# This script runs in the docker container, performing:
+# * install build toolchain
+# * install librdkafka rpms
+# * builds test apps
+# * runs test apps
+#
+# Usage: $0 <docker-image-name>
+
+set -ex
+
+pushd /v
+
+_IMG=$1
+
+echo "Testing on $_IMG"
+
+if [[ $_IMG == "centos:6" ]]; then
+ _EL=6
+ _INST="yum install -y -q"
+elif [[ $_IMG == "centos:7" ]]; then
+ _EL=7
+ _INST="yum install -y -q"
+ # centos:7 ships with openssl-libs 1.0.1 which is outdated and not
+ # ABI-compatible with 1.0.2 (which we build with).
+ # Upgrade openssl-libs, as users would, to prevent missing symbols.
+ _UPG="yum upgrade -y openssl-libs"
+else
+ _EL=8
+ _INST="dnf install -y -q"
+fi
+
+$_INST gcc gcc-c++ make pkg-config
+
+if [[ -n $_UPG ]]; then
+ $_UPG
+fi
+
+$_INST /rpms/librdkafka1-*el${_EL}.x86_64.rpm /rpms/librdkafka-devel-*el${_EL}.x86_64.rpm
+
+make clean all
+
+make run
+
+make clean
+
+echo "$_IMG is all good!"
+
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test-on-docker.sh b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test-on-docker.sh
new file mode 100755
index 000000000..2c12ff792
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test-on-docker.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+#
+# Test librdkafka packages in <rpmdirectory> using docker.
+# Must be executed from the librdkafka top-level directory.
+#
+# Usage:
+# packaging/rpm/test-on-docker.sh [<rpm-dir>]
+
+set -ex
+
+if [[ ! -f configure.self ]]; then
+ echo "Must be executed from the librdkafka top-level directory"
+ exit 1
+fi
+
+_DOCKER_IMAGES="centos:7 redhat/ubi8:8.5-226"
+_RPMDIR=artifacts
+
+if [[ -n $1 ]]; then
+ _RPMDIR="$1"
+fi
+
+_RPMDIR=$(readlink -f $_RPMDIR)
+
+if [[ ! -d $_RPMDIR ]]; then
+ echo "$_RPMDIR does not exist"
+ exit 1
+fi
+
+
+fails=""
+for _IMG in $_DOCKER_IMAGES ; do
+ if ! docker run \
+ -t \
+ -v $_RPMDIR:/rpms \
+ -v $(readlink -f packaging/rpm/tests):/v \
+ $_IMG \
+ /v/run-test.sh $_IMG ; then
+ echo "ERROR: $_IMG FAILED"
+ fails="${fails}$_IMG "
+ fi
+done
+
+if [[ -n $fails ]]; then
+ echo "##################################################"
+ echo "# Package verification failed for:"
+ echo "# $fails"
+ echo "# See previous errors"
+ echo "##################################################"
+ exit 1
+fi
+
+exit 0
+
+
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.c b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.c
new file mode 100644
index 000000000..cf39b6bcd
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.c
@@ -0,0 +1,77 @@
+#include <stdio.h>
+#include <string.h>
+#include <librdkafka/rdkafka.h>
+
+int main(int argc, char **argv) {
+ rd_kafka_conf_t *conf;
+ rd_kafka_t *rk;
+ char features[256];
+ size_t fsize = sizeof(features);
+ char errstr[512];
+ const char *exp_features[] = {
+ "gzip", "snappy", "ssl", "sasl", "regex",
+ "lz4", "sasl_gssapi", "sasl_plain", "sasl_scram", "plugins",
+ "zstd", "sasl_oauthbearer", NULL,
+ };
+ const char **exp;
+ int missing = 0;
+
+
+ printf("librdkafka %s\n", rd_kafka_version_str());
+
+ conf = rd_kafka_conf_new();
+ if (rd_kafka_conf_get(conf, "builtin.features", features, &fsize) !=
+ RD_KAFKA_CONF_OK) {
+ fprintf(stderr, "conf_get failed\n");
+ return 1;
+ }
+
+ printf("builtin.features %s\n", features);
+
+ /* Verify that expected features are enabled. */
+ for (exp = exp_features; *exp; exp++) {
+ const char *t = features;
+ size_t elen = strlen(*exp);
+ int match = 0;
+
+ while ((t = strstr(t, *exp))) {
+ if (t[elen] == ',' || t[elen] == '\0') {
+ match = 1;
+ break;
+ }
+ t += elen;
+ }
+
+ if (match)
+ continue;
+
+ fprintf(stderr, "ERROR: feature %s not found\n", *exp);
+ missing++;
+ }
+
+ if (rd_kafka_conf_set(conf, "security.protocol", "SASL_SSL", errstr,
+ sizeof(errstr)) ||
+ rd_kafka_conf_set(conf, "sasl.mechanism", "PLAIN", errstr,
+ sizeof(errstr)) ||
+ rd_kafka_conf_set(conf, "sasl.username", "username", errstr,
+ sizeof(errstr)) ||
+ rd_kafka_conf_set(conf, "sasl.password", "password", errstr,
+ sizeof(errstr)) ||
+ rd_kafka_conf_set(conf, "debug", "security", errstr,
+ sizeof(errstr))) {
+ fprintf(stderr, "conf_set failed: %s\n", errstr);
+ return 1;
+ }
+
+ rk = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errstr, sizeof(errstr));
+ if (!rk) {
+ fprintf(stderr, "rd_kafka_new failed: %s\n", errstr);
+ return 1;
+ }
+
+ printf("client name %s\n", rd_kafka_name(rk));
+
+ rd_kafka_destroy(rk);
+
+ return missing ? 1 : 0;
+}
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.cpp b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.cpp
new file mode 100644
index 000000000..d78a76710
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/packaging/rpm/tests/test.cpp
@@ -0,0 +1,34 @@
+#include <iostream>
+#include <librdkafka/rdkafkacpp.h>
+
+
+int main() {
+ std::cout << "librdkafka++ " << RdKafka::version_str() << std::endl;
+
+ RdKafka::Conf *conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);
+
+ std::string features;
+
+ if (conf->get("builtin.features", features) != RdKafka::Conf::CONF_OK) {
+ std::cerr << "conf_get failed" << std::endl;
+ return 1;
+ }
+
+ std::cout << "builtin.features " << features << std::endl;
+
+ std::string errstr;
+ RdKafka::Producer *producer = RdKafka::Producer::create(conf, errstr);
+ if (!producer) {
+ std::cerr << "Producer::create failed: " << errstr << std::endl;
+ return 1;
+ }
+
+ delete conf;
+
+ std::cout << "client name " << producer->name() << std::endl;
+
+
+ delete producer;
+
+ return 0;
+}