-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·72 lines (56 loc) · 1.7 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
72
#!/usr/bin/sudo bash
function start_spinner {
set +m
printf "%-36s" " $1 "
{ while : ; do for X in ' • ' ' • ' ' • ' ' • ' ' • ' ' • ' ' • ' ' • ' ' • ' ' • ' ; do echo -en "\b\b\b\b\b\b\b\b$X" ; sleep 0.1 ; done ; done & } 2>/dev/null
spinner_pid=$!
}
function stop_spinner {
{ kill -9 $spinner_pid && wait; } 2>/dev/null
set -m
echo -en "\033[2K\r"
}
function handle_error {
stop_spinner
echo -e "\nError: $1"
exit 1
}
trap stop_spinner EXIT
spinner_pid=
printf "Building dime... This may take a while."
# Install dependencies
printf "\n"
start_spinner "Installing dependencies:"
(
apt update \
&& apt install -y --no-install-recommends \
git \
build-essential \
libsuitesparse-dev \
libopenblas-dev \
libjansson-dev \
libssl-dev \
zlib1g-dev \
libev-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
) &> /dev/null
if [ $? -ne 0 ]; then
handle_error "Failed to install dependencies."
fi
python3 -m pip install --upgrade pip setuptools wheel &> /dev/null
if [ $? -ne 0 ]; then
handle_error "Failed to install dependencies."
fi
stop_spinner
echo " Installing dependencies: ✓"
# Build dime
start_spinner "Building dime:"
(cd server && make && make install) &> /dev/null
if [ $? -ne 0 ]; then
handle_error "Failed to build dime server."
fi
(cd client/python && python3 setup.py install) &> /dev/null
stop_spinner
echo " Building dime: ✓"
printf "\nBuild process completed successfully! \n\nYou can now run the server from the terminal with 'dime -vv -l unix:/tmp/dime2 -l ws:8818'.\n\n"