Skip to content

Commit

Permalink
Merge pull request #687 from sourceryinstitute/fix-#682-mojave-warning
Browse files Browse the repository at this point in the history
Fix #682 macOS Mojave warning
  • Loading branch information
rouson authored Oct 8, 2019
2 parents 66cdbf5 + 99ae9d8 commit 90cfb59
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions prerequisites/build-functions/build_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# shellcheck source=prerequisites/build-functions/edit_GCC_download_prereqs_file_if_necessary.sh
source "${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/edit_GCC_download_prereqs_file_if_necessary.sh"

function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }

build_and_install()
{
num_threads=${arg_j}
Expand Down Expand Up @@ -74,6 +76,33 @@ build_and_install()

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

# Warn about header prerequisite on macOS Mojave or subsequent versions
if [[ $(uname) == "Darwin" ]]; then
export kernel=$(uname -r)
export Mojave="18.7.0"
if [ $(version $kernel) -ge $(version $Mojave) ]; then
info ""
info "______________________________________________________________________________"
info "Detected Darwin $kernel >= $Mojave (Mojave). If $package_to_build build fails"
info "due to a missing header (*.h) file, please try something like the following bash command:"
info "open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg"
info "Follow the prompts to install the missing headers. Then restart this $this_script."
info "See https://bit.ly/build-gcc-on-mojave for more details."
if [[ "${arg_y}" == "${__flag_present}" ]]; then
info "-y or --yes-to-all flag present. Proceeding with non-interactive build."
else
info "Would you like to proceed anyway? (Y/n)"
read -r proceed
if [[ "${proceed}" == "n" || "${proceed}" == "N" || "${proceed}" == "no" ]]; then
info "n"
emergency "Aborting. [exit 80]"
else
info "y"
fi
fi
fi
fi

info "pushd ${download_path}/${package_source_directory} "
pushd "${download_path}/${package_source_directory}" || emergency "build_and_install.sh: pushd failed"

Expand Down

0 comments on commit 90cfb59

Please sign in to comment.