1+ # shellcheck shell=bash
12# Make the build directory, configure, and build
23# shellcheck disable=SC2154
34
@@ -6,7 +7,6 @@ source "${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/edit_GCC_download_
67
78build_and_install ()
89{
9-
1010 num_threads=${arg_j}
1111 build_path=" ${OPENCOARRAYS_SRC_DIR} /prerequisites/builds/${package_to_build} -${version_to_build} "
1212
@@ -45,13 +45,22 @@ build_and_install()
4545
4646 else # ${package_to_build} == "gcc"
4747
48- # Use GCC's contrib/download_prerequisites script after modifying it, if necessary, to use the
49- # the preferred download mechanism set in prerequisites/build-functions/set_or_print_downloader.sh
50-
5148 info " pushd ${download_path} /${package_source_directory} "
5249 pushd " ${download_path} /${package_source_directory} "
5350
54- # Switch download mechanism, if wget is not available
51+ # Patch gfortran if necessary
52+ export patches_dir=" ${OPENCOARRAYS_SRC_DIR} /prerequisites/build-functions/patches/${package_to_build} /${version_to_build} "
53+ if [[ -d " ${patches_dir:- } " ]]; then
54+ for patch in " ${patches_dir%/ } " /* .diff ; do
55+ info " Applying patch ${patch##*/ } to $package_to_build ${version_to_build} ."
56+ patch -p1 < " $patch "
57+ done
58+ fi
59+
60+ # Use GCC's contrib/download_prerequisites script after modifying it, if necessary, to use the
61+ # the preferred download mechanism set in prerequisites/build-functions/set_or_print_downloader.sh
62+
63+ # Switch download mechanism if wget is not available
5564 edit_GCC_download_prereqs_file_if_necessary
5665
5766 # Download GCC prerequisities
0 commit comments