install 16.3 KB
Newer Older
Pietro Incardona's avatar
Pietro Incardona committed
1
#! /bin/bash
Pietro Incardona's avatar
Pietro Incardona committed
2

Pietro Incardona's avatar
Pietro Incardona committed
3
4
5
6
7
source script/help
source script/discover_os
source script/show_solutions
source script/pre_req
source script/remove_old
8
source script/set_mpi
9
source script/conf_PETSC
Pietro Incardona's avatar
Pietro Incardona committed
10
source script/update_openfpm
11

Pietro Incardona's avatar
Pietro Incardona committed
12
13
14
15
16
### switch to the branch

b_switch=$(cat switch_branch)
if [ x"$b_switch" != x"" ]; then
        git checkout $b_switch
Pietro Incardona's avatar
Pietro Incardona committed
17
18
19
	rm switch_branch
	./install "$@"
	exit 0
Pietro Incardona's avatar
Pietro Incardona committed
20
21
fi

Pietro Incardona's avatar
Pietro Incardona committed
22
23
24
25
## Check that your home is not empty

if [ x"$HOME" == x"" ]; then
	 echo -e "Your $HOME folder is empty \033[91;5;1m FAILED \033[0m"
Pietro Incardona's avatar
Pietro Incardona committed
26
	 exit 1
Pietro Incardona's avatar
Pietro Incardona committed
27
28
fi

Pietro Incardona's avatar
Pietro Incardona committed
29
install_req=1
Pietro Incardona's avatar
Pietro Incardona committed
30
i_dir=""
Pietro Incardona's avatar
Pietro Incardona committed
31
sq=0
Pietro Incardona's avatar
Pietro Incardona committed
32
nomake=0
33
34
update_openfpm=0
upgrade_openfpm=0
Pietro Incardona's avatar
Pietro Incardona committed
35

36
while getopts :di:smhc:nu FLAG; do
Pietro Incardona's avatar
Pietro Incardona committed
37
	case $FLAG in
Pietro Incardona's avatar
Pietro Incardona committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	    d)
	      echo "Disable depencencies installation"
	      install_req=0
	      ;;
	    i)
	      echo "Setting dependencies installation dir: $OPTARG"
	      i_dir=$OPTARG
	      ;;
	    s)
	      echo "Skipping user cin"
	      sq=1
	      ;;
	    c)
	      echo "Fowarding options $OPTARG to configure script"
	      configure_options=$OPTARG
	      ;;
Pietro Incardona's avatar
Pietro Incardona committed
54
            m)
55
              echo "Skip to make the testing"
Pietro Incardona's avatar
Pietro Incardona committed
56
57
              nomake=1
              ;;
58
59
60
61
62
63
64
65
	    u)
	      echo "Updating openfpm"
	      update_openfpm=1
	      ;;
	    n)
              echo "Upgrading openfpm"
	      upgrade_openfpm=1
	      ;;
Pietro Incardona's avatar
Pietro Incardona committed
66
	    h)  #show help
Pietro Incardona's avatar
Pietro Incardona committed
67
68
69
70
71
      	      HELP
              ;;
    	    \?) #unrecognized option - are fowarded to configure
              ;;
	esac
Pietro Incardona's avatar
Pietro Incardona committed
72
73
done

Pietro Incardona's avatar
Pietro Incardona committed
74
75
76
77
78
### Configure options

i_dir_old=$i_dir
configure_options_old=$configure_options

incardon's avatar
incardon committed
79
80
discover_os

81
82
## Remove old dependencies and installations

