@@ -12,15 +12,30 @@ set -o pipefail
1212function usage()
1313{
1414 echo " Usage:"
15+ echo " "
1516 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>]"
1720 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
2023}
2124[[ " ${1:- } " == " -h" || " ${1:- } " == " --help" || ! -f src/libcaf.h ]] && usage
2225
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} } "
2439
2540function set_absolute_path()
2641{
@@ -34,11 +49,10 @@ function set_absolute_path()
3449 absolute_path=" ${PWD%%/ } /${arg} "
3550 fi
3651}
37- if [[ ! -z " ${1 :- } " ]]; then
52+ if [[ ! -z " ${patch_file :- } " ]]; then
3853 set_absolute_path " ${patch_file} "
3954fi
4055
41-
4256# ## Define functions
4357function choose_package_manager()
4458{
@@ -124,7 +138,7 @@ install_if_missing flex
124138
125139# Download and build the GCC trunk:
126140echo " 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
128142
129143if [[ ! -z " ${absolute_path:- } " ]]; then
130144 # Patch the GCC trunk and rebuild
@@ -134,14 +148,20 @@ if [[ ! -z "${absolute_path:-}" ]]; then
134148 popd
135149fi
136150
151+ export GCC_install_prefix=${install_prefix} /gcc/trunk
137152# Build the patched GCC trunk
138153echo " 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} "
140161
141162# 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} ."
145165 exit 1
146166fi
147167
@@ -160,46 +180,45 @@ function prepend_to_LD_LIBRARY_PATH() {
160180
161181old_path=" ${LD_LIBRARY_PATH:- } "
162182
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/"
169185fi
170186
171187echo " \$ {LD_LIBRARY_PATH}=${LD_LIBRARY_PATH:= } "
172188
173189if [[ " ${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"
175191 exit 1
176192fi
177193
178194# Build MPICH with the patched compilers.
179195echo " Building MPICH with the patched compilers."
196+ export mpich_install_prefix=" ${install_prefix} /mpich/3.2/gnu/trunk"
180197./install.sh \
181198 --package mpich \
182199 --num-threads 4 \
183200 --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} "
187205
188206# 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} ."
192209 exit 1
193210fi
194211
195212# 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)
197215./install.sh \
198216 --package opencoarrays \
199217 --disable-bootstrap \
200218 --num-threads 4 \
201219 --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