forked from ideawu/ssdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·71 lines (61 loc) · 2.12 KB
/
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
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
BASE_DIR=`pwd`
ROCKSDB_PATH="$BASE_DIR/deps/terarkdb"
# dependency check
which autoconf > /dev/null 2>&1
if [ "$?" -ne 0 ]; then
echo ""
echo "ERROR! autoconf required! install autoconf first"
echo ""
exit 1
fi
if test -z "$TARGET_OS"; then
TARGET_OS=`uname -s`
fi
if test -z "$MAKE"; then
MAKE=make
fi
if test -z "$CC"; then
CC=gcc
fi
if test -z "$CXX"; then
CXX=g++
fi
case "$TARGET_OS" in
Linux)
PLATFORM_CLIBS="-pthread -lgcc -lrt -ldl -ltbb -laio -lgomp"
;;
*)
echo "Unknown platform!" >&2
exit 1
esac
DIR=`pwd`
cd "$DIR"
rm -f src/version.h
echo "#ifndef SSDB_DEPS_H" >> src/version.h
echo "#ifndef SSDB_VERSION" >> src/version.h
echo "#define SSDB_VERSION \"`cat version`\"" >> src/version.h
echo "#endif" >> src/version.h
echo "#endif" >> src/version.h
echo "#include <stdlib.h>" >> src/version.h
rm -f build_config.mk
echo CC=$CC >> build_config.mk
echo CXX=$CXX >> build_config.mk
echo "MAKE=$MAKE" >> build_config.mk
echo "ROCKSDB_PATH=$ROCKSDB_PATH" >> build_config.mk
echo "CFLAGS = -std=c++14 -DNDEBUG -D__STDC_FORMAT_MACROS -Wall -O3 -Wno-sign-compare" >> build_config.mk
echo "CFLAGS += ${PLATFORM_CFLAGS}" >> build_config.mk
echo "CFLAGS += -I \"$ROCKSDB_PATH/output/include\"" >> build_config.mk
echo "CFLAGS += -I \"$ROCKSDB_PATH/third-party/terark-zip/src\"" >> build_config.mk
echo "CFLAGS += -I \"$ROCKSDB_PATH\"" >> build_config.mk
echo "CLIBS=" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libterarkdb.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libterark-zip-r.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libboost_fiber.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libboost_context.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libjemalloc.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libsnappy.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/liblz4.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libz.a" >> build_config.mk
echo "CLIBS += $ROCKSDB_PATH/output/lib/libbz2.a" >> build_config.mk
echo "CLIBS += ${PLATFORM_CLIBS}" >> build_config.mk