forked from confluentinc/confluent-kafka-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-librdkafka.sh
executable file
·52 lines (40 loc) · 974 Bytes
/
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
#!/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/edenhill/librdkafka/archive/${VERSION}.tar.gz" | \
tar -xz --strip-components=1 -f -
./configure --clean
make clean
./configure --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
if [[ $INSTALLDIR == /usr && $(whoami) != root ]]; then
sudo make install
else
make install
fi
popd