Skip to content

Commit 9fe0eb6

Browse files
author
Damian Rouson
committed
update installer to work on macOS Catalina
1 parent 61e604c commit 9fe0eb6

File tree

5 files changed

+48
-32
lines changed

5 files changed

+48
-32
lines changed

prerequisites/build-functions/build_and_install.sh

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,30 @@ build_and_install()
7979
# Warn about header prerequisite on macOS Mojave or subsequent versions
8080
if [[ $(uname) == "Darwin" ]]; then
8181
export kernel=$(uname -r)
82-
export Mojave="18.7.0"
82+
export Mojave="18.0.0"
83+
export Catalina="19.0.0"
8384
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."
85+
if [ $(version $kernel) -ge $(version $Catalina) ]; then
86+
export with_sysroot="--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
9387
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]"
88+
info ""
89+
info "______________________________________________________________________________"
90+
info "Detected Darwin $kernel (Mojave). If $package_to_build build fails due to a"
91+
info "missing header (*.h) file, please try something like the following bash command:"
92+
info "open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg"
93+
info "Follow the prompts to install the missing headers. Then restart this $this_script."
94+
info "See https://bit.ly/build-gcc-on-mojave for more details."
95+
if [[ "${arg_y}" == "${__flag_present}" ]]; then
96+
info "-y or --yes-to-all flag present. Proceeding with non-interactive build."
9997
else
100-
info "y"
98+
info "Would you like to proceed anyway? (Y/n)"
99+
read -r proceed
100+
if [[ "${proceed}" == "n" || "${proceed}" == "N" || "${proceed}" == "no" ]]; then
101+
info "n"
102+
emergency "Aborting. [exit 80]"
103+
else
104+
info "y"
105+
fi
101106
fi
102107
fi
103108
fi
@@ -127,8 +132,8 @@ build_and_install()
127132
info "popd"
128133
popd || emergency "build_and_install.sh: popd failed"
129134
info "Configuring gcc/g++/gfortran builds with the following command:"
130-
info "${download_path}/${package_source_directory}/configure --prefix=${install_path} --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure}"
131-
"${download_path}/${package_source_directory}/configure" --prefix="${install_path}" --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror "${bootstrap_configure}"
135+
info "${download_path}/${package_source_directory}/configure --prefix=${install_path} --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure} ${with_sysroot:-}"
136+
"${download_path}/${package_source_directory}/configure" --prefix="${install_path}" --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror "${bootstrap_configure}" "${with_sysroot:-}"
132137
info "Building with the following command: make -j ${num_threads} ${bootstrap_build}"
133138
make -j ${num_threads} ${bootstrap_build:-}
134139
if [[ -n "${SUDO:-}" ]]; then

prerequisites/build-functions/download_if_necessary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ download_if_necessary()
5858
;;
5959
esac
6060

61-
if [[ -f "${download_path}/${url_tail}" || -d "${download_path}/${url_tail##*branches/}" && ! -z ${url_tail##*branches/} ]]; then
61+
if [[ -f "${download_path}/${url_tail}" || -d "${download_path}/${url_tail}" ]]; then
6262
info "Found '${url_tail##*branches/}' in ${download_path}."
6363
info "If it resulted from an incomplete download, building ${package_name} could fail."
6464
if [[ "${arg_y}" == "${__flag_present}" ]]; then

prerequisites/build-functions/set_or_print_default_version.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ set_or_print_default_version()
2020
exit 0
2121
fi
2222

23+
if [[ $(uname) == "Darwin" ]]; then
24+
apple_flex_version="2.5.35"
25+
fi
26+
2327
[ "${package_name}" == "opencoarrays" ] &&
2428
emergency "Please use this script with a previously downloaded opencoarrays source archive. This script does not download opencoarrays "
2529
# This is a bash 3 hack standing in for a bash 4 hash (bash 3 is the lowest common
@@ -30,7 +34,7 @@ set_or_print_default_version()
3034
"gcc:10.1.0"
3135
"mpich:3.2"
3236
"wget:1.16.3"
33-
"flex:2.6.0"
37+
"flex:${apple_flex_version:-2.6.0}"
3438
"bison:3.0.4"
3539
"pkg-config:0.28"
3640
"make:4.1"

prerequisites/build-functions/set_or_print_url.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ else
4646

4747
# Set differing tails for GCC release downloads versus development branch checkouts
4848
package_url_tail=(
49-
"gcc;gcc.git"
49+
"gcc;gcc"
5050
"wget;wget-${version_to_build-}.tar.gz"
5151
"m4;m4-${version_to_build-}.tar.bz2"
5252
"pkg-config;pkg-config-${version_to_build-}.tar.gz"

prerequisites/check_version.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# -- Verify whether an OpenCoarrays prerequisite meets the required minimum version number.
66
#
77
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
8-
# Copyright (c) 2015-2016, Sourcery, Inc.
9-
# Copyright (c) 2015-2016, Sourcery Institute
8+
# Copyright (c) 2015-2020, Sourcery, Inc.
9+
# Copyright (c) 2015-2020, Sourcery Institute
1010
# All rights reserved.
1111
#
1212
# Redistribution and use in source and binary forms, with or without modification,
@@ -44,7 +44,7 @@ this_script=$(basename "$0")
4444
usage()
4545
{
4646
echo ""
47-
echo " $this_script - Bash script for verifyin minimum version numbers for OpenCoarrays prerequisites"
47+
echo " $this_script - Bash script for verifying minimum version numbers for OpenCoarrays prerequisites"
4848
echo ""
4949
echo " Usage (optional arguments in square brackets): "
5050
echo " $this_script [<option>]"
@@ -104,21 +104,28 @@ if [[ "$verbose" == "--verbose" ]]; then
104104
echo "$package_version_header"
105105
fi
106106

107-
# Extract the text after the final space:
108-
version=${package_version_header##* }
109-
major=${version%%.*}
110-
minor_patch=${version#*.}
111-
minor=${minor_patch%%.*}
112-
patch=${version##*.}
107+
before_first_dot="${package_version_header%%.*}"
108+
major="${before_first_dot##* }" # grab text after final space in remaining string
109+
110+
after_first_dot="${package_version_header#*.}"
111+
minor="${after_first_dot%%.*}"
112+
113+
after_final_dot="${package_version_header##*.}" # grab text after final dot
114+
if [[ "$after_final_dot" == "$after_first_dot" ]]; then
115+
patch=""
116+
else
117+
patch="${after_final_dot%% *}"
118+
fi
119+
113120
if [[ "$verbose" == "--verbose" ]]; then
114-
echo "$version = $major . $minor . $patch"
121+
echo "$major . $minor . $patch"
115122
fi
116123

117-
# Extract the text after the final space:
118124
min_major=${minimum_version%%.*}
119125
min_minor_patch=${minimum_version#*.}
120126
min_minor=${min_minor_patch%%.*}
121127
min_patch=${minimum_version##*.}
128+
122129
if [[ "$verbose" == "--verbose" ]]; then
123130
echo "$minimum_version = $min_major . $min_minor . $min_patch"
124131
fi

0 commit comments

Comments
 (0)