Skip to content

Commit 90cfb59

Browse files
author
Damian Rouson
authored
Merge pull request #687 from sourceryinstitute/fix-#682-mojave-warning
Fix #682 macOS Mojave warning
2 parents 66cdbf5 + 99ae9d8 commit 90cfb59

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

prerequisites/build-functions/build_and_install.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# shellcheck source=prerequisites/build-functions/edit_GCC_download_prereqs_file_if_necessary.sh
66
source "${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/edit_GCC_download_prereqs_file_if_necessary.sh"
77

8+
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
9+
810
build_and_install()
911
{
1012
num_threads=${arg_j}
@@ -74,6 +76,33 @@ build_and_install()
7476

7577
elif [[ ${package_to_build} == "gcc" ]]; then
7678

79+
# Warn about header prerequisite on macOS Mojave or subsequent versions
80+
if [[ $(uname) == "Darwin" ]]; then
81+
export kernel=$(uname -r)
82+
export Mojave="18.7.0"
83+
if [ $(version $kernel) -ge $(version $Mojave) ]; then
84+
info ""
85+
info "______________________________________________________________________________"
86+
info "Detected Darwin $kernel >= $Mojave (Mojave). If $package_to_build build fails"
87+
info "due to a missing header (*.h) file, please try something like the following bash command:"
88+
info "open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg"
89+
info "Follow the prompts to install the missing headers. Then restart this $this_script."
90+
info "See https://bit.ly/build-gcc-on-mojave for more details."
91+
if [[ "${arg_y}" == "${__flag_present}" ]]; then
92+
info "-y or --yes-to-all flag present. Proceeding with non-interactive build."
93+
else
94+
info "Would you like to proceed anyway? (Y/n)"
95+
read -r proceed
96+
if [[ "${proceed}" == "n" || "${proceed}" == "N" || "${proceed}" == "no" ]]; then
97+
info "n"
98+
emergency "Aborting. [exit 80]"
99+
else
100+
info "y"
101+
fi
102+
fi
103+
fi
104+
fi
105+
77106
info "pushd ${download_path}/${package_source_directory} "
78107
pushd "${download_path}/${package_source_directory}" || emergency "build_and_install.sh: pushd failed"
79108

0 commit comments

Comments
 (0)