forked from confluentinc/librdkafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-manylinux.sh
executable file
·63 lines (45 loc) · 1.33 KB
/
build-manylinux.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
58
59
60
61
62
63
#!/bin/bash
#
# Build on a manylinux (https://github.com/pypa/manylinux) docker container.
#
# This will provide a self-contained librdkafka shared library that works
# on most glibc-based Linuxes.
#
# Statically linked
# WITH openssl 1.1.1, zlib, lz4(bundled)
# WITHOUT libsasl2
#
#
# Run:
# docker run -t -v "$PWD:/v quay.io/pypa/manylinux2010_x86_64 /v/packaging/tools/build-manylinux.sh /v /v/artifacts/librdkafka-manylinux2010_x86_64.tgz $config_args"
set -ex
LRK_DIR=$1
shift
OUT_TGZ=$1
shift
CONFIG_ARGS=$*
if [[ ! -f $LRK_DIR/configure.self || -z $OUT_TGZ ]]; then
echo "Usage: $0 <librdkafka-root-direcotry> <output-tgz> [<configure-args..>]"
exit 1
fi
set -u
yum install -y libstdc++-devel gcc gcc-c++ python34
# Copy the librdkafka git archive to a new location to avoid messing
# up the librdkafka working directory.
BUILD_DIR=$(mktemp -d)
pushd $BUILD_DIR
DEST_DIR=$PWD/dest
mkdir -p $DEST_DIR
(cd $LRK_DIR ; git archive --format tar HEAD) | tar xf -
./configure --install-deps --source-deps-only --disable-gssapi --disable-lz4-ext --enable-static --prefix=$DEST_DIR $CONFIG_ARGS
make -j
examples/rdkafka_example -X builtin.features
CI=true make -C tests run_local_quick
make install
# Tar up the output directory
pushd $DEST_DIR
ldd lib/*.so.1
tar cvzf $OUT_TGZ .
popd # $DEST_DIR
popd # $BUILD_DIR
rm -rf "$BUILD_DIR"