Pietro Incardona's avatar
Pietro Incardona committed
83
if [ x"$i_dir" == x"" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
84
85
86
 i_dir="$HOME"
fi

Pietro Incardona's avatar
Pietro Incardona committed
87
88
89
## Check and try to install the prerequisites


90
91
92
93
94
95
if [ $update_openfpm -eq 1 -a  $upgrade_openfpm -eq 1 ]; then
	echo -e "\033[1;5;31m It is not possible to update and upgrade at the same time \033[0m"
	exit 1
fi

if [ $update_openfpm -eq 1 ]; then
96
	update_openfpm update
Pietro Incardona's avatar
Pietro Incardona committed
97
	exit 0
98
99
100
fi

if [ $upgrade_openfpm -eq 1 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
101
	update_openfpm upgrade
Pietro Incardona's avatar
Pietro Incardona committed
102
	exit 0
103
104
fi

Pietro Incardona's avatar
Pietro Incardona committed
105
106
107
108
109
110
remove_old $i_dir

## Check and try to install the prerequisites

pre_req

Pietro Incardona's avatar
Pietro Incardona committed
111
112
## clone the dependencies

Pietro Incardona's avatar
Pietro Incardona committed
113
git submodule init
Yaser Afshar's avatar
Yaser Afshar committed
114
115
116
117
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
Pietro Incardona's avatar
Pietro Incardona committed
118

Pietro Incardona's avatar
Pietro Incardona committed
119
git submodule update
Yaser Afshar's avatar
Yaser Afshar committed
120
121
122
123
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
Pietro Incardona's avatar
Pietro Incardona committed
124

Pietro Incardona's avatar
Pietro Incardona committed
125
126
127
128
129
130
#### Eventualy remove garbage from old installation

rm -rf openfpm_numerics/src/.deps
rm -rf src/.deps


131
132
133
# Create config directory in each submodule

cd openfpm_data
Pietro Incardona's avatar
Pietro Incardona committed
134
135
136
if [ ! -d src/config  ]; then
  mkdir src/config
fi
137
138
139
cd ..

cd openfpm_devices
Pietro Incardona's avatar
Pietro Incardona committed
140
141
142
if [ ! -d src/config  ]; then
  mkdir src/config
fi
143
144
145
cd ..

cd openfpm_vcluster
Pietro Incardona's avatar
Pietro Incardona committed
146
147
148
if [ ! -d src/config  ]; then
  mkdir src/config
fi
149
150
151
cd ..

cd openfpm_io
Pietro Incardona's avatar
Pietro Incardona committed
152
153
154
if [ ! -d src/config  ]; then
  mkdir src/config
fi
155
156
cd ..

incardon's avatar
incardon committed
157
158
159
160
161
162
cd openfpm_numerics
if [ ! -d src/config  ]; then
  mkdir src/config
fi
cd ..

Pietro Incardona's avatar
Pietro Incardona committed
163
# Create config directory
incardon's avatar
incardon committed
164

Pietro Incardona's avatar
Pietro Incardona committed
165
166
167
if [ ! -d src/config ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
168

Pietro Incardona's avatar
Pietro Incardona committed
169
## generate configure script
incardon's avatar
incardon committed
170

Pietro Incardona's avatar
Pietro Incardona committed
171
sh ./autogen.sh
Incardona Pietro's avatar
Incardona Pietro committed
172
173
174
175
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
176

Pietro Incardona's avatar
Pietro Incardona committed
177
## check for options
incardon's avatar
incardon committed
178
179
180
181

echo -e "\033[1;34;5mDEPENCENCIES INSTALLATION DIR      \033[0m"
echo -e "Every required dependencies if needed will be installed into: \033[1;34;5m$i_dir\033[0m"
echo -e "if you want to install somewhere else do ./install -i /somewhere/else"
Pietro Incardona's avatar
Pietro Incardona committed
182
183
184
185
if [ x"$configure_options" == x"" ]; then
    echo -e "OpenFPM will be installed into: \033[1;34;5m/usr/local\033[0m"
    echo "if you want to install in a different place use ./install -c \"--prefix=/where/you/want/to/install\""
fi
Pietro Incardona's avatar
Pietro Incardona committed
186
if [ $sq -eq 0 ]; then
187
  unset commands
Pietro Incardona's avatar
Pietro Incardona committed
188
189
190
  commands[0]="Continue"
  possible_solutions "${commands[@]}"
fi
incardon's avatar
incardon committed
191

Pietro Incardona's avatar
Pietro Incardona committed
192
ncore=4
Pietro Incardona's avatar
Pietro Incardona committed
193
echo -e "\033[1mHow many core you want to use to install the dependencies?\033[0m"
194
195
196
if [ $sq -eq 0 ]; then
  read ncore
fi
Pietro Incardona's avatar
Pietro Incardona committed
197

incardon's avatar
incardon committed
198
199
200
201
echo -e "Installing requirements into: $i_dir "

##

Pietro Incardona's avatar
Pietro Incardona committed
202
## Take all the options with the exception of -d -i -s
Pietro Incardona's avatar
Pietro Incardona committed
203
204
205

## call the configure script

206
207
### Installing PETSC

Pietro Incardona's avatar
Pietro Incardona committed
208
if [ ! -d "$i_dir/PETSC" -o ! -d "$i_dir/EIGEN" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
209
210
211
    echo -e "\033[1;34m Optional packages  \033[0m"
    echo -e "\033[1mDo you want to install linear algebra packages ?(y/n)\033[0m"
    echo "Installation can take long time (90 minutes on i7-3612QM 4 cores)"
212
213
214
    if [ $sq -eq 0 ]; then
      read inst_lin_alg
    else
215
      inst_lin_alg="y"
216
    fi
Pietro Incardona's avatar
Pietro Incardona committed
217
218
fi

219
220
lin_alg_dir=""
lin_alg_lib=""
Pietro Incardona's avatar
Pietro Incardona committed
221
lin_alg_inc=""
Pietro Incardona's avatar
Pietro Incardona committed
222
223
224
225
226
227
228
229
230
231
232
if [ -d "$i_dir/METIS" ]; then
    configure_options=" $configure_options --with-metis=$i_dir/METIS "
fi
if [ -d "$i_dir/BOOST" ]; then
    configure_options=" $configure_options --with-boost=$i_dir/BOOST "
fi
if [ -d "$i_dir/PARMETIS" ]; then
    configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
fi
if [ -d "$i_dir/HDF5" ]; then
    configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/bin/h5pcc "
Pietro Incardona's avatar
Pietro Incardona committed
233
fi
Pietro Incardona's avatar
Pietro Incardona committed
234
235
236
if [ -d "$i_dir/LIBHILBERT" ]; then
    configure_options=" $configure_options --with-libhilbert=$i_dir/LIBHILBERT "
fi
Pietro Incardona's avatar
Pietro Incardona committed
237

Pietro Incardona's avatar
Pietro Incardona committed
238
239
240
### if we are on linux we have to add -rt

if [ x"$platform" = x"linux" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
241
	lin_alg_lib="$lin_alg_lib -lrt"
Pietro Incardona's avatar
Pietro Incardona committed
242
243
fi

Pietro Incardona's avatar
Pietro Incardona committed
244
245
### MPI compilers must be in your PATH folder

246
set_mpi $i_dir $ncore $CC $CXX $F77 $FC
Pietro Incardona's avatar
Pietro Incardona committed
247

248
249
### METIS and ParMETIS must be installed independently from sistem wide installation

Pietro Incardona's avatar
Pietro Incardona committed
250
./script/install_Parmetis.sh $i_dir $ncore
251
configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
Pietro Incardona's avatar
Pietro Incardona committed
252
./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp $ncore
253
configure_options=" $configure_options --with-metis=$i_dir/METIS "
254

Pietro Incardona's avatar
Pietro Incardona committed
255
MPI_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
256
MPI_System_prv=1
257
258
METIS_installed=1
PARMETIS_installed=1
Pietro Incardona's avatar
Pietro Incardona committed
259
BOOST_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
260
BOOST_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
261
LAPACK_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
262
LAPACK_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
263
SUITESPARSE_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
264
SUITESPARSE_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
265
EIGEN_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
266
EIGEN_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
267
HDF5_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
268
HDF5_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
269
LIBHILBERT_installed=0
Pietro Incardona's avatar
Pietro Incardona committed
270
271
272
conf_err=1

if [ $install_req -eq 0 ]; then
273
    ./configure $options $configure_options "$configure_blas_option"
Pietro Incardona's avatar
Pietro Incardona committed
274
275
276
else
    while [ $conf_err -ne 0 ]
    do
277
        ./configure $options $configure_options "$configure_blas_option"
Pietro Incardona's avatar
Pietro Incardona committed
278
279
280
281
282
283
        conf_err=$?

	echo "Configure script terminated with $conf_err"

        ## if MPI or METIS installation required install it
        if [ $conf_err -eq 200  ]; then
284
            echo "MPI not found try to install, $MPI_installed"
Pietro Incardona's avatar
Pietro Incardona committed
285
286
287
288
            if [ $MPI_installed -eq 1 ]; then
                echo "Error the installation of MPI failed"
                exit 1
            fi
289
            ./script/install_MPI.sh $i_dir $ncore $CC $CXX $F77 $FC
Pietro Incardona's avatar
Pietro Incardona committed
290
            MPI_installed=1
Pietro Incardona's avatar
Pietro Incardona committed
291
            export PATH="$i_dir/MPI/bin:$PATH"
292
            configure_options="$configure_options CXX=mpic++ "
Pietro Incardona's avatar
Pietro Incardona committed
293
294
295
296
297
298
        elif [ $conf_err -eq 201  ]; then
            echo "Metis not found try to install"
            if [ $METIS_installed -eq 1  ]; then
                echo "Error the installation of METIS failed"
                exit 1
            fi
incardon's avatar
incardon committed
299
            ./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp
Pietro Incardona's avatar
Pietro Incardona committed
300
            METIS_installed=1
Yaser Afshar's avatar
Yaser Afshar committed
301
            configure_options=" $configure_options --with-metis=$i_dir/METIS "
Pietro Incardona's avatar
Pietro Incardona committed
302
        elif [ $conf_err -eq 202 ]; then
303
            echo "Boost not found try to install in $i_dir with $compiler_opt"
Pietro Incardona's avatar
Pietro Incardona committed
304
            if [ $BOOST_installed -eq 1  ]; then
305
306
307
                echo "Error the installation of Boost failed"
                exit 1
            fi
308
            if [ x"$CXX" == x"icpc" ]; then
309
              ./script/install_BOOST.sh $i_dir $ncore intel-linux
310
311
            elif [ x"$CXX" == x"clang++" ]; then
              ./script/install_BOOST.sh $i_dir $ncore darwin
312
313
314
            else
              ./script/install_BOOST.sh $i_dir $ncore gcc
            fi
315
            BOOST_installed=1
Yaser Afshar's avatar
Yaser Afshar committed
316
            configure_options=" $configure_options --with-boost=$i_dir/BOOST "
317
	elif [ $conf_err -eq 208 ]; then
318
319
320
321
322
            echo "ParMetis not found try to install"
            if [ $PARMETIS_installed -eq 1  ]; then
                echo "Error the installation of ParMETIS failed"
                exit 1
            fi
Pietro Incardona's avatar
Pietro Incardona committed
323
            ./script/install_Parmetis.sh $i_dir $ncore
324
325
            PARMETIS_installed=1
            configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
Pietro Incardona's avatar
Pietro Incardona committed
326
327
328
        elif [ $conf_err -eq 207 ]; then
            echo "HDF5 not found try to install"
            if [ $HDF5_installed -eq 1 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
329
330
                echo "Error the installation of HDF5 failed"
                exit 1	
Pietro Incardona's avatar
Pietro Incardona committed
331
            fi
Pietro Incardona's avatar
Pietro Incardona committed
332
            ./script/install_HDF5.sh $i_dir $ncore
Pietro Incardona's avatar
Pietro Incardona committed
333
            configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/bin/h5pcc "
Pietro Incardona's avatar
Pietro Incardona committed
334
            HDF5_installed=1
Pietro Incardona's avatar
Pietro Incardona committed
335
336
337
338
339
340
341
342
343
        elif [ $conf_err -eq 210 ]; then
            echo "LIBHILBERT not found try to install"
            if [ $LIBHILBERT_installed -eq 1 ]; then
                echo "Error the installation of LIBHILBERT failed"
                exit 1
            fi
            ./script/install_LIBHILBERT.sh $i_dir $ncore
            configure_options=" $configure_options --with-libhilbert=$i_dir/LIBHILBERT "
            LIBHILBERT_installed=1
Pietro Incardona's avatar
Pietro Incardona committed
344
345
346
347
348
        elif [ $conf_err -ne 0 ]; then
            echo "I do not know how to recover from this error"
            exit 1
        fi
    done
Pietro Incardona's avatar
Pietro Incardona committed
349

Pietro Incardona's avatar
Pietro Incardona committed
350
    if [ x"$inst_lin_alg" == x"y" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
351
        ./script/install_EIGEN.sh $i_dir $ncore
Pietro Incardona's avatar
Pietro Incardona committed
352
        ./script/install_PETSC.sh $i_dir $ncore $CC $CXX $F77 $FC
Pietro Incardona's avatar
Pietro Incardona committed
353
354
    fi

355
356
357
358
	### collect PETSC configuration options
	conf_PETSC

    ./configure $options $configure_options "$configure_blas_option"
Pietro Incardona's avatar
Pietro Incardona committed
359

Pietro Incardona's avatar
Pietro Incardona committed
360
361
fi

Pietro Incardona's avatar
Pietro Incardona committed
362
### Create example.mk
363
install_base=$(cat install_dir)
364
365
openmp_flags="$(cat openmp_flags) $(cat openfpm_flags)"

366
367
echo "INCLUDE_PATH= $openmp_flags  -I. -I$install_base/openfpm_numerics/include -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/METIS/include -I$i_dir/PARMETIS/include -I$i_dir/BOOST/include -I$i_dir/HDF5/include -I$i_dir/LIBHILBERT/include  $lin_alg_inc" > example.mk
echo "LIBS_PATH= $openmp_flags -L$install_base/openfpm_devices/lib -L$install_base/openfpm_pdata/lib  -L$install_base/openfpm_vcluster/lib -L$i_dir/METIS/lib -L$i_dir/PARMETIS/lib  -L$i_dir/BOOST/lib -L$i_dir/HDF5/lib -L$i_dir/LIBHILBERT/lib  $lin_alg_dir" >> example.mk
Pietro Incardona's avatar
Pietro Incardona committed
368
369
echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lhdf5 -llibhilbert  $lin_alg_lib" >> example.mk
echo "LIBS_SE2=-lvcluster -lofpmmemory_se2 -lparmetis -lmetis -lboost_iostreams -lhdf5 -llibhilbert $lin_alg_lib" >> example.mk
Pietro Incardona's avatar
Pietro Incardona committed
370
371
cp example.mk src/example.mk
cp example.mk example/example.mk
372

Pietro Incardona's avatar
Pietro Incardona committed
373
if [ $nomake -eq 0 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
374
  make clean
375
376
  make
fi
377
378
379
380
381

if [ $? -ne 0 ]; then
  conf_err=1
fi

Pietro Incardona's avatar
Pietro Incardona committed
382
383
echo "Command used to configure"
echo ""
Pietro Incardona's avatar
Pietro Incardona committed
384
echo -e "\033[1m ./configure $options $configure_options \033[0m "
Pietro Incardona's avatar
Pietro Incardona committed
385
echo ""
386
387
388
389
390
391
392

if [ x"$platform" = x"linux" ]; then
  bash_library="export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH"
else
  bash_library="export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH"
fi

Pietro Incardona's avatar
Pietro Incardona committed
393
bash_path="export PATH=\""
394
395
396
397

echo -e "\033[1;34;5m ---------------------------------------  \033[0m"
echo -e "\033[1;34;5m --------- INSTALLATION REPORT ---------  \033[0m"
echo ""
Pietro Incardona's avatar
Pietro Incardona committed
398
399
echo -e "\033[1;34;5m ---------- Mandatory packages ---------  \033[0m"
echo ""
400

Pietro Incardona's avatar
Pietro Incardona committed
401
402
if [ -d "$i_dir/MPI" ]; then
  installation_report="$installation_report \033[92;1mMPI\033[0m Installed: \033[1m $i_dir/MPI \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
403
  bash_path="$bash_path:$i_dir/MPI/bin:"
Pietro Incardona's avatar
Pietro Incardona committed
404
405
406
  bash_library="$bash_library:$i_dir/MPI/lib"
elif [ $MPI_System_prv -eq 1 ]; then
  installation_report="$installation_report \033[92;1mMPI\033[0m Installed: \033[1m System installation \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
407
fi
Pietro Incardona's avatar
Pietro Incardona committed
408

Pietro Incardona's avatar
Pietro Incardona committed
409
if [ -d "$i_dir/METIS" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
410
  installation_report="$installation_report \033[92;1mMETIS\033[0m Installed: \033[1m $i_dir/METIS \033[0m\n"
411
  bash_library="$bash_library:$i_dir/METIS/lib"
412
413
fi

Pietro Incardona's avatar
Pietro Incardona committed
414
if [ -d "$i_dir/PARMETIS" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
415
416
417
418
  installation_report="$installation_report \033[92;1mPARMETIS\033[0m Installed: \033[1m $i_dir/PARMETIS \033[0m\n"
  bash_library="$bash_library:$i_dir/PARMETIS/lib"
fi

Pietro Incardona's avatar
Pietro Incardona committed
419
if [ -d "$i_dir/BOOST" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
420
  installation_report="$installation_report \033[92;1mBOOST\033[0m Installed: \033[1m $i_dir/BOOST \033[0m\n"
421
  bash_library="$bash_library:$i_dir/BOOST/lib"
Pietro Incardona's avatar
Pietro Incardona committed
422
423
424
425
elif [ $BOOST_System_prv -eq 1 ]; then
  installation_report="$installation_report \033[92;1mBOOST\033[0m Installed: \033[1m System installation \033[0m\n"
fi

Pietro Incardona's avatar
Pietro Incardona committed
426
if [ -d "$i_dir/HDF5" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
427
428
429
  installation_report="$installation_report \033[92;1mHDF5\033[0m Installed: \033[1m $i_dir/HDF5 \033[0m\n"
  bash_library="$bash_library:$i_dir/HDF5/lib"
fi
430

Pietro Incardona's avatar
Pietro Incardona committed
431
432
433
434
435
if [ -d "$i_dir/LIBHILBERT" ]; then
  installation_report="$installation_report \033[92;1mLibHilbert\033[0m Installed: \033[1m $i_dir/LIBHILBERT \033[0m\n"
  bash_library="$bash_library:$i_dir/LIBHILBERT/lib"
fi

Pietro Incardona's avatar
Pietro Incardona committed
436
437
438
439
440
441
442
443
444
445
446
447
448
echo -e "$installation_report"

echo ""
echo -e "\033[1;34;5m ---------- Optional packages -----------  \033[0m"
echo ""

installation_report=""

if [ -d "$i_dir/PETSC" ]; then
  installation_report="$installation_report \033[92;1mPETSC\033[0m Installed: \033[1m $i_dir/PETSC \033[0m\n"
  bash_library="$bash_library:$i_dir/PETSC/lib"
else
  installation_report="$installation_report \033[91;1mPETSC\033[0m Installed: \033[1m NO \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
449
fi
450

Pietro Incardona's avatar
Pietro Incardona committed
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
if [ -d "$i_dir/EIGEN" ]; then
  installation_report="$installation_report \033[92;1mEIGEN\033[0m Installed: \033[1m $i_dir/EIGEN \033[0m\n"
fi

echo -e "$installation_report"

echo -e "\033[1;34;5m --------------------------------  \033[0m"

installation_report=""

if [ -d "$i_dir/TRILINOS" ]; then
  installation_report="$installation_report \033[92;1mTRILINOS\033[0m Installed: \033[1m $i_dir/TRILINOS \033[0m\n"
  bash_library="$bash_library:$i_dir/TRILINOS/lib"
else
  installation_report="$installation_report \033[91;1mTRILINOS\033[0m Installed: \033[1m NO \033[0m\n"
fi

if [ -d "$i_dir/OPENBLAS" ]; then
  installation_report="$installation_report \033[92;1mOPENBLAS\033[0m Installed: \033[1m $i_dir/OPENBLAS \033[0m\n"
  bash_library="$bash_library:$i_dir/OPENBLAS/lib"
else
  installation_report="$installation_report \033[91;1mOPENBLAS\033[0m Installed: \033[1m NO \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
473
fi
Pietro Incardona's avatar
Pietro Incardona committed
474
475
476

if [ -d "$i_dir/SUITESPARSE" ]; then
  installation_report="$installation_report \033[92;1mSUITESPARSE\033[0m Installed: \033[1m $i_dir/SUITESPARSE \033[0m\n"
477
  bash_library="$bash_library:$i_dir/SUITESPARSE/lib"
Pietro Incardona's avatar
Pietro Incardona committed
478
479
else
  installation_report="$installation_report \033[91;1mSUITESPARSE\033[0m Installed: \033[1m NO \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
480
fi
Pietro Incardona's avatar
Pietro Incardona committed
481
482
483
484
485
486

if [ -d "$i_dir/SCALAPACK" ]; then
  installation_report="$installation_report \033[92;1mSCALAPACK\033[0m Installed: \033[1m $i_dir/SCALAPACK \033[0m\n"
  bash_library="$bash_library:$i_dir/SCALAPACK/lib"
else
  installation_report="$installation_report \033[91;1mSCALAPACK\033[0m Installed: \033[1m NO \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
487
fi
488

Pietro Incardona's avatar
Pietro Incardona committed
489
490
491
492
493
if [ -d "$i_dir/MUMPS" ]; then
  installation_report="$installation_report \033[92;1mMUMPS\033[0m Installed: \033[1m $i_dir/MUMPS \033[0m\n"
  bash_library="$bash_library:$i_dir/MUMPS/lib"
else
  installation_report="$installation_report \033[91;1mMUMPS\033[0m Installed: \033[1m NO \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
494
fi
Pietro Incardona's avatar
Pietro Incardona committed
495
496
497
498
499
500

if [ -d "$i_dir/SUPERLU_DIST" ]; then
  installation_report="$installation_report \033[92;1mSUPERLU_DIST\033[0m Installed: \033[1m $i_dir/SUPERLU_DIST \033[0m\n"
  bash_library="$bash_library:$i_dir/SUPERLU_DIST/lib"
else
  installation_report="$installation_report \033[91;1mSUPERLU_DIST\033[0m Installed: \033[1m NO \033[0m\n"
501
502
fi

Pietro Incardona's avatar
Pietro Incardona committed
503
504
505
506
507
508
509
if [ -d "$i_dir/HYPRE" ]; then
  installation_report="$installation_report \033[92;1mHYPRE\033[0m Installed: \033[1m $i_dir/HYPRE \033[0m\n"
  bash_library="$bash_library:$i_dir/HYPRE/lib"
else
  installation_report="$installation_report \033[91;1mHYPRE\033[0m Installed: \033[1m NO \033[0m\n"
fi

Pietro Incardona's avatar
Pietro Incardona committed
510
bash_path="$bash_path$PATH\""
Pietro Incardona's avatar
Pietro Incardona committed
511
bash_library="$bash_library\""
512
513
514
515
516
517
518

##### Writing openfpm_vars file

echo "$bash_path" > $HOME/openfpm_vars
echo "$bash_library" >> $HOME/openfpm_vars

echo -e "$installation_report"
Pietro Incardona's avatar
Pietro Incardona committed
519
520
521
522
echo ""
echo ""
if [ $conf_err -eq 0  ]; then
  echo -e "Install summary\033[92;5;1m SUCCEED \033[0m"
Pietro Incardona's avatar
Pietro Incardona committed
523
524
  
  ## Save dependencies dir and foward options
Pietro Incardona's avatar
Pietro Incardona committed
525
526
  printf "%s" "$i_dir_old" > dependencies_dir
  printf "%s" "$configure_options_old" > foward_options
Pietro Incardona's avatar
Pietro Incardona committed
527

Pietro Incardona's avatar
Pietro Incardona committed
528
529
530
531
else
  echo -e "Install summary\033[91;5;1m FAILED \033[0m"
fi

532
533
echo ""
if [ x"$platform" = x"linux" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
534
  echo "Before run any openfpm program you must execute the following command. A simple way would be to append this line at the end of your $HOME/.bashrc"
535
else
Pietro Incardona's avatar
Pietro Incardona committed
536
  echo "Before run any openfpm program you must execute the following command. A simple way would be to append this line at the end of your $HOME/.bash_profile"
537
538
fi
echo ""
Pietro Incardona's avatar
Pietro Incardona committed
539
echo -e "\033[1m source $HOME/openfpm_vars \033[0m"
540
echo ""
Pietro Incardona's avatar
Pietro Incardona committed
541
echo -e "\033[91;1m if you have in your .bashrc or .bash_profile old openfpm setting, please remove it\033[0m"
Pietro Incardona's avatar
Pietro Incardona committed
542
543
echo ""
echo ""
544
545
546
if [ $conf_err -ne 0 ]; then
  exit 1
fi