@@ -21,23 +21,32 @@ build_and_install()
2121 fi
2222 mkdir -p " ${build_path} "
2323 info " pushd ${build_path} "
24- pushd " ${build_path} "
24+ pushd " ${build_path} " || emergency " build_and_install.sh: pushd failed "
2525
2626 if [[ " ${package_to_build} " != " gcc" ]]; then
2727
28- if [[ " ${package_to_build} " == " mpich" && " ${version_to_build} " == " 3.2" ]]; then
29- info " Patching MPICH 3.2 on Mac OS due to segfault bug (see http://lists.mpich.org/pipermail/discuss/2016-May/004764.html)."
30- sed ' s/} MPID_Request ATTRIBUTE((__aligned__(32)));/} ATTRIBUTE((__aligned__(32))) MPID_Request;/g' \
31- " ${download_path} /${package_source_directory} /src/include/mpiimpl.h" > " ${download_path} /${package_source_directory} /src/include/mpiimpl.h.patched"
32- cp " ${download_path} /${package_source_directory} /src/include/mpiimpl.h.patched" " ${download_path} /${package_source_directory} /src/include/mpiimpl.h"
28+ if [[ " ${package_to_build} " == " mpich" ]]; then
29+ if [[ " ${version_to_build} " == " 3.2" ]]; then
30+ info " Patching MPICH 3.2 on Mac OS due to segfault bug (see http://lists.mpich.org/pipermail/discuss/2016-May/004764.html)."
31+ sed ' s/} MPID_Request ATTRIBUTE((__aligned__(32)));/} ATTRIBUTE((__aligned__(32))) MPID_Request;/g' \
32+ " ${download_path} /${package_source_directory} /src/include/mpiimpl.h" > " ${download_path} /${package_source_directory} /src/include/mpiimpl.h.patched"
33+ cp " ${download_path} /${package_source_directory} /src/include/mpiimpl.h.patched" " ${download_path} /${package_source_directory} /src/include/mpiimpl.h"
34+ fi
35+
36+ FC_version=$( $FC --version)
37+ text_before_dot=" ${FC_version%% .* } " # grab text before first dot
38+ major_version=" ${text_before_dot##* } " # grab text after final space
39+ if (( ${major_version} >= 10 )) ; then
40+ export FFLAGS=" -w -fallow-argument-mismatch"
41+ fi
3342 fi
3443
3544 if [[ " ${package_to_build} " == " cmake" && $( uname) == " Linux" ]]; then
3645
3746 export cmake_binary_installer=" ${download_path} /cmake-${version_to_build} -Linux-x86_64.sh"
3847 ${SUDO:- } mkdir -p " $install_path "
3948 chmod u+x " ${cmake_binary_installer} "
40- if [[ ! -z " ${SUDO:- } " ]]; then
49+ if [[ -n " ${SUDO:- } " ]]; then
4150 info " You do not have write permissions to the installation path ${install_path} "
4251 info " If you have administrative privileges, enter your password to install ${package_to_build} "
4352 fi
@@ -48,13 +57,13 @@ build_and_install()
4857 else # build from source
4958
5059 info " Configuring ${package_to_build} ${version_to_build} with the following command:"
51- info " FC=\" ${FC:- ' gfortran' } \" CC=\" ${CC:- ' gcc' } \" CXX=\" ${CXX:- ' g++' } \" \" ${download_path} /${package_source_directory} \" /configure --prefix=\" ${install_path} \" "
52- FC=" ${FC:- ' gfortran' } " CC=" ${CC:- ' gcc' } " CXX=" ${CXX:- ' g++' } " " ${download_path} /${package_source_directory} " /configure --prefix=" ${install_path} "
60+ info " FFLAGS= ${FFLAGS :- } FC=\" ${FC:- ' gfortran' } \" CC=\" ${CC:- ' gcc' } \" CXX=\" ${CXX:- ' g++' } \" \" ${download_path} /${package_source_directory} \" /configure --prefix=\" ${install_path} \" "
61+ FFLAGS= ${FFLAGS :- } FC=" ${FC:- ' gfortran' } " CC=" ${CC:- ' gcc' } " CXX=" ${CXX:- ' g++' } " " ${download_path} /${package_source_directory} " /configure --prefix=" ${install_path} "
5362 info " Building with the following command:"
5463 info " FC=\" ${FC:- ' gfortran' } \" CC=\" ${CC:- ' gcc' } \" CXX=\" ${CXX:- ' g++' } \" make -j\" ${num_threads} \" "
5564 FC=" ${FC:- ' gfortran' } " CC=" ${CC:- ' gcc' } " CXX=" ${CXX:- ' g++' } " make " -j${num_threads} "
5665 info " Installing ${package_to_build} in ${install_path} "
57- if [[ ! -z " ${SUDO:- } " ]]; then
66+ if [[ -n " ${SUDO:- } " ]]; then
5867 info " You do not have write permissions to the installation path ${install_path} "
5968 info " If you have administrative privileges, enter your password to install ${package_to_build} "
6069 fi
@@ -66,7 +75,7 @@ build_and_install()
6675 elif [[ ${package_to_build} == " gcc" ]]; then
6776
6877 info " pushd ${download_path} /${package_source_directory} "
69- pushd " ${download_path} /${package_source_directory} "
78+ pushd " ${download_path} /${package_source_directory} " || emergency " build_and_install.sh: pushd failed "
7079
7180 # Patch gfortran if necessary
7281 export patches_dir=" ${OPENCOARRAYS_SRC_DIR} /prerequisites/build-functions/patches/${package_to_build} /${version_to_build} "
@@ -87,13 +96,13 @@ build_and_install()
8796 " ${PWD} " /contrib/download_prerequisites
8897
8998 info " popd"
90- popd
99+ popd || emergency " build_and_install.sh: popd failed "
91100 info " Configuring gcc/g++/gfortran builds with the following command:"
92101 info " ${download_path} /${package_source_directory} /configure --prefix=${install_path} --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure} "
93- " ${download_path} /${package_source_directory} /configure" --prefix=" ${install_path} " --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure}
94- info " Building with the following command: ' make -j${num_threads} ${bootstrap_build} ' "
95- make " -j ${num_threads} " ${bootstrap_build}
96- if [[ ! -z " ${SUDO:- } " ]]; then
102+ " ${download_path} /${package_source_directory} /configure" --prefix=" ${install_path} " --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror " ${bootstrap_configure} "
103+ info " Building with the following command: make -j ${num_threads} ${bootstrap_build} "
104+ make -j ${num_threads} ${bootstrap_build:- }
105+ if [[ -n " ${SUDO:- } " ]]; then
97106 info " You do not have write permissions to the installation path ${install_path} "
98107 info " If you have administrative privileges, enter your password to install ${package_to_build} "
99108 fi
@@ -106,5 +115,5 @@ build_and_install()
106115
107116
108117 info " popd"
109- popd
118+ popd || emergency " build_and_install.sh: popd failed "
110119}
0 commit comments