diff --git a/install.sh b/install.sh index 719146e44..28a5af011 100755 --- a/install.sh +++ b/install.sh @@ -168,6 +168,7 @@ info "-U (--print-url): ${arg_U}" info "-v (--version): ${arg_v}" info "-V (--print-version): ${arg_V}" info "-y (--yes-to-all): ${arg_y}" +info "-z (--disable-bootstrap):${arg_z}" } # This file is organized into three sections: # 1. Command-line argument and environment variable processing. @@ -293,14 +294,14 @@ elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}" || "${arg_l}" = elif [[ "${arg_p:-}" == "opencoarrays" ]]; then if [[ "${arg_o}" == "${__flag_present}" ]]; then - + # Download all prerequisites and exit info "source ${OPENCOARRAYS_SRC_DIR}/prerequisites/install-functions/download-all-prerequisites.sh" source "${OPENCOARRAYS_SRC_DIR}/prerequisites/install-functions/download-all-prerequisites.sh" info "download_all_prerequisites" download_all_prerequisites - else + else # Install OpenCoarrays cd prerequisites || exit 1 @@ -309,7 +310,7 @@ elif [[ "${arg_p:-}" == "opencoarrays" ]]; then source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh" version="$("${opencoarrays_src_dir}/install.sh" -V opencoarrays)" set_SUDO_if_needed_to_write_to_directory "${install_path}" - + # Using process substitution "> >(...) -" instead of piping to tee via "2>&1 |" ensures that # report_results gets the FC value set in build_opencoarrays # Source: http://stackoverflow.com/questions/8221227/bash-variable-losing-its-value-strange diff --git a/install.sh-usage b/install.sh-usage index 56bd9e49e..e1f2a11bd 100644 --- a/install.sh-usage +++ b/install.sh-usage @@ -21,3 +21,4 @@ -v --version Print OpenCoarrays version number. -V --print-version [arg] Print version number for specified package. -y --yes-to-all Build non-interactively by assuming affirmative user responses. + -z --disable-bootstrap Disabling bootstrap build of GCC for speed when a recent GCC is already installed. diff --git a/prerequisites/build-functions/build_and_install.sh b/prerequisites/build-functions/build_and_install.sh index 311063f21..e5a1b91fb 100644 --- a/prerequisites/build-functions/build_and_install.sh +++ b/prerequisites/build-functions/build_and_install.sh @@ -6,6 +6,7 @@ source "${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/edit_GCC_download_ build_and_install() { + num_threads=${arg_j} build_path="${OPENCOARRAYS_SRC_DIR}/prerequisites/builds/${package_to_build}-${version_to_build}" @@ -52,17 +53,17 @@ build_and_install() # Switch download mechanism, if wget is not available edit_GCC_download_prereqs_file_if_necessary - + # Download GCC prerequisities "${PWD}"/contrib/download_prerequisites info "popd" popd info "Configuring gcc/g++/gfortran builds with the following command:" - info "${download_path}/${package_source_directory}/configure --prefix=${install_path} --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror" - "${download_path}/${package_source_directory}/configure" --prefix="${install_path}" --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror - info "Building with the following command: 'make -j${num_threads} bootstrap'" - make "-j${num_threads}" bootstrap + info "${download_path}/${package_source_directory}/configure --prefix=${install_path} --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure}" + "${download_path}/${package_source_directory}/configure" --prefix="${install_path}" --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror ${bootstrap_configure} + info "Building with the following command: 'make -j${num_threads} ${bootstrap_build}'" + make "-j${num_threads}" ${bootstrap_build} if [[ ! -z "${SUDO:-}" ]]; then info "You do not have write permissions to the installation path ${install_path}" info "If you have administrative privileges, enter your password to install ${package_to_build}" @@ -71,7 +72,7 @@ build_and_install() ${SUDO:-} make install fi # end if [[ "${package_to_build}" != "gcc" ]]; then - + info "popd" popd } diff --git a/prerequisites/build.sh b/prerequisites/build.sh index 019ea25bd..e010369f6 100755 --- a/prerequisites/build.sh +++ b/prerequisites/build.sh @@ -111,6 +111,7 @@ info "-U (--print-url): ${arg_U} " info "-v (--version): ${arg_v} " info "-V (--print-version): ${arg_V} " info "-y (--yes-to-all): ${arg_y} " +info "-z (--disable-bootstrap):${arg_z} " } if [[ -z "${arg_B}" ]]; then @@ -147,6 +148,15 @@ if [[ ${arg_o:-} == "${__flag_present}" ]]; then exit 0 fi +# If -z or --disable-bootstrap was specified, disable bootstrap configure & build +if [[ ${arg_z:-} == "${__flag_present}" ]]; then + export bootstrap_configure="--disable-bootstrap" + export bootstrap_build="" +else + export bootstrap_configure="" + export bootstrap_build="bootstrap" +fi + if [[ -z "${arg_B}" ]]; then # shellcheck source=./build-functions/unpack_if_necessary.sh source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh" @@ -155,7 +165,7 @@ if [[ -z "${arg_B}" ]]; then # shellcheck source=./build-functions/set_compilers.sh source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh" set_compilers - + # shellcheck source=./build-functions/build_and_install.sh source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh" build_and_install diff --git a/prerequisites/build.sh-usage b/prerequisites/build.sh-usage index 3920c173c..2b1826452 100644 --- a/prerequisites/build.sh-usage +++ b/prerequisites/build.sh-usage @@ -23,3 +23,4 @@ -v --version Print OpenCoarrays version number. -V --print-version [arg] Print installation version for package specified in argument. -y --yes-to-all Build non-interactively by assuming affirmative user responses. + -z --disable-bootstrap Disabling bootstrap build of GCC for speed when a recent GCC is already installed.