Skip to content

Commit a98ed67

Browse files
author
Damian Rouson
committed
patched-trunk install script optn: unpatched build
1 parent 7fba091 commit a98ed67

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

developer-scripts/patched-trunk-install.sh renamed to developer-scripts/gcc-trunk-install.sh

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
#!/usr/bin/env bash
22

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
49

510
# Print usage information and exit if this script was invoked with no arugments or with -h or --help
611
# as the first argument or in a location other than the top-level OpenCoarrays source directory
712
function usage()
813
{
914
echo "Usage:"
1015
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."
1219
exit 1
1320
}
14-
[[ $# -eq 0 || "${1}" == "-h" || "${1}" == "--help" || ! -f src/libcaf.h ]] && usage
21+
[[ "${1:-}" == "-h" || "${1:-}" == "--help" || ! -f src/libcaf.h ]] && usage
1522

16-
patch_file="${1}"
23+
patch_file="${1:-}"
1724

1825
function set_absolute_path()
1926
{
@@ -27,14 +34,10 @@ function set_absolute_path()
2734
absolute_path="${PWD%%/}/${arg}"
2835
fi
2936
}
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
3540

36-
# Return the highest exit code in a chain of pipes:
37-
set -o pipefail
3841

3942
### Define functions
4043
function choose_package_manager()
@@ -122,12 +125,14 @@ install_if_missing flex
122125
# Download and build the GCC trunk:
123126
echo "Downloading the GCC trunk."
124127
./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
131136

132137
# Build the patched GCC trunk
133138
echo "Rebuilding the patched GCC source."
@@ -159,7 +164,7 @@ if [[ -d "${PWD}/prerequisites/installations/gcc/trunk/lib" ]]; then
159164
prepend_to_LD_LIBRARY_PATH "${patched_GCC_install_path}/lib/"
160165
fi
161166

162-
if [[ -d "${PWD}/prerequisites/installations/gcc/trunk/lib64" ]]; then
167+
if [[ -d "${PWD}/prerequisites/installations/gcc/trunk/lib64" ]]; then
163168
prepend_to_LD_LIBRARY_PATH "${patched_GCC_install_path}/lib64/"
164169
fi
165170

@@ -172,7 +177,10 @@ fi
172177

173178
# Build MPICH with the patched compilers.
174179
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 \
176184
--with-fortran "${patched_GCC_install_path}/bin/gfortran" \
177185
--with-c "${patched_GCC_install_path}/bin/gcc" \
178186
--with-cxx "${patched_GCC_install_path}/bin/g++"
@@ -186,8 +194,11 @@ fi
186194

187195
# Build OpenCoarrays with the patched compilers and the just-built MPICH
188196
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 \
191202
--with-fortran "${patched_GCC_install_path}/bin/gfortran" \
192203
--with-c "${patched_GCC_install_path}/bin/gcc" \
193204
--with-cxx "${patched_GCC_install_path}/bin/g++" \

0 commit comments

Comments
 (0)