ledisdb/tools/build_leveldb.sh

50 lines
1.4 KiB
Bash
Raw Permalink Normal View History

2014-05-09 10:49:22 +04:00
#!/bin/bash
SNAPPY_DIR=/usr/local/snappy
LEVELDB_DIR=/usr/local/leveldb
2014-05-14 05:20:45 +04:00
ROOT_DIR=$(pwd)
2014-05-09 10:49:22 +04:00
2017-11-27 03:51:18 +03:00
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2014-05-14 05:20:45 +04:00
BUILD_DIR=/tmp/build_leveldb
mkdir -p $BUILD_DIR
cd $BUILD_DIR
2014-05-09 10:49:22 +04:00
if [ ! -f $SNAPPY_DIR/lib/libsnappy.a ]; then
(git clone https://github.com/siddontang/snappy.git ; \
2014-05-09 10:49:22 +04:00
cd ./snappy && \
2014-05-14 13:56:01 +04:00
autoreconf --force --install && \
2014-05-09 10:49:22 +04:00
./configure --prefix=$SNAPPY_DIR && \
make && \
2014-05-14 05:20:45 +04:00
make install && \
cd ..)
2014-05-09 10:49:22 +04:00
else
echo "skip install snappy"
fi
2014-05-14 05:20:45 +04:00
cd $BUILD_DIR
2014-05-09 10:49:22 +04:00
if [ ! -f $LEVELDB_DIR/lib/libleveldb.a ]; then
2017-11-27 03:51:18 +03:00
(git clone git@github.com:google/leveldb.git ; \
2014-05-09 10:49:22 +04:00
cd ./leveldb && \
2017-11-27 03:51:18 +03:00
git checkout 47cb9e2a211e1d7157078ba7bab536beb29e56dc && \
patch -p0 < $SCRIPT_DIR/leveldb.patch
2014-05-09 10:49:22 +04:00
echo "echo \"PLATFORM_CFLAGS+=-I$SNAPPY_DIR/include\" >> build_config.mk" >> build_detect_platform &&
echo "echo \"PLATFORM_CXXFLAGS+=-I$SNAPPY_DIR/include\" >> build_config.mk" >> build_detect_platform &&
echo "echo \"PLATFORM_LDFLAGS+=-L $SNAPPY_DIR/lib -lsnappy\" >> build_config.mk" >> build_detect_platform &&
2017-11-27 03:51:18 +03:00
make HAVE_SNAPPY=1 && \
2014-05-09 10:49:22 +04:00
make && \
mkdir -p $LEVELDB_DIR/include/leveldb && \
install include/leveldb/*.h $LEVELDB_DIR/include/leveldb && \
mkdir -p $LEVELDB_DIR/lib && \
2014-05-14 05:20:45 +04:00
cp -f libleveldb.* $LEVELDB_DIR/lib &&\
cd ..)
2014-05-09 10:49:22 +04:00
else
echo "skip install leveldb"
2014-05-14 05:20:45 +04:00
fi
cd $ROOT_DIR