-
Notifications
You must be signed in to change notification settings - Fork 899
/
bootstrap-librdkafka.sh
executable file
·58 lines (44 loc) · 1.14 KB
/
bootstrap-librdkafka.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
#
# Downloads, builds and installs librdkafka into <install-dir>
#
if [[ $1 == "--require-ssl" ]]; then
REQUIRE_SSL=1
shift
fi
VERSION=$1
INSTALLDIR=$2
BUILDDIR=$PWD/tmp-build
set -ex
set -o pipefail
if [[ -z "$VERSION" ]]; then
echo "Usage: $0 --require-ssl <librdkafka-version> [<install-dir>]" 1>&2
exit 1
fi
if [[ $INSTALLDIR != /* ]]; then
INSTALLDIR="$PWD/$INSTALLDIR"
fi
mkdir -p "$BUILDDIR/librdkafka"
pushd "$BUILDDIR/librdkafka"
test -f configure ||
curl -q -L "https://github.com/confluentinc/librdkafka/archive/refs/tags/${VERSION}.tar.gz" | \
tar -xz --strip-components=1 -f -
./configure --clean
make clean
if [[ $OSTYPE == "linux"* ]]; then
EXTRA_OPTS="--disable-gssapi"
fi
./configure --enable-static --install-deps --source-deps-only $EXTRA_OPTS --prefix="$INSTALLDIR"
if [[ $REQUIRE_SSL == 1 ]]; then
grep '^#define WITH_SSL 1$' config.h || \
(echo "ERROR: OpenSSL support required" ; cat config.log config.h ; exit 1)
fi
make -j
examples/rdkafka_example -X builtin.features
if [[ $INSTALLDIR == /usr && $(whoami) != root ]]; then
sudo make install
else
make install
fi
popd