1
1
#! /usr/bin/env bash
2
2
3
- # ## Diagnostics ###
3
+ # Exit on error or use of an unset variable:
4
+ set -o errexit
5
+ set -o nounset
6
+
7
+ # Return the highest exit code in a chain of pipes:
8
+ set -o pipefail
4
9
5
10
# Print usage information and exit if this script was invoked with no arugments or with -h or --help
6
11
# as the first argument or in a location other than the top-level OpenCoarrays source directory
7
12
function usage()
8
13
{
9
14
echo " Usage:"
10
15
echo " cd <opencoarrays-source-directory>"
11
- echo " ./developer_scripts/patched-trunk-install.sh <patch-file>"
16
+ echo " ./developer_scripts/patched-trunk-install.sh [patch-file]"
17
+ echo " "
18
+ echo " where omitting the patch file builds the unpatched GCC trunk."
12
19
exit 1
13
20
}
14
- [[ $# -eq 0 || " ${1} " == " -h" || " ${1} " == " --help" || ! -f src/libcaf.h ]] && usage
21
+ [[ " ${1:- } " == " -h" || " ${1:- } " == " --help" || ! -f src/libcaf.h ]] && usage
15
22
16
- patch_file=" ${1} "
23
+ patch_file=" ${1:- } "
17
24
18
25
function set_absolute_path()
19
26
{
@@ -27,14 +34,10 @@ function set_absolute_path()
27
34
absolute_path=" ${PWD%%/ } /${arg} "
28
35
fi
29
36
}
30
- set_absolute_path " ${patch_file} "
31
-
32
- # Exit on error or use of an unset variable:
33
- set -o errexit
34
- set -o nounset
37
+ if [[ ! -z " ${1:- } " ]]; then
38
+ set_absolute_path " ${patch_file} "
39
+ fi
35
40
36
- # Return the highest exit code in a chain of pipes:
37
- set -o pipefail
38
41
39
42
# ## Define functions
40
43
function choose_package_manager()
@@ -122,12 +125,14 @@ install_if_missing flex
122
125
# Download and build the GCC trunk:
123
126
echo " Downloading the GCC trunk."
124
127
./install.sh --only-download --package gcc --install-branch trunk
125
-
126
- # Patch the GCC trunk and rebuild
127
- echo " Patching the GCC source using ${absolute_path} ."
128
- pushd prerequisites/downloads/trunk
129
- patch -p0 < " ${absolute_path} "
130
- popd
128
+
129
+ if [[ ! -z " ${absolute_path:- } " ]]; then
130
+ # Patch the GCC trunk and rebuild
131
+ echo " Patching the GCC source using ${absolute_path} ."
132
+ pushd prerequisites/downloads/trunk
133
+ patch -p0 < " ${absolute_path} "
134
+ popd
135
+ fi
131
136
132
137
# Build the patched GCC trunk
133
138
echo " Rebuilding the patched GCC source."
@@ -159,7 +164,7 @@ if [[ -d "${PWD}/prerequisites/installations/gcc/trunk/lib" ]]; then
159
164
prepend_to_LD_LIBRARY_PATH " ${patched_GCC_install_path} /lib/"
160
165
fi
161
166
162
- if [[ -d " ${PWD} /prerequisites/installations/gcc/trunk/lib64" ]]; then
167
+ if [[ -d " ${PWD} /prerequisites/installations/gcc/trunk/lib64" ]]; then
163
168
prepend_to_LD_LIBRARY_PATH " ${patched_GCC_install_path} /lib64/"
164
169
fi
165
170
172
177
173
178
# Build MPICH with the patched compilers.
174
179
echo " Building MPICH with the patched compilers."
175
- ./install.sh --package mpich --yes-to-all \
180
+ ./install.sh \
181
+ --package mpich \
182
+ --num-threads 4 \
183
+ --yes-to-all \
176
184
--with-fortran " ${patched_GCC_install_path} /bin/gfortran" \
177
185
--with-c " ${patched_GCC_install_path} /bin/gcc" \
178
186
--with-cxx " ${patched_GCC_install_path} /bin/g++"
186
194
187
195
# Build OpenCoarrays with the patched compilers and the just-built MPICH
188
196
echo " Building OpenCoarrays with the patched compilers"
189
- # Build OpenCoarrays with the patched compiler:
190
- ./install.sh --yes-to-all \
197
+ ./install.sh \
198
+ --package opencoarrays \
199
+ --disable-bootstrap \
200
+ --num-threads 4 \
201
+ --yes-to-all \
191
202
--with-fortran " ${patched_GCC_install_path} /bin/gfortran" \
192
203
--with-c " ${patched_GCC_install_path} /bin/gcc" \
193
204
--with-cxx " ${patched_GCC_install_path} /bin/g++" \
0 commit comments