forked from yfinkelstein/node-zookeeper
-
Notifications
You must be signed in to change notification settings - Fork 5
/
libzk-build.sh
executable file
·58 lines (51 loc) · 1.3 KB
/
libzk-build.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
#!/bin/bash
set -o xtrace
ROOT=`pwd`
BUILD=$ROOT/build/zk
BUILD_TMP=$BUILD/tmp
PLATFORM=`uname`
ZK=zookeeper-3.4.4
ZK_FILE=/$BUILD_TMP/$ZK.tar.gz
ZK_URL=https://github.com/yunong/zookeeper/archive/3.4.4.tar.gz
mkdir -p $BUILD_TMP
if [ ! -e "$ZK_FILE" ] ; then
echo "Downloading $ZK from $ZK_URL"
# Tries wget, then curl to download zookeeper
wget --no-check-certificate $ZK_URL -O $ZK_FILE 2>/dev/null || curl -k -o $ZK_FILE $ZK_URL 2>/dev/null || {
echo >&2 "Unable to download zookeeper library. (Neither wget nor curl is installed)"; exit 1;
}
fi
cd $BUILD_TMP
tar -zxf $ZK_FILE
cd $ZK
tar -zxf $ZK.tar.gz
cd $ZK/src/c
if [ "$PLATFORM" != "SunOS" ]; then
./configure \
--without-syncapi \
--enable-static \
--disable-shared \
--with-pic \
--prefix=$BUILD && \
make && \
make install
if [ $? != 0 ] ; then
echo "Unable to build zookeeper library"
exit 1
fi
cd $ROOT
rm -rf $BUILD_TMP
else
./configure \
LIBS="-lnsl -lsocket" \
CPPFLAGS="-D_POSIX_PTHREAD_SEMANTICS" \
--prefix=$BUILD && \
make && \
make install
if [ $? != 0 ] ; then
echo "Unable to build zookeeper library"
exit 1
fi
cd $ROOT
rm -rf $BUILD_TMP
fi