-
Notifications
You must be signed in to change notification settings - Fork 176
/
build_deps.sh
executable file
·78 lines (59 loc) · 2.21 KB
/
build_deps.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
# /bin/sh on Solaris is not a POSIX compatible shell, but /usr/bin/ksh is.
if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
POSIX_SHELL="true"
export POSIX_SHELL
exec /usr/bin/ksh $0 $@
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well
LEVELDB_VSN="fbe66f44e9abeb4f2de3c89d91573b7879226e6c" # June 25 merge w/ mv-write-throttle2
# June 29 merge w/ mv-compress-msg for
# compression LOG fix
SNAPPY_VSN="1.0.4"
set -e
if [ `basename $PWD` != "c_src" ]; then
# originally "pushd c_src" of bash
# but no need to use directory stack push here
cd c_src
fi
BASEDIR="$PWD"
# detecting gmake and if exists use it
# if not use make
# (code from github.com/tuncer/re2/c_src/build_deps.sh
which gmake 1>/dev/null 2>/dev/null && MAKE=gmake
MAKE=${MAKE:-make}
# Changed "make" to $MAKE
case "$1" in
clean)
rm -rf leveldb system snappy-$SNAPPY_VSN
;;
test)
export CFLAGS="$CFLAGS -I $BASEDIR/system/include"
export CXXFLAGS="$CXXFLAGS -I $BASEDIR/system/include"
export LDFLAGS="$LDFLAGS -L$BASEDIR/system/lib"
export LD_LIBRARY_PATH="$BASEDIR/system/lib:$LD_LIBRARY_PATH"
(cd leveldb && $MAKE check)
;;
get-deps)
if [ ! -d leveldb ]; then
git clone git://github.com/basho/leveldb
(cd leveldb && git checkout $LEVELDB_VSN)
fi
;;
*)
if [ ! -d snappy-$SNAPPY_VSN ]; then
tar -xzf snappy-$SNAPPY_VSN.tar.gz
(cd snappy-$SNAPPY_VSN && ./configure --prefix=$BASEDIR/system --with-pic)
fi
(cd snappy-$SNAPPY_VSN && $MAKE && $MAKE install)
export CFLAGS="$CFLAGS -I $BASEDIR/system/include"
export CXXFLAGS="$CXXFLAGS -I $BASEDIR/system/include"
export LDFLAGS="$LDFLAGS -L$BASEDIR/system/lib"
export LD_LIBRARY_PATH="$BASEDIR/system/lib:$LD_LIBRARY_PATH"
if [ ! -d leveldb ]; then
git clone git://github.com/basho/leveldb
(cd leveldb && git checkout $LEVELDB_VSN)
fi
(cd leveldb && $MAKE all)
;;
esac