-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·46 lines (34 loc) · 982 Bytes
/
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
#!/usr/bin/env bash
set -e
# Modified from TimescaleDB Source
# (https://www.timescale.com)
# Any flags will be passed on to CMake, e.g.,
# ./bootstrap -DCMAKE_BUILD_TYPE="Debug"
BUILD_DIR=${BUILD_DIR:-./build}
BUILD_FORCE_REMOVE=${BUILD_FORCE_REMOVE:-false}
SRC_DIR=$(dirname $0)
if [[ ! ${SRC_DIR} == /* ]]; then
SRC_DIR=$(pwd)/${SRC_DIR}
fi
if [ ${BUILD_FORCE_REMOVE} == "true" ]; then
rm -fr ${BUILD_DIR}
elif [ -d ${BUILD_DIR} ]; then
echo "Build system already initialized in ${BUILD_DIR}"
read -n 1 -p "Do you want to remove it (this is IMMEDIATE and PERMANENT), y/n? " choice
echo ""
if [ $choice == "y" ]; then
rm -fr ${BUILD_DIR}
else
exit
fi
fi
set -e
set -u
mkdir -p ${BUILD_DIR} && \
cd ${BUILD_DIR} && \
cmake ${SRC_DIR} "$@"
echo -n "build system initialized in ${BUILD_DIR}. To compile, doing:"
echo -e "\033[1mcd ${BUILD_DIR} && make\033[0m"
make install
cd ..
#cd ./$BUILD_DIR/ && make && cd ..