diff --git a/install b/install index 838a5e493e1b27eaf4fdc6b67478d89ef4d962b4..20f9f349e2571bc3d604d013728125e017d227f9 100755 --- a/install +++ b/install @@ -1,5 +1,8 @@ #! /bin/bash +source script/discover_os +discover_os + ## Check and try to install the prerequisites script/pre_req @@ -9,6 +12,14 @@ script/pre_req git submodule init git submodule update +# Create config directory + +mkdir src/config + +## generate configure script + +sh ./autogen.sh + ## Take all the options with the exception of --enable-install-req install_req=1 @@ -51,6 +62,7 @@ else ./script/install_MPI.sh MPI_installed=1 export PATH="$PATH:${HOME}/MPI/bin" + echo $PATH configure_options="$configure_options CXX=mpic++ " elif [ $conf_err -eq 201 ]; then echo "Metis not found try to install" @@ -79,6 +91,10 @@ fi make +if [ $? -ne 0 ]; then + conf_err=1 +fi + echo "" echo "" if [ $conf_err -eq 0 ]; then @@ -96,12 +112,13 @@ if [ $MPI_installed -eq 1 ]; then echo -e "\033[1;34;5m ----------------- MPI ----------------- \033[0m" echo -e " MPI has been installed into: \033[1m $HOME/MPI \033[0m" echo "" - echo -e "\033[1;34m On Linux: \033[0m" - echo -e "\033[1m export PATH=\"\$PATH:\$HOME/MPI \" \033[0m " - echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:\$HOME/MPI/lib\" \033[0m " - echo -e "\033[1;34m On OSX: \033[0m" - echo -e "\033[1m export PATH=\"\$PATH:\$HOME/MPI \" \033[0m " - echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:\$HOME/MPI/lib\" \033[0m" + if [ x"$platform" = x"linux" ]; then + echo -e "\033[1m export PATH=\"\$PATH:\$HOME/MPI \" \033[0m " + echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:\$HOME/MPI/lib\" \033[0m " + else + echo -e "\033[1m export PATH=\"\$PATH:\$HOME/MPI \" \033[0m " + echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:\$HOME/MPI/lib\" \033[0m" + fi fi if [ $METIS_installed -eq 1 ]; then @@ -110,11 +127,11 @@ if [ $METIS_installed -eq 1 ]; then echo -e "\033[1;34;5m ---------------- METIS ---------------- \033[0m" echo -e " METIS has been installed into: \033[1m $HOME/METIS \033[0m" echo "" - echo -e "\033[1;34m On Linux: \033[0m" - echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:\$HOME/METIS/lib\" \033[0m " - echo -e "\033[1;34m On OSX: \033[0m" - echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:\$HOME/METIS/lib\" \033[0m" - + if [ x"$platform" = x"linux" ]; then + echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:\$HOME/METIS/lib\" \033[0m " + else + echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:\$HOME/METIS/lib\" \033[0m" + fi fi if [ $BOOST_installed -eq 1 ]; then @@ -123,12 +140,11 @@ if [ $BOOST_installed -eq 1 ]; then echo -e "\033[1;34;5m ---------------- BOOST ---------------- \033[0m" echo -e " BOOST has been installed into: \033[1m $HOME/BOOST \033[0m" echo "" - echo -e "\033[1;34m On Linux: \033[0m" - echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:\$HOME/BOOST/lib\" \033[0m " - echo -e "\033[1;34m On OSX: \033[0m" - echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:\$HOME/BOOST/lib\" \033[0m" - - + if [ x"$platform" = x"linux" ]; then + echo -e "\033[1m export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:\$HOME/BOOST/lib\" \033[0m " + else + echo -e "\033[1m export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:\$HOME/BOOST/lib\" \033[0m" + fi fi echo "" echo "" diff --git a/script/discover_os b/script/discover_os new file mode 100755 index 0000000000000000000000000000000000000000..71a1a803312c74820f17c5c6ae21c862d8331bfb --- /dev/null +++ b/script/discover_os @@ -0,0 +1,35 @@ +#! /bin/bash + +function discover_os() { +platform=unknown + + + if [[ "$OSTYPE" == "linux-gnu" ]]; then + echo -e "We are on\033[1;34m LINUX \033[0m" + platform=linux + elif [[ "$OSTYPE" == "darwin"* ]]; then + echo -e "We are on\033[1;34m MAC OSX \033[0m" + platform=osx + elif [[ "$OSTYPE" == "cygwin" ]]; then + echo -e "We are on\033[1;34m CYGWIN \033[0m" + echo "This platform is not supported" + exit 1 + elif [[ "$OSTYPE" == "msys" ]]; then + echo -e "We are on\033[1;34m Microsoft Window \033[0m" + echo "This platform is not supported" + exit 1 + elif [[ "$OSTYPE" == "win32" ]]; then + echo -e "We are on\033[1;34m Microsoft Window \033[0m" + echo "This platform is not supported" + exit 1 + elif [[ "$OSTYPE" == "freebsd"* ]]; then + echo -e "We are on\033[1;34m FREEBSD \033[0m" + echo "This platform is not supported" + exit 1 + else + echo -e "We are on an\033[1;34m unknown OS \033[0m" + echo "This platform is not supported" + exit 1 + fi +} + diff --git a/script/install_BOOST.sh b/script/install_BOOST.sh index 7c29641722b47bd090053c17acfa1b3adaf78d91..09144d2e0088af4a8dd5bc72f060a76195a185a0 100755 --- a/script/install_BOOST.sh +++ b/script/install_BOOST.sh @@ -12,5 +12,5 @@ wget http://ppmcore.mpi-cbg.de/upload/boost_1_58_0.tar.bz2 tar -xvf boost_1_58_0.tar.bz2 cd boost_1_58_0 ./bootstrap.sh -./b2 install --prefix=$HOME/BOOST +./b2 -j 4 install --prefix=$HOME/BOOST diff --git a/script/install_MPI.sh b/script/install_MPI.sh index 5ad834b35489586bf1569a7a70782927b3257ea8..d00da03c6e825ac9079864b577f13acc9bf97641 100755 --- a/script/install_MPI.sh +++ b/script/install_MPI.sh @@ -12,5 +12,5 @@ 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=${HOME}/MPI --enable-opal-multi-threads --enable-mpi-f90 -make +make -j 4 make install diff --git a/script/install_Metis.sh b/script/install_Metis.sh index d540e2127321ae17e5e42937164632f3ff0c2499..8899f346b8f414bb057aaecd2bf66c1ec5f70920 100755 --- a/script/install_Metis.sh +++ b/script/install_Metis.sh @@ -13,6 +13,6 @@ 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=${HOME}/METIS -make +make -j 4 make install diff --git a/script/pre_req b/script/pre_req index 978177036cf1c21b41605ef48ba51a5ae820e82a..1c2923fc95e10867b85bd90ebc96c4692681c1bf 100755 --- a/script/pre_req +++ b/script/pre_req @@ -1,38 +1,9 @@ #! /bin/bash source script/discover_package_manager +source script/discover_os -platform=unknown - - -if [[ "$OSTYPE" == "linux-gnu" ]]; then - echo -e "We are on\033[1;34m LINUX \033[0m" - platform=linux -elif [[ "$OSTYPE" == "darwin"* ]]; then - echo -e "We are on\033[1;34m MAC OSX \033[0m" - platform=osx -elif [[ "$OSTYPE" == "cygwin" ]]; then - echo -e "We are on\033[1;34m CYGWIN \033[0m" - echo "This platform is not supported" - exit 1 -elif [[ "$OSTYPE" == "msys" ]]; then - echo -e "We are on\033[1;34m Microsoft Window \033[0m" - echo "This platform is not supported" - exit 1 -elif [[ "$OSTYPE" == "win32" ]]; then - echo -e "We are on\033[1;34m Microsoft Window \033[0m" - echo "This platform is not supported" - exit 1 -elif [[ "$OSTYPE" == "freebsd"* ]]; then - echo -e "We are on\033[1;34m FREEBSD \033[0m" - echo "This platform is not supported" - exit 1 -else - echo -e "We are on an\033[1;34m unknown OS \033[0m" - echo "This platform is not supported" - exit 1 -fi - +discover_os discover_package_manager $platform pcman=discover_package_manager_ret @@ -40,21 +11,21 @@ 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" fi -command -v wget >/dev/null 2>&1 +command -v cmake >/dev/null 2>&1 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 - command -v wget >/dev/null 2>&1 + 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 + command -v cmake >/dev/null 2>&1 if [ $? -ne 0 ]; then - echo -e "wget\033[91;5;1m FAILED \033[0m" + echo -e "cmake\033[91;5;1m FAILED \033[0m" exit 1 else - echo -e "wget\033[92;1m SUCCESS \033[0m" + echo -e "cmake\033[92;1m SUCCESS \033[0m" fi else - echo -e "wget\033[92;1m SUCCESS \033[0m" + echo -e "cmake\033[92;1m SUCCESS \033[0m" fi command -v git >/dev/null 2>&1 diff --git a/script/solve_cmake b/script/solve_cmake new file mode 100755 index 0000000000000000000000000000000000000000..4acd5e9ab4e64e0e4a31ea8bac0e0de37ccd29c8 --- /dev/null +++ b/script/solve_cmake @@ -0,0 +1,25 @@ + +#! /bin/bash + +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 cmake" + possible_solutions "${commands[@]}" + echo "Executing: ${command[$possible_solutions_ret]}" + eval ${commands[$possible_solutions_ret]} +elif [ x"$1" = x"linux" ]; then + commands[0]="su -c \"$pcman install cmake\"" + commands[1]="sudo $pcman install cmake" + possible_solutions "${commands[@]}" + echo "Executing: ${command[$possible_solutions_ret]}" + eval ${commands[$possible_solutions_ret]} +fi +