install 18 KB
Newer Older
Pietro Incardona's avatar
Pietro Incardona committed
1
#! /bin/bash
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
incardon's avatar
incardon committed
8
source script/set_mpi
9
source script/conf_PETSC
incardon's avatar
incardon committed
10
source script/update_openfpm
11
source script/solve_python
12

incardon's avatar
incardon committed
13
### switch to the branch
incardon's avatar
incardon committed
14 15
#b_switch=`git rev-parse --abbrev-ref HEAD`
#b_switch=
incardon's avatar
incardon committed
16 17 18
b_switch=$(cat switch_branch)
if [ x"$b_switch" != x"" ]; then
        git checkout $b_switch
incardon's avatar
incardon committed
19 20 21
	rm switch_branch
	./install "$@"
	exit 0
incardon's avatar
incardon committed
22 23
fi

24 25 26 27
## 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"
28
	 exit 1
29 30
fi

Pietro Incardona's avatar
Pietro Incardona committed
31
install_req=1
incardon's avatar
incardon committed
32
i_dir=""
Pietro Incardona's avatar
Pietro Incardona committed
33
sq=0
incardon's avatar
incardon committed
34
nomake=0
35 36
update_openfpm=0
upgrade_openfpm=0
incardon's avatar
incardon committed
37
gpu_support=0
38

incardon's avatar
incardon committed
39
while getopts di:smghc:nu FLAG; do
Pietro Incardona's avatar
Pietro Incardona committed
40
	case $FLAG in
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
	    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
	      ;;
57 58 59 60 61 62 63
            m)
              echo "Skip compilation of the test"
              nomake=1
              ;;
	    g)
	      echo "Installing with GPU support"
	      gpu_support=1
64
	      ;;
65 66 67 68 69
	    u)
	      echo "Updating openfpm"
	      update_openfpm=1
	      ;;
	    n)
70
          echo "Upgrading openfpm"
71 72
	      upgrade_openfpm=1
	      ;;
73
	    h)  #show help
74 75 76 77
      	  HELP
          ;;
    	\?) #unrecognized option - are fowarded to configure
          ;;
Pietro Incardona's avatar
Pietro Incardona committed
78
	esac
incardon's avatar
incardon committed
79 80
done

incardon's avatar
incardon committed
81 82 83 84 85
### Configure options

i_dir_old=$i_dir
configure_options_old=$configure_options

incardon's avatar
incardon committed
86 87
discover_os

88 89
## Remove old dependencies and installations

incardon's avatar
incardon committed
90
if [ x"$i_dir" == x"" ]; then
91 92 93
 i_dir="$HOME"
fi

incardon's avatar
incardon committed
94 95 96
## Check and try to install the prerequisites


97 98 99 100 101 102
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
103
	update_openfpm update
incardon's avatar
incardon committed
104
	exit 0
105 106 107
fi

if [ $upgrade_openfpm -eq 1 ]; then
incardon's avatar
incardon committed
108
	update_openfpm upgrade
incardon's avatar
incardon committed
109
	exit 0
110 111
fi

112
remove_old $i_dir $configure_options
incardon's avatar
incardon committed
113

114

incardon's avatar
incardon committed
115 116 117 118
## Check and try to install the prerequisites

pre_req

incardon's avatar
incardon committed
119
## clone the dependencies
incardon's avatar
incardon committed
120
git submodule init
Yaser Afshar's avatar
Yaser Afshar committed
121 122 123 124
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
125

incardon's avatar
incardon committed
126
git submodule update
Yaser Afshar's avatar
Yaser Afshar committed
127 128 129 130
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
131

incardon's avatar
incardon committed
132 133 134 135 136 137
#### Eventualy remove garbage from old installation

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


138 139
# Create config directory in each submodule
cd openfpm_data
incardon's avatar
incardon committed
140 141 142
if [ ! -d src/config  ]; then
  mkdir src/config
fi
143 144 145
cd ..

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

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

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

incardon's avatar
incardon committed
163 164 165 166 167 168
cd openfpm_numerics
if [ ! -d src/config  ]; then
  mkdir src/config
