forked from utsaslab/leveldbjni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·51 lines (41 loc) · 1.42 KB
/
setup.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
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
#set -o xtrace
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
# Check existance of pebblesdb includes
INCLUDE_PEBBLESDB="${PEBBLESDB_HOME}/src/include"
if [ ! -e "$INCLUDE_PEBBLESDB" ]; then
echo "${PEBBLESDB_HOME}/src/include does not exist"
exit 1
fi
# Check existance of pebblesdb library
LIB_PEBBLESDB="${PEBBLESDB_HOME}/build/libpebblesdb.a"
if [ ! -e "$LIB_PEBBLESDB" ]; then
echo "${PEBBLESDB_HOME}/build/libpebblesdb.a does not exist"
exit 2
fi
# Create a local pebblesdb directory to store includes and library.
PEBBLESDB_LOCAL_DIR="${__dir}/pebblesdb"
if [ -e ${PEBBLESDB_LOCAL_DIR} ]; then
cd ${PEBBLESDB_LOCAL_DIR?} && rm -rf --preserve-root *
fi
[[ -d ${PEBBLESDB_LOCAL_DIR} ]] || mkdir ${PEBBLESDB_LOCAL_DIR}
cp ${LIB_PEBBLESDB} ${PEBBLESDB_LOCAL_DIR}
cp -r ${INCLUDE_PEBBLESDB} ${PEBBLESDB_LOCAL_DIR}
if [ -e "${PEBBLESDB_LOCAL_DIR}/include/pebblesdb" ]; then
mv "${PEBBLESDB_LOCAL_DIR}/include/pebblesdb" "${PEBBLESDB_LOCAL_DIR}/include/leveldb"
else
echo "${PEBBLESDB_LOCAL_DIR}/include/pebblesdb does not exist"
exit 3
fi
if [ -e "${PEBBLESDB_LOCAL_DIR}/libpebblesdb.a" ]; then
mv "${PEBBLESDB_LOCAL_DIR}/libpebblesdb.a" "${PEBBLESDB_LOCAL_DIR}/libleveldb.a"
else
echo "${PEBBLESDB_LOCAL_DIR}/include/pebblesdb does not exist"
exit 4
fi
echo "DONE"
exit 0