@@ -21,23 +21,32 @@ build_and_install()
21
21
fi
22
22
mkdir -p " ${build_path} "
23
23
info " pushd ${build_path} "
24
- pushd " ${build_path} "
24
+ pushd " ${build_path} " || emergency " build_and_install.sh: pushd failed "
25
25
26
26
if [[ " ${package_to_build} " != " gcc" ]]; then
27
27
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
33
42
fi
34
43
35
44
if [[ " ${package_to_build} " == " cmake" && $( uname) == " Linux" ]]; then
36
45
37
46
export cmake_binary_installer=" ${download_path} /cmake-${version_to_build} -Linux-x86_64.sh"
38
47
${SUDO:- } mkdir -p " $install_path "
39
48
chmod u+x " ${cmake_binary_installer} "
40
- if [[ ! -z " ${SUDO:- } " ]]; then
49
+ if [[ -n " ${SUDO:- } " ]]; then
41
50
info " You do not have write permissions to the installation path ${install_path} "
42
51
info " If you have administrative privileges, enter your password to install ${package_to_build} "
43
52
fi
@@ -48,13 +57,13 @@ build_and_install()
48
57
else # build from source
49
58
50
59
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} "
53
62
info " Building with the following command:"
54
63
info " FC=\" ${FC:- ' gfortran' } \" CC=\" ${CC:- ' gcc' } \" CXX=\" ${CXX:- ' g++' } \" make -j\" ${num_threads} \" "
55
64
FC=" ${FC:- ' gfortran' } " CC=" ${CC:- ' gcc' } " CXX=" ${CXX:- ' g++' } " make " -j${num_threads} "
56
65
info " Installing ${package_to_build} in ${install_path} "
57
- if [[ ! -z " ${SUDO:- } " ]]; then
66
+ if [[ -n " ${SUDO:- } " ]]; then
58
67
info " You do not have write permissions to the installation path ${install_path} "
59
68
info " If you have administrative privileges, enter your password to install ${package_to_build} "
60
69
fi
@@ -66,7 +75,7 @@ build_and_install()
66
75
elif [[ ${package_to_build} == " gcc" ]]; then
67
76
68
77
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 "
70
79
71
80
# Patch gfortran if necessary
72
81
export patches_dir=" ${OPENCOARRAYS_SRC_DIR} /prerequisites/build-functions/patches/${package_to_build} /${version_to_build} "
@@ -87,13 +96,13 @@ build_and_install()
87
96
" ${PWD} " /contrib/download_prerequisites
88
97
89
98
info " popd"
90
- popd
99
+ popd || emergency " build_and_install.sh: popd failed "
91
100
info " Configuring gcc/g++/gfortran builds with the following command:"
92
101
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
97
106
info " You do not have write permissions to the installation path ${install_path} "
98
107
info " If you have administrative privileges, enter your password to install ${package_to_build} "
99
108
fi
@@ -106,5 +115,5 @@ build_and_install()
106
115
107
116
108
117
info " popd"
109
- popd
118
+ popd || emergency " build_and_install.sh: popd failed "
110
119
}
0 commit comments