|
5 | 5 | # shellcheck source=prerequisites/build-functions/edit_GCC_download_prereqs_file_if_necessary.sh
|
6 | 6 | source "${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/edit_GCC_download_prereqs_file_if_necessary.sh"
|
7 | 7 |
|
| 8 | +function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } |
| 9 | + |
8 | 10 | build_and_install()
|
9 | 11 | {
|
10 | 12 | num_threads=${arg_j}
|
@@ -74,6 +76,33 @@ build_and_install()
|
74 | 76 |
|
75 | 77 | elif [[ ${package_to_build} == "gcc" ]]; then
|
76 | 78 |
|
| 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 | + |
77 | 106 | info "pushd ${download_path}/${package_source_directory} "
|
78 | 107 | pushd "${download_path}/${package_source_directory}" || emergency "build_and_install.sh: pushd failed"
|
79 | 108 |
|
|
0 commit comments