-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlnx_build.sh
executable file
·174 lines (154 loc) · 4.17 KB
/
lnx_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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# ------------------------------------------------------
# SET THE FOLDER where repositories are
# if your downloaded in /home/allaptop/dev/cryptochat2
# then FOLDER="/home/allaptop/dev"
#
# Using sudo apt - You may need to change it for your distro
# ------------------------------------------------------
FOLDER="/home/allaptop/dev"
if [ -d "${FOLDER}" ]; then
echo "Using directory ${FOLDER}"
else
echo "Directory not set"
exit
fi
function install_pkg()
{
status="$(dpkg-query -W --showformat='${db:Status-Status}' "$1" 2>&1)"
if [ ! $? = 0 ] || [ ! "$status" = installed ]
then
sudo apt -y install $1
else
echo "$1 is already installed"
fi
}
function remove_pkg()
{
status="$(dpkg-query -W --showformat='${db:Status-Status}' "$1" 2>&1)"
if [ ! $? = 0 ] || [ ! "$status" = installed ]
then
echo "$1 is not installed"
else
sudo apt -y remove --auto-remove $1
sudo apt -y purge --auto-remove $1
fi
}
function git_clone()
{
if [ -d "$2" ]; then
echo "Directory already exist $2 ..."
else
mkdir $2
git clone $1 $2
fi
}
# MANUAL
#sudo apt update
#sudo apt upgrade
install_pkg g++
install_pkg build-essential
install_pkg aptitude
install_pkg ccache
install_pkg libgmp-dev
install_pkg libcurl4-gnutls-dev
install_pkg cmake
install_pkg git
install_pkg libsfml-dev
install_pkg libopencv-dev
install_pkg ffmpeg
# notcurses
install_pkg doctest-dev
install_pkg libavdevice-dev
install_pkg libdeflate-dev
install_pkg libgpm-dev
install_pkg libncurses-dev
install_pkg libqrcodegen-dev
install_pkg libswscale-dev
install_pkg libunistring-dev
install_pkg pandoc
install_pkg pkg-config
git_clone https://github.com/alanthie/notcurses.git "${FOLDER}/notcurses"
cd "${FOLDER}/notcurses"
if [ -d "${FOLDER}/notcurses/build" ]; then
echo "Directory already exist ${FOLDER}/notcurses/build ..."
cd "${FOLDER}/notcurses/build"
make
# TODO - detect change in lib...
# sudo make install
else
mkdir build
cd build
cmake ..
make
sudo make install
fi
git_clone https://github.com/ckormanyos/wide-integer.git "${FOLDER}/wide-integer"
git_clone https://github.com/ckormanyos/wide-decimal.git "${FOLDER}/wide-decimal"
git_clone https://github.com/libevent/libevent.git "${FOLDER}/libevent"
cd "${FOLDER}/libevent"
if [ -d "${FOLDER}/libevent/build" ]; then
echo "Directory already exist ${FOLDER}/libevent/build ..."
cd "${FOLDER}/libevent/build"
make
else
mkdir build
cd build
cmake ..
make
fi
#copy event-config.h from build to event2 folder if missing
#From /home/alain/dev/libevent/build/include/event2/event-config.h
# /home/alain/dev/libevent/include/event2/
if [ -f "${FOLDER}/libevent/include/event2/event-config.h" ]; then
echo "File already exist ${FOLDER}/libevent/include/event2/event-config.h..."
# TODO - detect change in file...
# cp "${FOLDER}/libevent/build/include/event2/event-config.h" "${FOLDER}/libevent/include/event2/"
else
cp "${FOLDER}/libevent/build/include/event2/event-config.h" "${FOLDER}/libevent/include/event2/"
fi
# ------------------------------------------------------
# cryptochat2
# ------------------------------------------------------
# git_clone https://github.com/alanthie/cryptochat2.git "${FOLDER}/cryptochat2"
cd "${FOLDER}/cryptochat2"
if [ -d "${FOLDER}/cryptochat2/build" ]; then
echo "Directory already exist ${FOLDER}/cryptochat2/build ..."
cd "${FOLDER}/cryptochat2/build"
cmake ..
make
else
mkdir build
cd build
cmake ..
make
fi
#exit
# ------------------------------------------------------
# EXTRA - remove previous exit if want this tool
# Encryptions
# ------------------------------------------------------
git_clone https://github.com/libntl/ntl.git "${FOLDER}/ntl"
cd "${FOLDER}/ntl/src"
if [ -f "${FOLDER}/ntl/src/ntl.a" ]; then
echo "Lib already exist ${FOLDER}/ntl/src/ntl.a ..."
cd "${FOLDER}/ntl/src"
make
# TODO - detect change in lib...
# sudo make install
else
./configure
make
sudo make install
fi
git_clone https://github.com/alanthie/Encryptions.git "${FOLDER}/Encryptions"
cd "${FOLDER}/Encryptions"
if [ -d "${FOLDER}/Encryptions/build" ]; then
echo "Directory already exist ${FOLDER}/Encryptions/build ..."
cd "${FOLDER}/Encryptions/build"
make
else
mkdir build
cd build
cmake ..
make
fi