|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +if [[ ! -f src/libcaf.h ]]; then |
| 4 | + echo "Run this script at the top level of the OpenCoarrays source tree." |
| 5 | + exit 1 |
| 6 | +fi |
| 7 | + |
| 8 | +: "${1?'Missing absolute path to patch file'}" |
| 9 | + |
| 10 | +# Absolute path to patch file |
| 11 | +patch_file="${1}" |
| 12 | + |
| 13 | +# Exit on error: |
| 14 | +set -o errexit |
| 15 | + |
| 16 | +# Exit on use of unset variable: |
| 17 | +set -o nounset |
| 18 | + |
| 19 | +# Return the highest exit code in a chain of pipes: |
| 20 | +set -o pipefail |
| 21 | + |
| 22 | +# Install the GCC trunk to default location: prerequisites/installations/gcc/trunk (takes several hours): |
| 23 | +./install.sh --package gcc --install-branch trunk --yes-to-all |
| 24 | + |
| 25 | +# Patch the GCC trunk and rebuild (should be much faster than the initial build): |
| 26 | +echo "Patching the GCC source." |
| 27 | +pushd prerequistes/downloads/trunk |
| 28 | + patch -p0 < "${patch_file}" |
| 29 | +popd |
| 30 | + |
| 31 | +echo "Rebuilding the patched GCC source." |
| 32 | +./install.sh --package gcc --install-branch trunk --yes-to-all |
| 33 | + |
| 34 | +# Ensure the just-installed libraries are used when compiling |
| 35 | +export LD_LIBRARY_PATH="${PWD}/prerequisites/installations/gcc/trunk/lib64":"${LD_LIBRARY_PATH}" |
| 36 | + |
| 37 | +# Build MPICH with the patched compiler and install MPICH in the default location: prerequisites/installations/mpich/3.1.4: |
| 38 | +./install.sh --package mpich --yes-to-all \ |
| 39 | + --with-fortran "${PWD}/prerequisites/installations/gcc/trunk/bin/gfortran" \ |
| 40 | + --with-c "${PWD}/prerequisites/installations/gcc/trunk/bin/gcc" \ |
| 41 | + --with-C "${PWD}/prerequisites/installations/gcc/trunk/bin/g++" |
| 42 | + |
| 43 | +# Build OpenCoarrays with the patched compiler and install OpenCoarrays in the default location: prerequisites/installations: |
| 44 | +./install.sh ---yes-to-all \ |
| 45 | + --with-fortran "${PWD}/prerequisites/installations/gcc/trunk/bin/gfortran" \ |
| 46 | + --with-c "${PWD}/prerequisites/installations/gcc/trunk/bin/gcc" \ |
| 47 | + --with-C "${PWD}/prerequisites/installations/gcc/trunk/bin/g++" |
| 48 | + --with-mpi "${PWD}/prerequisites/installations/mpich/3.1.4/" |
0 commit comments