-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·102 lines (94 loc) · 2.48 KB
/
deploy.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/bash
# The below content is third-party library download address
boost_version="boost_1_85_0"
boost_1_85_0="https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.gz"
glog="[email protected]:google/glog.git"
sqlite3="[email protected]:SRombauts/SQLiteCpp.git"
json="[email protected]:nlohmann/json.git"
ftxui="[email protected]:ArthurSonzogni/FTXUI.git"
absl="[email protected]:abseil/abseil-cpp.git"
# directory
## you need add vchat environment variable to specify the download directory
project_dir=$vchat
install_dir=$project_dir/lib
target_dir=$project_dir/libs
# check install environment
# the commands which is needed to use
commands=("wget" "git" "cmake" "make" "tar")
check_env() {
echo "check command..."
for item in ${commands[@]}; do
if ! command -v $item >/dev/null 2>&1; then
echo "$item not exist"
echo "please get $item commnad and try again"
exit 0
fi
done
echo "check pass"
echo "check environment..."
if [ -z $vchat ]; then
echo "vchat environment not exist"
echo "please add 'vchat' environment variable"
fi
echo "check pass"
}
# install all library
install() {
choice=
echo "Install all libs"
echo "Type y/n to continue"
read choice
if [ "$choice" = "y" ]; then
mkdir "$install_dir"
cd "$install_dir" && wget --proxy=on "$boost_1_85_0" && tar -xzvf "$boost_version".tar.gz
cd "$install_dir" && \
git clone "$glog" && git clone "$sqlite3" && \
git clone "$json" && git clone "$ftxui"
else
echo "Cancel install"
exit 0
fi
}
# compile each library
compile_item() {
echo "Start compile $1"
cd $target_dir && mkdir "$1"
cd $install_dir/$1 && mkdir build && \
cd build && cmake -DCMAKE_INSTALL_PREFIX=$target_dir/$1 .. && \
make -j8 && make install
echo "Compile $1 finish"
}
# compile all library
compile() {
choice=
echo "Compile all third-party libraries"
echo "Type y/n to continue"
read choice
if [ "$choice" = "y" ]; then
mkdir $target_dir
compile_item glog
compile_item absl
compile_item SQLiteCpp
compile_item json
compile_item FTXUI
mkdir $target_dir/$boost_version
cd $install_dir/$boost_version && ./bootstrap.sh && \
./b2 install --prefix=$target_dir/$boost_version
else
echo "Cancel compile"
exit 0
fi
}
main() {
check_env
install
compile
choice=
echo "Compile finish, do you want to remove all install directory"
echo "Type y/n to continue"
read choice
if [ "$choice" = "y" ]; then
rm -rf "$install_dir"
fi
}
main