fi
cd ..

incardon's avatar
incardon committed
169
# Create config directory
incardon's avatar
incardon committed
170

incardon's avatar
incardon committed
171 172 173
if [ ! -d src/config ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
174

incardon's avatar
incardon committed
175
## generate configure script
incardon's avatar
incardon committed
176

incardon's avatar
incardon committed
177
sh ./autogen.sh
Incardona Pietro's avatar
Incardona Pietro committed
178 179 180 181
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
182

incardon's avatar
incardon committed
183
## check for options
incardon's avatar
incardon committed
184 185 186 187

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"
incardon's avatar
incardon committed
188 189 190 191
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
incardon's avatar
incardon committed
192
if [ $sq -eq 0 ]; then
193
  unset commands
194
#  commands[0]="continue"
incardon's avatar
incardon committed
195 196
  possible_solutions "${commands[@]}"
fi
incardon's avatar
incardon committed
197

198
ncore=4
incardon's avatar
incardon committed
199
echo -e "\033[1mHow many core you want to use to install the dependencies?\033[0m"
200 201 202
if [ $sq -eq 0 ]; then
  read ncore
fi
incardon's avatar
incardon committed
203

incardon's avatar
incardon committed
204 205 206 207
echo -e "Installing requirements into: $i_dir "

##

incardon's avatar
incardon committed
208
## Take all the options with the exception of -d -i -s
incardon's avatar
incardon committed
209 210 211

## call the configure script

incardon's avatar
incardon committed
212 213
### Installing PETSC

incardon's avatar
incardon committed
214
if [ ! -d "$i_dir/PETSC" -o ! -f "$i_dir/PETSC/include/petsc.h" -o ! -d "$i_dir/EIGEN" ]; then
incardon's avatar
incardon committed
215 216
    echo -e "\033[1;34m Optional packages  \033[0m"
    echo -e "\033[1mDo you want to install linear algebra packages ?(y/n)\033[0m"
217 218 219
    if [ $sq -eq 0 ]; then
      read inst_lin_alg
    else
220
      inst_lin_alg="y"
221
    fi
222 223 224 225 226 227 228

    ### PETSC require Python

    command -v python
    if [ $? -ne 0 ]; then
      ### We have to install python
      echo "OpenFPM require python but it's not installed, searching a solution... "
229
      solve_python $platform
230 231 232
      command -v python
      if [ $? -ne 0 ]; then
	echo -e "python\033[91;5;1m FAILED \033[0m"
incardon's avatar
incardon committed
233
        exit 1
234 235
      fi
    fi
236 237 238 239 240 241

    if haveProg python2; then
      python_command=python2
    else
      # we check that python is python2
      py_ver=$(python --version 2>&1 | grep Python | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1/g')
incardon's avatar
incardon committed
242
      
243 244
      if [ $py_ver -eq 3 ]; then
        # we have to install python2
incardon's avatar
incardon committed
245
	echo -e "\033[1mPETSC require python2 installed, searching a solution to install python2 ... \033[0m"
246 247 248 249 250
        solve_python $platform
      fi
      python_command=python
    fi

incardon's avatar
incardon committed
251 252
fi

incardon's avatar
incardon committed
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
#### License and Copyright disclamer

echo -e "\033[1;34m Licenses  \033[0m"
echo -e "\033[1;34m OpenFPM install several dependencies automatically. Some of them impose restriction and the user must explicitly accept it \033[0m"
echo -e "\033[1;33m PARMETIS: \033[0m \033[1m http://glaros.dtc.umn.edu/gkhome/metis/parmetis/download  (Copyright and License) \033[0m"
echo -e ""

if [ $sq -eq 0 ]; then
  unset commands
  commands[0]="Accept and continue"
  possible_solutions_no_continue "${commands[@]}"
fi

####

268 269
lin_alg_dir=""
lin_alg_lib=""
270
lin_alg_inc=""
incardon's avatar
incardon committed
271 272 273 274
if [ -d "$i_dir/BOOST" ]; then
    configure_options=" $configure_options --with-boost=$i_dir/BOOST "
fi
if [ -d "$i_dir/HDF5" ]; then
incardon's avatar
incardon committed
275
    configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/ "
incardon's avatar
incardon committed
276
fi
277 278 279
if [ -d "$i_dir/LIBHILBERT" ]; then
    configure_options=" $configure_options --with-libhilbert=$i_dir/LIBHILBERT "
fi
incardon's avatar
incardon committed
280

281 282 283
### if we are on linux we have to add -rt

if [ x"$platform" = x"linux" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
284
	lin_alg_lib="$lin_alg_lib -lrt"
285 286
fi

incardon's avatar
incardon committed
287 288
### MPI compilers must be in your PATH folder

incardon's avatar
incardon committed
289
set_mpi $i_dir $ncore $gpu_support $CC $CXX $F77 $FC
incardon's avatar
incardon committed
290

291 292
### METIS and ParMETIS must be installed independently from sistem wide installation

incardon's avatar
incardon committed
293
./script/install_Parmetis.sh $i_dir $ncore
294
configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
incardon's avatar
incardon committed
295

296
./script/install_Metis.sh $i_dir $CC $CXX $ncore
297
configure_options=" $configure_options --with-metis=$i_dir/METIS "
298

incardon's avatar
incardon committed
299 300 301 302
if [ x"$gpu_support" == x"1" ]; then
	configure_options=" $configure_options --enable-gpu "
fi

incardon's avatar
incardon committed
303
MPI_installed=0
incardon's avatar
incardon committed
304
MPI_System_prv=1
305 306
METIS_installed=1
PARMETIS_installed=1
incardon's avatar
incardon committed
307
BOOST_installed=0
incardon's avatar
incardon committed
308
BOOST_System_prv=1
309
LAPACK_installed=0
incardon's avatar
incardon committed
310
LAPACK_System_prv=1
311
SUITESPARSE_installed=0
incardon's avatar
incardon committed
312
SUITESPARSE_System_prv=1
313
EIGEN_installed=0
incardon's avatar
incardon committed
314
EIGEN_System_prv=1
315
HDF5_installed=0
incardon's avatar
incardon committed
316
HDF5_System_prv=1
317
LIBHILBERT_installed=0
incardon's avatar
incardon committed
318
VCDEVEL_installed=0
incardon's avatar
incardon committed
319 320
conf_err=1

321

incardon's avatar
incardon committed
322
if [ $install_req -eq 0 ]; then
323
    ./configure $options $configure_options "$configure_blas_option"
incardon's avatar
incardon committed
324 325 326
else
    while [ $conf_err -ne 0 ]
    do
327
	pwd
328
        ./configure $options $configure_options "$configure_blas_option"
incardon's avatar
incardon committed
329 330
        conf_err=$?

331
        echo "Configure script terminated with $conf_err"
incardon's avatar
incardon committed
332

333 334
        ## if METIS installation required install it
        if [ $conf_err -eq 201  ]; then
incardon's avatar
incardon committed
335 336 337 338 339
            echo "Metis not found try to install"
            if [ $METIS_installed -eq 1  ]; then
                echo "Error the installation of METIS failed"
                exit 1
            fi
340
            ./script/install_Metis.sh $i_dir $CC $CXX
incardon's avatar
incardon committed
341
            METIS_installed=1
Yaser Afshar's avatar
Yaser Afshar committed
342
            configure_options=" $configure_options --with-metis=$i_dir/METIS "
incardon's avatar
incardon committed
343
        elif [ $conf_err -eq 202 ]; then
344
            echo "Boost not found try to install in $i_dir with $compiler_opt"
incardon's avatar
incardon committed
345
            if [ $BOOST_installed -eq 1  ]; then
346 347 348
                echo "Error the installation of Boost failed"
                exit 1
            fi
349
            if [ x"$CXX" == x"icpc" ]; then
incardon's avatar
incardon committed
350
              ./script/install_BOOST.sh $i_dir $ncore intel-linux
351 352
            elif [ x"$CXX" == x"clang++" ]; then
              ./script/install_BOOST.sh $i_dir $ncore darwin
incardon's avatar
incardon committed
353
            else
354 355 356 357 358
	      if [ x"$CXX" == x"gcc" ]; then
              	./script/install_BOOST.sh $i_dir $ncore gcc
	      else
		./script/install_BOOST.sh $i_dir $ncore gcc $(which $CXX) $dgc_major $dgc_middle
	      fi
incardon's avatar
incardon committed
359
            fi
360
            BOOST_installed=1
Yaser Afshar's avatar
Yaser Afshar committed
361
            configure_options=" $configure_options --with-boost=$i_dir/BOOST "
362
        elif [ $conf_err -eq 208 ]; then
363 364 365 366 367
            echo "ParMetis not found try to install"
            if [ $PARMETIS_installed -eq 1  ]; then
                echo "Error the installation of ParMETIS failed"
                exit 1
            fi
incardon's avatar
incardon committed
368
            ./script/install_Parmetis.sh $i_dir $ncore
369 370
            PARMETIS_installed=1
            configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
371 372 373
        elif [ $conf_err -eq 207 ]; then
            echo "HDF5 not found try to install"
            if [ $HDF5_installed -eq 1 ]; then
374
                echo "Error the installation of HDF5 failed"
375
                exit 1
376
            fi
incardon's avatar
incardon committed
377
            ./script/install_HDF5.sh $i_dir $ncore
incardon's avatar
incardon committed
378
            configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/ "
379
            HDF5_installed=1
380 381 382 383 384 385 386 387 388
        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
incardon's avatar
incardon committed
389 390
        elif [ $conf_err -eq 211 ]; then
            echo "VCDEVEL not found try to install"
incardon's avatar
incardon committed
391
            if [ $VCDEVEL_installed -eq 1 ]; then
incardon's avatar
incardon committed
392 393 394 395 396 397
                echo "Error the installation of VCDEVEL failed"
                exit 1
            fi
            ./script/install_VCDEVEL.sh $i_dir $ncore
            configure_options=" $configure_options --with-vcdevel=$i_dir/VCDEVEL "
            VCDEVEL_installed=1
incardon's avatar
incardon committed
398 399 400 401 402
        elif [ $conf_err -ne 0 ]; then
            echo "I do not know how to recover from this error"
            exit 1
        fi
    done
incardon's avatar
incardon committed
403

incardon's avatar
incardon committed
404
    if [ x"$inst_lin_alg" == x"y" ]; then
incardon's avatar
incardon committed
405 406
        CXX="$CXX" CC="$CC" FC="$FC" F77="$F77" ./script/install_EIGEN.sh $i_dir $ncore
        CXX="$CXX" CC="$CC" FC="$FC" F77="$F77" ./script/install_PETSC.sh $i_dir $ncore $CC $CXX $F77 $FC
incardon's avatar
incardon committed
407 408
    fi

409 410
    ### collect PETSC configuration options
    conf_PETSC
411 412

    ./configure $options $configure_options "$configure_blas_option"
incardon's avatar
incardon committed
413 414
fi

Pietro Incardona's avatar
Pietro Incardona committed
415
### Create example.mk
416
install_base=$(cat install_dir)
417
openmp_flags="$(cat openmp_flags)"
incardon's avatar
incardon committed
418 419 420
cuda_include_dirs=$(cat cuda_include)
mpi_include_dirs=$(cat mpi_include)
mpi_libs=$(cat mpi_libs)
421

422 423 424 425 426 427
if [ -d "$i_dir/HDF5/lib" ]; then
  hdf5_lib=$i_dir/HDF5/lib
elif [ -d "$i_dir/HDF5/lib64" ]; then
  hdf5_lib=$i_dir/HDF5/lib64
fi

428 429
echo "INCLUDE_PATH=$cuda_include_dirs -Wno-deprecated-declarations $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/VCDEVEL/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/VCDEVEL/lib  -L$i_dir/METIS/lib -L$i_dir/PARMETIS/lib  -L$i_dir/BOOST/lib -L$hdf5_lib -L$i_dir/LIBHILBERT/lib  $lin_alg_dir " >> example.mk
incardon's avatar
incardon committed
430
if [ x"$gpu_support" == x"1" ]; then
431 432
    echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc  $(cat cuda_lib) $lin_alg_lib -ldl" >> example.mk
    echo "LIBS_SE2=-lvcluster -lofpmmemory_se2 -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc  $(cat cuda_lib) $lin_alg_lib" >> example.mk
incardon's avatar
incardon committed
433
else
434 435
    echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc  $lin_alg_lib -ldl" >> example.mk
    echo "LIBS_SE2=-lvcluster -lofpmmemory_se2 -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc  $lin_alg_lib" >> example.mk
incardon's avatar
incardon committed
436
fi
incardon's avatar
incardon committed
437
echo "INCLUDE_PATH_NVCC=-Xcompiler="-Wno-deprecated-declarations" $(cat openmp_flags) "$(cat cuda_options)" -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
Pietro Incardona's avatar
Pietro Incardona committed
438 439
cp example.mk src/example.mk
cp example.mk example/example.mk
440

incardon's avatar
incardon committed
441
if [ $nomake -eq 0 ]; then
incardon's avatar
incardon committed
442
  make clean
443
  make VERBOSE=1  -j $ncore
incardon's avatar
incardon committed
444
fi
incardon's avatar
incardon committed
445 446 447 448 449

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

incardon's avatar
incardon committed
450 451
echo "Command used to configure"
echo ""
incardon's avatar
incardon committed
452
echo -e "\033[1m ./configure $options $configure_options \033[0m "
incardon's avatar
incardon committed
453
echo ""
incardon's avatar
incardon committed
454

incardon's avatar
incardon committed
455
if [ x"$platform" == x"linux" -o x"$platform" == x"cygwin" ]; then
incardon's avatar
incardon committed
456
  bash_library="export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:/$install_base/openfpm_devices/lib:/$install_base/openfpm_vcluster/lib"
incardon's avatar
incardon committed
457
else
incardon's avatar
incardon committed
458
  bash_library="export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:/$install_base/openfpm_devices/lib:/$install_base/openfpm_vcluster/lib"
incardon's avatar
incardon committed
459 460
fi

incardon's avatar
incardon committed
461
bash_path="export PATH=\""
incardon's avatar
incardon committed
462 463 464 465

echo -e "\033[1;34;5m ---------------------------------------  \033[0m"
echo -e "\033[1;34;5m --------- INSTALLATION REPORT ---------  \033[0m"
echo ""
incardon's avatar
incardon committed
466 467
echo -e "\033[1;34;5m ---------- Mandatory packages ---------  \033[0m"
echo ""
incardon's avatar
incardon committed
468

incardon's avatar
incardon committed
469 470
if [ -d "$i_dir/MPI" ]; then
  installation_report="$installation_report \033[92;1mMPI\033[0m Installed: \033[1m $i_dir/MPI \033[0m\n"
incardon's avatar
incardon committed
471
  bash_path="$bash_path$i_dir/MPI/bin:"
incardon's avatar
incardon committed
472 473 474
  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"
incardon's avatar
incardon committed
475
fi
incardon's avatar
incardon committed
476

Pietro Incardona's avatar
Pietro Incardona committed
477
if [ -d "$i_dir/METIS" ]; then
incardon's avatar
incardon committed
478
  installation_report="$installation_report \033[92;1mMETIS\033[0m Installed: \033[1m $i_dir/METIS \033[0m\n"
incardon's avatar
incardon committed
479
  bash_library="$bash_library:$i_dir/METIS/lib"
480 481
fi

Pietro Incardona's avatar
Pietro Incardona committed
482
if [ -d "$i_dir/PARMETIS" ]; then
incardon's avatar
incardon committed
483 484 485 486
  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
487
if [ -d "$i_dir/BOOST" ]; then
incardon's avatar
incardon committed
488
  installation_report="$installation_report \033[92;1mBOOST\033[0m Installed: \033[1m $i_dir/BOOST \033[0m\n"
incardon's avatar
incardon committed
489
  bash_library="$bash_library:$i_dir/BOOST/lib"
incardon's avatar
incardon committed
490 491 492 493
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
494
if [ -d "$i_dir/HDF5" ]; then
incardon's avatar
incardon committed
495
  installation_report="$installation_report \033[92;1mHDF5\033[0m Installed: \033[1m $i_dir/HDF5 \033[0m\n"
496
  bash_library="$bash_library:$hdf5_lib"
incardon's avatar
incardon committed
497
fi
incardon's avatar
incardon committed
498

499 500 501 502 503
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

incardon's avatar
incardon committed
504 505 506 507 508 509 510
echo -e "$installation_report"

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

installation_report=""
incardon's avatar
incardon committed
511
lin_alg_installed=""
incardon's avatar
incardon committed
512

incardon's avatar
incardon committed
513
if [ -d "$i_dir/PETSC" -a -f "$i_dir/PETSC/include/petsc.h" ]; then
incardon's avatar
incardon committed
514 515
  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"
incardon's avatar
incardon committed
516
  lin_alg_installed="y"
incardon's avatar
incardon committed
517 518
else
  installation_report="$installation_report \033[91;1mPETSC\033[0m Installed: \033[1m NO \033[0m\n"
incardon's avatar
incardon committed
519
fi
incardon's avatar
incardon committed
520

incardon's avatar
incardon committed
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
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/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"
536
fi
incardon's avatar
incardon committed
537

538 539

if [ -d "$i_dir/SUITESPARSE"  -a -f "$i_dir/SUITESPARSE/include/umfpack.h" ]; then
incardon's avatar
incardon committed
540
  installation_report="$installation_report \033[92;1mSUITESPARSE\033[0m Installed: \033[1m $i_dir/SUITESPARSE \033[0m\n"
incardon's avatar
incardon committed
541
  bash_library="$bash_library:$i_dir/SUITESPARSE/lib"
incardon's avatar
incardon committed
542 543
else
  installation_report="$installation_report \033[91;1mSUITESPARSE\033[0m Installed: \033[1m NO \033[0m\n"
544
fi
incardon's avatar
incardon committed
545

546
bash_path="$bash_path\$PATH\""
incardon's avatar
incardon committed
547
bash_library="$bash_library\""
incardon's avatar
incardon committed
548 549 550 551 552 553

##### Writing openfpm_vars file

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

incardon's avatar
incardon committed
554 555 556 557
if [ x"$platform" = x"osx" ]; then
    echo "TMPDIR=/tmp/" >> $HOME/openfpm_vars
fi

incardon's avatar
incardon committed
558
echo -e "$installation_report"
incardon's avatar
incardon committed
559 560 561 562
echo ""
echo ""
if [ $conf_err -eq 0  ]; then
  echo -e "Install summary\033[92;5;1m SUCCEED \033[0m"
incardon's avatar
incardon committed
563 564
  
  ## Save dependencies dir and foward options
incardon's avatar
incardon committed
565 566
  printf "%s" "$i_dir_old" > dependencies_dir
  printf "%s" "$configure_options_old" > foward_options
incardon's avatar
incardon committed
567

incardon's avatar
incardon committed
568 569 570 571
else
  echo -e "Install summary\033[91;5;1m FAILED \033[0m"
fi

incardon's avatar
incardon committed
572 573
echo ""
if [ x"$platform" = x"linux" ]; then
incardon's avatar
incardon committed
574
  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"
incardon's avatar
incardon committed
575
else
incardon's avatar
incardon committed
576
  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"
incardon's avatar
incardon committed
577 578
fi
echo ""
incardon's avatar
incardon committed
579
echo -e "\033[1m source $HOME/openfpm_vars \033[0m"
incardon's avatar
incardon committed
580
echo ""
incardon's avatar
incardon committed
581
echo ""
582
echo -e "Remember to do: \033[91;5;1m make install \033[0m"
incardon's avatar
incardon committed
583
echo ""
incardon's avatar
incardon committed
584
if [ x"$inst_lin_alg" == "y" -a x"$lin_alg_installed" == x"" ]; then
incardon's avatar
incardon committed
585 586
  conf_err=1
fi
587 588 589
if [ $conf_err -ne 0 ]; then
  exit 1
fi