Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,25 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "

# shellcheck disable=SC2154
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]]; then
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D:-${arg_B}}}}}" ]]; then
print_debug_only=7
if [ "$(( LOG_LEVEL < print_debug_only ))" -ne 0 ]; then
debug "Supressing info and debug messages: one of {-l, -v, -P, -U, -V, -D} present."
suppress_info_debug_messages
fi
fi

[ ! -z "${arg_D}" ] && [ ! -z "${arg_P:-${arg_U:-${arg_V}}}" ] &&
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 101]"
[ ! -z "${arg_D}" ] && [ ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}" ] &&
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 101]"

[ ! -z "${arg_P}" ] && [ ! -z "${arg_U:-${arg_V}}" ] &&
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 103]"
[ ! -z "${arg_P}" ] && [ ! -z "${arg_U:-${arg_V:-${arg_B}}}" ] &&
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 102]"

[ ! -z "${arg_U}" ] && [ ! -z "${arg_V}" ] &&
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 104]"
[ ! -z "${arg_U}" ] && [ ! -z "${arg_V:-${arg_B}}" ] &&
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 103]"

[ ! -z "${arg_V}" ] && [ ! -z "${arg_B}" ] &&
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 104]"

### Print bootstrapped magic variables to STDERR when LOG_LEVEL
### is at the default value (6) or above.
Expand All @@ -142,6 +145,8 @@ info "__os: ${__os}"
info "__usage: ${__usage}"
info "LOG_LEVEL: ${LOG_LEVEL}"

info "-b (--install-branch): ${arg_b}"
info "-B (--list-branches): ${arg_B}"
info "-c (--with-c): ${arg_c}"
info "-C (--with-cxx): ${arg_C}"
info "-d (--debug): ${arg_d}"
Expand Down Expand Up @@ -231,7 +236,6 @@ source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh

# ________________________________ Start of the Main Body ___________________________________


if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then

# Print script copyright if invoked with -v, -V, or --version argument
Expand All @@ -255,10 +259,11 @@ if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
echo "${opencoarrays_version//[[:space:]]/}"
fi

elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__flag_present}" ]]; then
elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}" || "${arg_l}" == "${__flag_present}" ]]; then

# Delegate to build.sh for the packages it builds
build_arg=${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_p}}}}}
build_arg=${arg_B:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_p}}}}}}
[ ! -z "${arg_B}" ] && build_flag="-B"
[ ! -z "${arg_D}" ] && build_flag="-D"
[ ! -z "${arg_P}" ] && build_flag="-P"
[ ! -z "${arg_U}" ] && build_flag="-U"
Expand All @@ -284,7 +289,6 @@ elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__fla
fi

elif [[ "${arg_p:-}" == "opencoarrays" ]]; then


