Skip to content
Snippets Groups Projects
Commit cf7d252a authored by incardon's avatar incardon
Browse files

Fixing the installation script

parent e56c603f
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
source script/help
source script/discover_os
source script/show_solutions
source script/pre_req
##
......@@ -40,7 +41,7 @@ discover_os
## Check and try to install the prerequisites
script/pre_req
pre_req
## clone the dependencies
......@@ -104,7 +105,20 @@ if [ $? -eq 0 ]; then
options="CXX=mpic++"
fi
##
## if a new compiler has been installed reinstall all the dependencies
if [ x"compiler_opt" != "" ]; then
./script/install_MPI.sh $i_dir $compiler_opt
export PATH="$PATH:$i_dir/MPI/bin"
configure_options="$configure_options CXX=mpic++ "
MPI_installed=1
./script/install_BOOST.sh $i_dir $compiler_opt
configure_options=" $configure_options --with-boost=$i_dir/BOOST "
BOOST_installed=1
./script/install_METIS.sh $i_dir $compiler_gcc $compiler_gpp
configure_options=" $configure_options --with-metis=$i_dir/METIS "
METIS_installed=1
fi
echo "./configure $options $configure_options"
......@@ -125,7 +139,7 @@ else
echo "Error the installation of MPI failed"
exit 1
fi
./script/install_MPI.sh $i_dir
./script/install_MPI.sh $i_dir $compiler_opt
MPI_installed=1
export PATH="$PATH:$i_dir/MPI/bin"
echo $PATH
......@@ -136,7 +150,7 @@ else
echo "Error the installation of METIS failed"
exit 1
fi
./script/install_Metis.sh $i_dir
./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp
METIS_installed=1
configure_options=" $configure_options --with-metis=$i_dir/METIS "
elif [ $conf_err -eq 202 ]; then
......@@ -145,7 +159,7 @@ else
echo "Error the installation of Boost failed"
exit 1
fi
./script/install_BOOST.sh $i_dir
./script/install_BOOST.sh $i_dir $compiler_opt
BOOST_installed=1
configure_options=" $configure_options --with-boost=$i_dir/BOOST "
elif [ $conf_err -ne 0 ]; then
......@@ -183,7 +197,7 @@ if [ $MPI_installed -eq 1 ]; then
echo -e "\033[1m export PATH=\"\$PATH:$i_dir/MPI/bin \" \033[0m "
echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$i_dir/MPI/lib\" \033[0m "
else
echo -e "\033[1m export PATH=\"\$PATH:$i_dir/MPI \" \033[0m "
echo -e "\033[1m export PATH=\"\$PATH:$i_dir/MPI/bin \" \033[0m "
echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:$i_dir/MPI/lib\" \033[0m"
fi
fi
......
......@@ -5,8 +5,23 @@ function discover_package_manager() {
command -v brew >/dev/null
if [ $? -eq 0 ]; then
discover_package_manager_ret="brew"
if [ ! -w /usr/local ]; then
echo -e "\033[93;5mWARNING: \033[0m /usr/local is not writtable, brew require that /usr/local is writtable and /usr/local/bin is in your PATH, otherwise the solutions with brew will fail"
brew_idir=$(brew --prefix)
brew_path=$(which brew)
brew_user=$(stat -f '%Su' $brew_path)
if [ x$"brew_user" == root ]; then
discover_package_ret="sudo brew"
return
else
if [ ! -w $brew_idir ]; then
echo -e "\033[43;30;1;5mWARNING: \033[0m $brew_idir is not writtable, brew require that $brew_idir is writtable and $brew_idir/bin is in your PATH, otherwise it will be not possible to install with brew"
commands[0]="sudo chown -R $USER $brew_idir && chmod -R u+w $brew_idir"
possible_solutions "${commands[@]}"
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
fi
if [ ! -w ]; then
echo -e "\033[43,33;5mWARNING: \033[0m $brew_idir is not writtable, brew require that $brew_idir is writtable and $brew_idir/bin is in your PATH, otherwise it will be not possible to install with brew"
sleep 10
fi
return
......
......@@ -10,7 +10,7 @@ fi
wget http://www.open-mpi.de/software/ompi/v1.8/downloads/openmpi-1.8.7.tar.bz2
tar -xvf openmpi-1.8.7.tar.bz2
cd openmpi-1.8.7
sh ./configure --prefix=$1/MPI --enable-opal-multi-threads --enable-mpi-f90
sh ./configure --prefix=$1/MPI --enable-opal-multi-threads --enable-mpi-f90 $2 $3
make -j 4
mkdir $1/MPI
make install
......@@ -10,7 +10,13 @@ fi
wget http://ppmcore.mpi-cbg.de/upload/metis-5.1.0.tar.gz
tar -xf metis-5.1.0.tar.gz
cd metis-5.1.0
make config shared=1 prefix=$1/METIS
cputype=$(uname -m | sed "s/\\ /_/g")
systype=$(uname -s)
BUILDDIR=build/$systype-$cputype
mkdir -p $BUILDDIR
cd $BUILDDIR
echo "cmake ../../ $CURDIR -DSHARED=1 -DCMAKE_INSTALL_PREFIX=$1/METIS -DCMAKE_C_COMPILER=$2 -DCMAKE_CXX_COMPILER=$3"
cmake ../../ $CURDIR -DSHARED=1 -DCMAKE_INSTALL_PREFIX=$1/METIS -DCMAKE_C_COMPILER=$2 -DCMAKE_CXX_COMPILER=$3
make -j 4
mkdir $1/METIS
make install
......
#! /bin/bash
function pre_req()
{
source script/discover_package_manager
source script/discover_os
source script/solve_autoconf
source script/solve_gpp
source script/solve_cmake
source script/solve_git
source script/solve_wget
source script/solve_automake
source script/solve_brew
source script/solve_libtool
discover_os
discover_package_manager $platform
pcman=$discover_package_manager_ret
if [ x"$platform" = x"osx" -a x"$pcman" = x"" ]; then
echo -e "\033[93;5;1m WARNING \033[0m No package manager has been found on this system"
script/solve_brew $platform
echo -e "\033[30;43;5;1m WARNING \033[0m No package manager has been found on this system"
solve_brew $platform
discover_package_manager $platform
pcman=$discover_package_manager_ret
......@@ -23,7 +33,7 @@ if [ $? -ne 0 ]; then
echo >&2
echo -e "cmake\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require cmake but it's not installed, searching a solution... "
script/solve_cmake $platform
solve_cmake $platform
command -v cmake >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "cmake\033[91;5;1m FAILED \033[0m"
......@@ -40,7 +50,7 @@ if [ $? -ne 0 ]; then
echo >&2
echo -e "wget\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require wget but it's not installed, searching a solution... "
script/solve_wget $platform
solve_wget $platform
command -v wget >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "wget\033[91;5;1m FAILED \033[0m"
......@@ -57,7 +67,7 @@ if [ $? -ne 0 ]; then
echo >&2
echo -e "git\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require git but it's not installed, searching a solution... "
script/solve_git $platform
solve_git $platform
command -v git >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "git\033[91;5;1m FAILED \033[0m"
......@@ -74,7 +84,7 @@ if [ $? -ne 0 ]; then
echo >&2
echo -e "autoconf\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require autoconf but it's not installed, searching a solution..."
script/solve_autoconf $platform
solve_autoconf $platform
command -v autoheader >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "autoconf\033[91;5;1m FAILED \033[0m"
......@@ -91,7 +101,7 @@ if [ $? -ne 0 ]; then
echo >&2
echo -e "automake\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require automake but it's not installed, searching a solution..."
script/solve_automake $platform
solve_automake $platform
command -v automake >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "automake\033[91;5;1m FAILED \033[0m"
......@@ -112,7 +122,7 @@ if [ $opt1 -ne 0 -a $opt2 -ne 0 ]; then
echo >&2
echo -e "libtool\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require libtool but it's not installed, searching a solution..."
script/solve_libtool $platform
solve_libtool $platform
command -v libtoolize >/dev/null 2>&1
opt1=$?
command -v glibtoolize >/dev/null 2>&1
......@@ -128,24 +138,72 @@ else
fi
#### Detecting g++
#### Detection is different from os linux in general has g++ and we try to detect g++
if [ x"$platform" == x"osx" ]; then
## we try to detect osx version
major=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\1/g')
middle=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\2/g')
minor=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\3/g')
if [ $major -gt 3 ]; then
echo -e "clang++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $major -lt 3 ]; then
echo -e "clang++ $major.$middle.$minor \033[91;5;1m FAILED \033[0m your clang is out of date, update to 3.6.0 (Update Xcode) or use gcc 4.8.2 or higher"
elif [ $middle -gt 6 ]; then
echo -e "clang++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $middle -lt 6 ]; then
echo -e "clang++\033[91;5;1m FAILED \033[0m your clang is out of date, update to 3.6.0 (Update Xcode) or use gcc 4.8.2 or higher"
exit 1
major=$(g++ --version | grep LLVM | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\1/g')
middle=$(g++ --version | grep LLVM | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\2/g')
minor=$(g++ --version | grep LLVM | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\3/g')
echo "$major" | egrep -q '^[0-9]+$'
is_maj_num=$?
echo "$minor" | egrep -q '^[0-9]+$'
is_min_num=$?
echo "$middle" | egrep -q '^[0-9]+$'
is_mid_num=$?
command -v g++-4.9 >/dev/null 2>&1
opt1=$?
# Major middle and minor should contain only numbers, if they dont, and smaller than 2 character otherwise the detection was garbage
if [ $is_maj_num -ne 0 -o $is_min_num -ne 0 -o $is_mid_num -ne 0 ]; then
if [ $opt1 -eq 1 ]; then
## the detection is garbage, gcc49 id not present, now we check the system
major=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
middle=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
minor=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $major -gt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor seem to be recent enough, so we will continue the installation"
sleep 10
elif [ $major -lt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor is older than 10.10.X, so is probably going to fail with the actual compiler"
echo "One possible solution is to try to install gcc 4.9"
solve_gpp $platform
elif [ $middle -gt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor seem to be recent enough, so we will continue the installation"
sleep 10
elif [ $middle -lt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor is older than 10.10.X, so is probably going to fail with the actual compiler"
echo "One possible solution is to try to install gcc 4.9"
solve_gpp $platform
else
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor seem to be recent enough, so we will continue the installation"
sleep 10
fi
fi
else
echo -e "clang++ version $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
## the detection is good check the compiler
if [ $major -gt 3 ]; then
echo -e "clang++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $major -lt 3 ]; then
echo -e "clang++ $major.$middle.$minor \033[91;5;1m FAILED \033[0m your clang $major.middle;$minor is too old, 3.6.0 or higher is required"
solve_gpp $platform
elif [ $middle -gt 6 ]; then
echo -e "clang++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $middle -lt 6 ]; then
echo -e "clang++\033[91;5;1m FAILED \033[0m your clang is out of date, update to 3.6.0 or higher is required"
solve_gpp $platform
else
echo -e "clang++ version $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
fi
fi
else
command -v g++ >/dev/null 2>&1
......@@ -153,7 +211,7 @@ else
echo >&2
echo -e "Configure\033[91;5;1m FAILED \033[0m"
echo "OpenFPM require g++ but it's not installed, searching a solution..."
script/solve_gpp $platform
solve_gpp $platform
command -v g++ >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "g++\033[91;5;1m FAILED \033[0m"
......@@ -202,4 +260,5 @@ else
echo -e "mpirun $major.$middle.$minor \033[92;1m FAILED \033[0m is too old, 1.8.1 at least required"
fi
fi
}
#! /bin/bash
function solve_autoconf() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
......@@ -21,4 +22,5 @@ elif [ x"$1" = x"linux" ]; then
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
}
#! /bin/bash
function solve_automake() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
......@@ -21,4 +22,5 @@ elif [ x"$1" = x"linux" ]; then
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
}
#! /bin/bash
function solve_brew() {
source script/show_solutions
if [ x"$1" = x"osx" ]; then
......@@ -8,4 +9,5 @@ if [ x"$1" = x"osx" ]; then
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
}
#! /bin/bash
function solve_cmake() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
......@@ -22,4 +23,5 @@ elif [ x"$1" = x"linux" ]; then
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
}
#! /bin/bash
function solve_git() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
......@@ -19,4 +20,5 @@ elif [ x"$1" = x"linux" ]; then
possible_solutions "${commands[@]}"
eval ${commands[$possible_solutions_ret]}
fi
}
#! /bin/bash
function solve_gpp() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
pcman=$discover_package_manager_ret
if [ x"$pcman" = x"" ]; then
exit 1
fi
if [ x"$1" = x"osx" ]; then
commands[0]="$pcman install gcc49"
commands[1]="echo \"Continue without installing\""
possible_solutions "${commands[@]}"
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
compiler_opt=" CXX=g++-4.9 CC=gcc-4.9 "
compiler_gcc="gcc-4.9"
compiler_gpp="g++-4.9"
fi
}
#! /bin/bash
function solve_libtool()
{
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
......@@ -21,4 +24,5 @@ elif [ x"$1" = x"linux" ]; then
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
}
#! /bin/bash
function solve_wget() {
source script/show_solutions
source script/discover_package_manager
discover_package_manager $1
......@@ -21,4 +22,5 @@ elif [ x"$1" = x"linux" ]; then
echo "Executing: ${command[$possible_solutions_ret]}"
eval ${commands[$possible_solutions_ret]}
fi
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment