-
Notifications
You must be signed in to change notification settings - Fork 3
/
requirements.apt
112 lines (107 loc) · 3.99 KB
/
requirements.apt
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
#!/bin/bash
function install_apt_deps()
{
echo "-- Do you have sudo rights ?"
read is_sudo
if [[ $is_sudo == "y" || $is_sudo == "Y" || $is_sudo == "yes" || $is_sudo == "Yes" || $is_sudo == "YES" ]]
then
echo "-- Select python version to install. [Default]: python3.8"
read python_version
if [[ $python_version == "" ]]
then
python_version="python3.8"
elif [[ $python_version != "python3.8" ]]
then
echo "-- $python_version not supported. Exiting..."
exit
else
echo "-- Selected $python_version"
fi
echo "-- Installing all apt dependencies"
sudo apt-get update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y \
build-essential \
ca-certificates \
curl \
cmake \
wget \
gcc \
g++ \
flex \
nasm \
tar \
m4 \
ocl-icd-opencl-dev \
opencl-c-headers \
protobuf-compiler \
pkg-config \
$python_version \
$python_version-dev \
$python_version-venv \
python3-distutils \
python3-numpy \
pv \
zlib1g-dev \
lib32ncurses5-dev \
libexempi-dev \
libmpc-dev \
libboost-all-dev \
mysql-server \
libmysqlclient-dev \
libsqlite3-dev
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
$python_version /tmp/get-pip.py
else
# echo "-- The existence of gcc >= 7 will be checked. If not found, gcc-9 will be installed from source."
echo "-- You have no sudo rights, which means the following things:"
echo "-- You better have a modern version of gcc (gcc >= 7 definitely works, 6 should work, 5 could work, =< 4 will NOT work."
echo "-- This script could install gcc from source, but will not. The complexity would rise significantly and weird dependencies would come up (installing gcc from source needs cmake, but cmake will be updated in the next step, if version >= 3.13 is not found."
echo "-- If you do not have have gcc >= 6, it means your machine has not been updated since April 27, 2016 (https://www.gnu.org/software/gcc/gcc-6/)."
echo -e " In this case, \e[4m$(tput bold)failure to build this project is not my concern!$(tput sgr0)\e[0m"
echo "-- python3.8 and protobuf compiler CAN be installed from source during cmake phase. If you desire this, all you need to do is run cmake with -DBUILD_FROM_SOURCE=ON flag."
echo "-- If any of the remaining packages are missing and the building process crashes"
echo -e " \e[4m$(tput bold)It is not of my concern!$(tput sgr0)\e[0m"
echo "-- "
echo "-- "
echo "-- "
echo "-- TLDR; Ask your admin for gcc >= 7 (6 should be ok too) or install from source. Fear not about python3.8 and protobuf compiler; will be installed from source during cmake process. If anything crashes or command not found, ask your admin to install the apt packages included in this script."
echo "-- Press any key to continue."
read $hit_continue
fi
}
function check_cmake()
{
if (echo base version 3.13; cmake --version) | head -2 | sort -Vk3 | tail -1 | grep -q cmake
then
echo "-- Up to date CMake found in $(which cmake)"
else
echo "-- Installing CMake from source..."
echo "-- Specify binary path for cmake. CMake will install /bin, /lib, /shared folders in the specified folder."
echo "-- For that reason, make sure that:"
echo " A) You specify the parent of a bin folder, e.g. (/usr/ instead of /usr/bin/)"
echo " B) The specified folder is in your \$PATH"
read path
cmake_bin=$(realpath $path)
echo "-- Installation folder: $cmake_bin"
mkdir -p $cmake_bin
cpwd=$(pwd)
cd /tmp
wget https://cmake.org/files/v3.13/cmake-3.13.4.tar.gz
tar -xvf cmake-3.13.4.tar.gz
cd cmake-3.13.4
./bootstrap --prefix=${cmake_bin}
make -j $(nproc)
make install
cd ..
cmake --version
rm cmake-3.13.4.tar.gz
rm -rf cmake-3.13.4
cd $cpwd
echo "-- CMake installed successfully"
fi
}
check_cmake
install_apt_deps