cd prerequisites || exit 1
installation_record=install-opencoarrays.log
Expand Down
2 changes: 2 additions & 0 deletions install.sh-usage
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-b --branch [arg] Install the specified repository development branch.
-B --list-branches [arg] List the available branches in the specified package's repository.
-c --with-c [arg] Use specified C compiler.
-C --with-cxx [arg] Use specified C++ compiler.
-d --debug Enable debug mode.
Expand Down
34 changes: 17 additions & 17 deletions prerequisites/build-functions/download_if_necessary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ download_if_necessary()
else
# The download mechanism is in the path.
if [[ "${fetch}" == "svn" ]]; then
if [[ ${version_to_build} == '--avail' || ${version_to_build} == '-a' ]]; then
if [[ "${arg_B:-}" == "gcc" ]]; then
args="ls"
else
args="checkout"
Expand All @@ -59,29 +59,29 @@ download_if_necessary()
else
package_source_directory="${package_name}-${version_to_build}"
fi
info "Downloading ${package_name} ${version_to_build} to the following location:"
info "Downloading ${package_name} ${version_to_build-} to the following location:"
info "${download_path}/${package_source_directory}"
info "Download command: \"${fetch}\" ${args:-} ${package_url}"
info "Depending on the file size and network bandwidth, this could take several minutes or longer."
pushd "${download_path}"
"${fetch}" ${args:-} ${package_url}
popd
if [[ "${version_to_build}" == '--avail' || "${version_to_build}" == '-a' ]]; then
# In this case, args="ls" and the list of available versions has been printed so we can move on.
exit 1
fi
if [[ "${fetch}" == "svn" ]]; then
search_path="${download_path}/${version_to_build}"
else
search_path="${download_path}/${url_tail}"
fi
if [ -f "${search_path}" ] || [ -d "${search_path}" ]; then
info "Download succeeded. The ${package_name} source is in the following location:"
info "${search_path}"
if [[ ! -z "${arg_B:-}" ]]; then
return
else
info "Download failed. The ${package_name} source is not in the following, expected location:"
info "${search_path}"
emergency "Aborting. [exit 110]"
if [[ "${fetch}" == "svn" ]]; then
search_path="${download_path}/${version_to_build}"
else
search_path="${download_path}/${url_tail}"
fi
if [[ -f "${search_path}" || -d "${search_path}" ]]; then
info "Download succeeded. The ${package_name} source is in the following location:"
info "${search_path}"
else
info "Download failed. The ${package_name} source is not in the following, expected location:"
info "${search_path}"
emergency "Aborting. [exit 110]"
fi
fi
fi
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ set_or_print_default_version()

# Exit with error status and diagnostic output if empty default_version
if [[ -z "${default_version:-}" ]]; then
emergency "Package ${package_name:-} not recognized. Use --l or --list-packages to list the allowable names."
emergency "set_or_print_default.sh: Package ${package_name:-} not recognized. Use --l or --list-packages to list the allowable names."
fi
}
38 changes: 21 additions & 17 deletions prerequisites/build-functions/set_or_print_downloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
# shellcheck disable=SC2154
set_or_print_downloader()
{

# Verify requirements
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}" ] &&
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}" ] &&
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."

package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}"

