-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
238 lines (196 loc) · 5.85 KB
/
setup.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/bin/sh
# set -e
PREFIX=$HOME/.local
TEMP_DIR=$HOME/tmp
export PATH=$PREFIX/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib:$PREFIX/lib64:$PREFIX/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/usr/lib64:/usr/lib:$PREFIX/lib64:$PREFIX/lib:$LIBRARY_PATH
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export C_INCLUDE_PATH=$PREFIX/include
mkdir -p $TEMP_DIR $PREFIX/bin
pushd $TEMP_DIR > /dev/null
clear
echo ""
echo "-------------------------------------------"
CONDA_DIR=$HOME/.miniconda
if [ ! -d $CONDA_DIR ];
then
echo "Installing Miniconda..."
curl -sLO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# -b flag runs installer in batch mode without user interaction
bash Miniconda3-latest-Linux-x86_64.sh -b -p $CONDA_DIR
rm -f Miniconda3-latest-Linux-x86_64.sh
else
echo "Miniconda is already installed."
fi
# init adds to your shell config file, adding conda"s dir to env variables
if ! command -v conda > /dev/null
then
$CONDA_DIR/bin/conda init bash
$CONDA_DIR/bin/conda config --set auto_activate_base false
$CONDA_DIR/bin/conda config --add channels conda-forge
$CONDA_DIR/bin/conda create -y -n $USER python=3.9 c-compiler cxx-compiler
popd > /dev/null
rm -rf $TEMP_DIR
echo "Conda initialized ~/.bashrc. Restart shell and run script again."
set +e
return 0
fi
conda activate $USER
conda --version
echo "-------------------------------------------"
echo ""
echo "-------------------------------------------"
if ! command -v ninja > /dev/null
then
echo "Installing Ninja..."
curl -sLO https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip
unzip ninja-linux.zip > /dev/null
mv ninja $PREFIX/bin/ninja
rm -rf ninja*
else
echo "Ninja is already installed."
fi
echo "ninja version: $(ninja --version)"
echo "-------------------------------------------"
echo ""
echo "-------------------------------------------"
if ! command -v stow > /dev/null
then
echo "Installing stow..."
curl -sLO https://ftp.gnu.org/gnu/stow/stow-2.3.1.tar.gz
tar xf stow-2.3.1.tar.gz
pushd stow-2.3.1 > /dev/null
./configure --prefix=$PREFIX > /dev/null
make -j > /dev/null
make install > /dev/null
popd > /dev/null
rm -rf stow*
else
echo "stow is already installed."
fi
stow --version
echo "-------------------------------------------"
# clear
echo ""
echo "-------------------------------------------"
if ! cmake --version | grep 3.24 > /dev/null
then
echo "Installing CMake..."
conda install -qy cmake
curl -sLO https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1.tar.gz
tar xf cmake-3.24.1.tar.gz
pushd cmake-3.24.1 > /dev/null
cmake . -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_USE_OPENSSL=ON > /dev/null
make -j
make install > /dev/null
popd > /dev/null
rm -rf cmake*
conda remove -qy cmake
else
echo "CMake is already installed."
fi
cmake --version | head -n 1
echo "-------------------------------------------"
clear
echo ""
echo "-------------------------------------------"
if [ ! -d $PREFIX/openssl ];
then
echo "Installing OpenSSL..."
curl -sLO https://www.openssl.org/source/openssl-1.1.1q.tar.gz
tar xf openssl-1.1.1q.tar.gz
pushd openssl-1.1.1q > /dev/null
./Configure --prefix=$PREFIX --openssldir=$PREFIX/openssl shared linux-x86_64 > /dev/null
make -j > /dev/null
make install > /dev/null
popd > /dev/null
rm -rf openssl*
else
echo "OpenSSL is already installed."
fi
openssl version
echo "-------------------------------------------"
# clear
echo ""
echo "-------------------------------------------"
if ! curl -V | grep 7.85 > /dev/null
then
echo "Installing curl..."
curl -sLO https://curl.se/download/curl-7.85.0.tar.gz
tar xf curl-7.85.0.tar.gz
pushd curl-7.85.0 > /dev/null
./configure --prefix=$PREFIX --with-openssl > /dev/null
make -j > /dev/null
make install > /dev/null
popd > /dev/null
rm -rf curl*
else
echo "curl is already installed."
fi
curl -V | head -n 1
echo "-------------------------------------------"
# clear
# echo ""
# echo "-------------------------------------------"
# if ! git --version | grep 2.37 > /dev/null
# then
# # conda install -qy zlib
# echo "Installing git..."
# curl -sLO https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.3.tar.gz
# tar xf git-2.37.3.tar.gz
# pushd git-2.37.3 > /dev/null
# ./configure --prefix=$PREFIX > /dev/null
# make -j > /dev/null
# make install > /dev/null
# popd > /dev/null
# rm -rf git*
# # conda remove -qy zlib
# else
# echo "git is already installed."
# fi
# git --version
# echo "-------------------------------------------"
# clear
echo ""
echo "-------------------------------------------"
if ! command -v nvim > /dev/null
then
echo "Installing Neovim..."
curl -sLO https://github.com/neovim/neovim/archive/refs/tags/v0.7.2.tar.gz
tar xf v0.7.2.tar.gz
pushd neovim-0.7.2 > /dev/null
make CMAKE_BUILD_TYPE=Release CMAKE_INSTALL_PREFIX=$PREFIX > /dev/null
make install > /dev/null
popd > /dev/null
rm -rf neovim*
else
echo "Neovim is already installed."
fi
nvim --version | head -n 1
echo "-------------------------------------------"
# # clear
# echo ""
# echo "-------------------------------------------"
# if ! command -v zsh > /dev/null
# then
# echo "Installing zsh..."
# curl -sLO https://www.zsh.org/pub/zsh-5.9.tar.xz
# tar xf zsh-5.9.tar.xz
# pushd zsh-5.9 > /dev/null
# ./configure --prefix=$PREFIX > /dev/null
# make -j > /dev/null
# make install > /dev/null
# popd > /dev/null
# rm -rf zsh*
# else
# echo "zsh is already installed."
# fi
# zsh --version
# echo "-------------------------------------------"
popd > /dev/null
rm -rf $TEMP_DIR
conda deactivate
echo ""
set +e
# TODO: REMIND USER TO ADD EXPORTS TO BASHRC