@@ -12,15 +12,30 @@ set -o pipefail
12
12
function usage()
13
13
{
14
14
echo " Usage:"
15
+ echo " "
15
16
echo " cd <opencoarrays-source-directory>"
16
- echo " ./developer_scripts/patched-trunk-install.sh [patch-file]"
17
+ echo " ./developer_scripts/gcc-trunk-install.sh [--patch-file <patch-file-name>] [--install-prefix <installation-path>]"
18
+ echo " or"
19
+ echo " ./developer_scripts/gcc-trunk-install.sh [-p <patch-file-name>] [-i <installation-path>]"
17
20
echo " "
18
- echo " where omitting the patch file builds the unpatched GCC trunk ."
19
- exit 1
21
+ echo " Square brackets surround optional arguments ."
22
+ exit 0
20
23
}
21
24
[[ " ${1:- } " == " -h" || " ${1:- } " == " --help" || ! -f src/libcaf.h ]] && usage
22
25
23
- patch_file=" ${1:- } "
26
+ if [[ " ${1:- } " == " -i" || " ${1:- } " == " --install-prefix" ]]; then
27
+ export install_prefix=" ${2} "
28
+ if [[ " ${3:- } " == " -i" || " ${3:- } " == " --install-prefix" ]]; then
29
+ export patch_file=" ${4} "
30
+ fi
31
+ elif [[ " ${1:- } " == " -p" || " ${1:- } " == " --patch-file" ]]; then
32
+ export patch_file=" ${2:- } "
33
+ if [[ " ${3:- } " == " -i" || " ${3:- } " == " --install-prefix" ]]; then
34
+ export install_prefix=" ${4} "
35
+ fi
36
+ fi
37
+ export default_prefix=" ${HOME} /opt"
38
+ export install_prefix=" ${install_prefix:- ${default_prefix} } "
24
39
25
40
function set_absolute_path()
26
41
{
@@ -34,11 +49,10 @@ function set_absolute_path()
34
49
absolute_path=" ${PWD%%/ } /${arg} "
35
50
fi
36
51
}
37
- if [[ ! -z " ${1 :- } " ]]; then
52
+ if [[ ! -z " ${patch_file :- } " ]]; then
38
53
set_absolute_path " ${patch_file} "
39
54
fi
40
55
41
-
42
56
# ## Define functions
43
57
function choose_package_manager()
44
58
{
@@ -124,7 +138,7 @@ install_if_missing flex
124
138
125
139
# Download and build the GCC trunk:
126
140
echo " Downloading the GCC trunk."
127
- ./install.sh --only-download --package gcc --install-branch trunk
141
+ ./install.sh --only-download --package gcc --install-branch trunk --yes-to-all
128
142
129
143
if [[ ! -z " ${absolute_path:- } " ]]; then
130
144
# Patch the GCC trunk and rebuild
@@ -134,14 +148,20 @@ if [[ ! -z "${absolute_path:-}" ]]; then
134
148
popd
135
149
fi
136
150
151
+ export GCC_install_prefix=${install_prefix} /gcc/trunk
137
152
# Build the patched GCC trunk
138
153
echo " Rebuilding the patched GCC source."
139
- ./install.sh --package gcc --install-branch trunk --yes-to-all
154
+ ./install.sh \
155
+ --package gcc \
156
+ --install-branch trunk \
157
+ --yes-to-all \
158
+ --num-threads 4 \
159
+ --disable-bootstrap \
160
+ --install-prefix " ${GCC_install_prefix} "
140
161
141
162
# Verify that GCC installed in the expected path
142
- patched_GCC_install_path=${PWD} /prerequisites/installations/gcc/trunk
143
- if ! type " ${patched_GCC_install_path} " /bin/gfortran >& /dev/null; then
144
- echo " gfortran is not installed in the expected location ${patched_GCC_install_path} ."
163
+ if ! type " ${GCC_install_prefix} " /bin/gfortran >& /dev/null; then
164
+ echo " gfortran is not installed in the expected location ${GCC_install_prefix} ."
145
165
exit 1
146
166
fi
147
167
@@ -160,46 +180,45 @@ function prepend_to_LD_LIBRARY_PATH() {
160
180
161
181
old_path=" ${LD_LIBRARY_PATH:- } "
162
182
163
- if [[ -d " ${PWD} /prerequisites/installations/gcc/trunk/lib" ]]; then
164
- prepend_to_LD_LIBRARY_PATH " ${patched_GCC_install_path} /lib/"
165
- fi
166
-
167
- if [[ -d " ${PWD} /prerequisites/installations/gcc/trunk/lib64" ]]; then
168
- prepend_to_LD_LIBRARY_PATH " ${patched_GCC_install_path} /lib64/"
183
+ if [[ -d " ${GCC_install_prefix} /lib64" ]]; then
184
+ prepend_to_LD_LIBRARY_PATH " ${GCC_install_prefix} /lib64/"
169
185
fi
170
186
171
187
echo " \$ {LD_LIBRARY_PATH}=${LD_LIBRARY_PATH:= } "
172
188
173
189
if [[ " ${LD_LIBRARY_PATH} " == " ${old_path} " ]]; then
174
- echo " gfortran libraries did not install where expected: ${patched_GCC_install_path } /lib64 or ${patched_GCC_install_path } /lib"
190
+ echo " gfortran libraries did not install where expected: ${GCC_install_prefix } /lib64 or ${GCC_install_prefix } /lib"
175
191
exit 1
176
192
fi
177
193
178
194
# Build MPICH with the patched compilers.
179
195
echo " Building MPICH with the patched compilers."
196
+ export mpich_install_prefix=" ${install_prefix} /mpich/3.2/gnu/trunk"
180
197
./install.sh \
181
198
--package mpich \
182
199
--num-threads 4 \
183
200
--yes-to-all \
184
- --with-fortran " ${patched_GCC_install_path} /bin/gfortran" \
185
- --with-c " ${patched_GCC_install_path} /bin/gcc" \
186
- --with-cxx " ${patched_GCC_install_path} /bin/g++"
201
+ --with-fortran " ${GCC_install_prefix} /bin/gfortran" \
202
+ --with-c " ${GCC_install_prefix} /bin/gcc" \
203
+ --with-cxx " ${GCC_install_prefix} /bin/g++" \
204
+ --install-prefix " ${mpich_install_prefix} "
187
205
188
206
# Verify that MPICH installed where expected
189
- mpich_install_path=$( ./install.sh -P mpich)
190
- if ! type " ${mpich_install_path} " /bin/mpifort; then
191
- echo " MPICH is not installed in the expected location ${mpich_install_path} ."
207
+ if ! type " ${mpich_install_prefix} " /bin/mpifort; then
208
+ echo " MPICH is not installed in the expected location ${mpich_install_prefix} ."
192
209
exit 1
193
210
fi
194
211
195
212
# Build OpenCoarrays with the patched compilers and the just-built MPICH
196
- echo " Building OpenCoarrays with the patched compilers"
213
+ echo " Building OpenCoarrays."
214
+ export opencoarrays_version=$( ./install.sh --version)
197
215
./install.sh \
198
216
--package opencoarrays \
199
217
--disable-bootstrap \
200
218
--num-threads 4 \
201
219
--yes-to-all \
202
- --with-fortran " ${patched_GCC_install_path} /bin/gfortran" \
203
- --with-c " ${patched_GCC_install_path} /bin/gcc" \
204
- --with-cxx " ${patched_GCC_install_path} /bin/g++" \
205
- --with-mpi " ${mpich_install_path} "
220
+ --with-fortran " ${GCC_install_prefix} /bin/gfortran" \
221
+ --with-c " ${GCC_install_prefix} /bin/gcc" \
222
+ --with-cxx " ${GCC_install_prefix} /bin/g++" \
223
+ --with-mpi " ${mpich_install_prefix} " \
224
+ --install-prefix " ${install_prefix} /opencoarrays/${opencoarrays_version} /gnu/trunk"
0 commit comments