package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}"
if [[ "${package_name}" == "ofp" ]]; then
${OPENCOARRAYS_SRC_DIR}/prerequisites/install-ofp.sh "${@}"
exit 0
Expand All @@ -20,25 +22,27 @@ set_or_print_downloader()
wget_or_curl=wget
ftp_or_curl=ftp-url
fi
if [[ "${package_name}" == "gcc" && "${version_to_build}" != "trunk" ]]; then
gcc_fetch="${ftp_or_curl}"
else
gcc_fetch="svn"
if [[ "${package_name}" == "gcc" ]]; then
if [[ -z "${arg_b:-${arg_B:-}}" ]]; then
gcc_fetch="${ftp_or_curl}"
else
gcc_fetch="svn"
fi
fi
# This is a bash 3 hack standing in for a bash 4 hash (bash 3 is the lowest common
# denominator because, for licensing reasons, OS X only has bash 3 by default.)
# See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
package_fetch=(
"gcc:${gcc_fetch}"
"wget:${ftp_or_curl}"
"cmake:${wget_or_curl}"
"mpich:${wget_or_curl}"
"flex:${wget_or_curl}"
"bison:${ftp_or_curl}"
"pkg-config:${wget_or_curl}"
"make:${ftp_or_curl}"
"m4:${ftp_or_curl}"
"subversion:${wget_or_curl}"
"gcc:${gcc_fetch-}"
"wget:${ftp_or_curl-}"
"cmake:${wget_or_curl-}"
"mpich:${wget_or_curl-}"
"flex:${wget_or_curl-}"
"bison:${ftp_or_curl-}"
"pkg-config:${wget_or_curl-}"
"make:${ftp_or_curl-}"
"m4:${ftp_or_curl-}"
"subversion:${wget_or_curl-}"
)
for package in "${package_fetch[@]}" ; do
KEY="${package%%:*}"
Expand Down
48 changes: 25 additions & 23 deletions prerequisites/build-functions/set_or_print_url.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@
set_or_print_url()
{
# Verify requirements
[ ! -z "${arg_U}" ] && [ ! -z "${arg_D:-${arg_p:-${arg_P:-${arg_V}}}}" ] &&
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
[ ! -z "${arg_U}" ] && [ ! -z "${arg_D:-${arg_p:-${arg_P:-${arg_V:-${arg_B}}}}}" ] &&
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."

# Get package name from argument passed with -p, -D, -P, -V, or -U
package_to_build="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}"
package_to_build="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}"

if [[ "${package_to_build}" == 'cmake' ]]; then
major_minor="${version_to_build%.*}"
elif [[ "${package_to_build}" == "gcc" && "${version_to_build}" != "trunk" ]]; then
gcc_url_head="ftp.gnu.org:/gnu/gcc/gcc-${version_to_build}/"
else
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
elif [[ "${package_to_build}" == "gcc" ]]; then
if [[ -z "${arg_b:-${arg_B}}" ]]; then
gcc_url_head="ftp.gnu.org:/gnu/gcc/gcc-${version_to_build}/"
else
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
fi
fi
package_url_head=(
"gcc;${gcc_url_head:-}"
"gcc;${gcc_url_head-}"
"wget;ftp.gnu.org:/gnu/wget/"
"m4;ftp.gnu.org:/gnu/m4/"
"pkg-config;http://pkgconfig.freedesktop.org/releases/"
"mpich;http://www.mpich.org/static/downloads/${version_to_build}/"
"mpich;http://www.mpich.org/static/downloads/${version_to_build-}/"
"flex;http://sourceforge.net/projects/flex/files/"
"make;ftp://ftp.gnu.org/gnu/make/"
"bison;ftp.gnu.org:/gnu/bison/"
Expand All @@ -32,34 +34,34 @@ set_or_print_url()
for package in "${package_url_head[@]}" ; do
KEY="${package%%;*}"
VALUE="${package##*;}"
info "KEY=${KEY} VALUE=${VALUE}"

if [[ "${package_to_build}" == "${KEY}" ]]; then
# We recognize the package name so we set the URL head:
url_head="${VALUE}"
break
fi
done

# Set differing tails for GCC trunk versus branches
# Set differing tails for GCC release downloads versus development branch checkouts
if [[ "${package_to_build}" == 'gcc' ]]; then
if [[ "${fetch}" == 'svn' ]]; then
gcc_tail="${version_to_build}"
elif [[ "${version_to_build}" == '--avail' || "${version_to_build}" == '-a' ]]; then
gcc_tail='branches'
gcc_tail=${version_to_build-branches}
else
gcc_tail="gcc-${version_to_build}.tar.bz2"
fi
fi
package_url_tail=(
"gcc;${gcc_tail:-}"
"wget;wget-${version_to_build}.tar.gz"
"m4;m4-${version_to_build}.tar.bz2"
"pkg-config;pkg-config-${version_to_build}.tar.gz"
"mpich;mpich-${version_to_build}.tar.gz"
"flex;flex-${version_to_build}.tar.bz2"
"bison;bison-${version_to_build}.tar.gz"
"make;make-${version_to_build}.tar.bz2"
"cmake;cmake-${version_to_build}.tar.gz"
"subversion;subversion-${version_to_build}.tar.gz"
"gcc;${gcc_tail-}"
"wget;wget-${version_to_build-}.tar.gz"
"m4;m4-${version_to_build-}.tar.bz2"
"pkg-config;pkg-config-${version_to_build-}.tar.gz"
"mpich;mpich-${version_to_build-}.tar.gz"
"flex;flex-${version_to_build-}.tar.bz2"
"bison;bison-${version_to_build-}.tar.gz"
"make;make-${version_to_build-}.tar.bz2"
"cmake;cmake-${version_to_build-}.tar.gz"
"subversion;subversion-${version_to_build-}.tar.gz"
)
for package in "${package_url_tail[@]}" ; do
KEY="${package%%;*}"
Expand Down
56 changes: 31 additions & 25 deletions prerequisites/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ fi
# shellcheck source=./use-case/bootstrap.sh
source "${B3B_USE_CASE}/bootstrap.sh" "$@"



# Set up a function to call when receiving an EXIT signal to do some cleanup. Remove if
# not needed. Other signals can be trapped too, like SIGINT and SIGTERM.
function cleanup_before_exit () {
Expand All @@ -61,14 +59,15 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
export __flag_present=1

# shellcheck disable=SC2154
if [[ "${arg_l}" != "${__flag_present}" && "${arg_L}" != "${__flag_present}" &&
"${arg_v}" != "${__flag_present}" && "${arg_h}" != "${__flag_present}" &&
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}}" ]]; then
help "${__base}: Insufficient arguments. Please pass either -D, -h, -l, -L, -p, -P, -U, -v, -V, or a longer equivalent."
if [[ "${arg_l}" != "${__flag_present}" &&
"${arg_v}" != "${__flag_present}" &&
"${arg_h}" != "${__flag_present}" &&
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}" ]]; then
help "${__base}: Insufficient arguments. Please pass either -B, -D, -h, -l, -L, -p, -P, -U, -v, -V, or a longer equivalent."
fi

# Suppress info and debug messages if -l, -P, -U, -V, -D, or their longer equivalent is present:
[[ "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]] && suppress_info_debug_messages
# Suppress info and debug messages if -B, -l, -P, -U, -V, -D, or their longer equivalent is present:
[[ "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D:-${arg_B}}}}}" ]] && suppress_info_debug_messages

[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "

Expand All @@ -90,6 +89,7 @@ info "__usage: ${__usage}"
info "LOG_LEVEL: ${LOG_LEVEL}"

info "-b (--branch): ${arg_b} "
info "-B (--list-branches): ${arg_B} "
info "-c (--with-c): ${arg_c} "
info "-C (--with-cxx): ${arg_C} "
info "-d (--debug): ${arg_d} "
Expand All @@ -101,7 +101,6 @@ info "-i (--install-prefix): ${arg_i} "
info "-j (--num-threads): ${arg_j} "
info "-I (--install-version): ${arg_I} "
info "-l (--list-packages): ${arg_l} "
info "-L (--list-branches): ${arg_L} "
info "-m (--with-cmake): ${arg_m} "
info "-M (--with-mpi): ${arg_M} "
info "-n (--no-color): ${arg_n} "
Expand All @@ -113,10 +112,12 @@ info "-v (--version): ${arg_v} "
info "-V (--print-version): ${arg_V} "
}

# shellcheck source=./build-functions/set_or_print_default_version.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
set_or_print_default_version "${@}"
export version_to_build="${arg_I:-${default_version}}"
if [[ -z "${arg_B}" ]]; then
# shellcheck source=./build-functions/set_or_print_default_version.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
set_or_print_default_version "${@}"
export version_to_build="${arg_I:-${arg_b:-${default_version}}}"
fi

# shellcheck source=./build-functions/set_or_print_downloader.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_downloader.sh"
Expand All @@ -128,20 +129,25 @@ set_or_print_url

# shellcheck source=./build-functions/set_or_print_installation_path.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
set_or_print_installation_path

if [[ -z "${arg_B}" ]]; then
set_or_print_installation_path
fi

# shellcheck source=./build-functions/download_if_necessary.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/download_if_necessary.sh"
download_if_necessary

# shellcheck source=./build-functions/unpack_if_necessary.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
unpack_if_necessary

# 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
if [[ -z "${arg_B}" ]]; then
# shellcheck source=./build-functions/unpack_if_necessary.sh
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
unpack_if_necessary

# 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
fi
Loading