Skip to content

Commit 5eca9ac

Browse files
committed
Merge pull request #185 from sourceryinstitute/fix-termination-when-no-mpif90
Fix termination when no mpif90 🎉
2 parents 0fd6fca + 711cce8 commit 5eca9ac

File tree

10 files changed

+137
-79
lines changed

10 files changed

+137
-79
lines changed

.travis.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ matrix:
5858
packages:
5959
- gcc-5
6060
- gfortran-5
61+
- g++-5
6162
- binutils
6263
- cmake-data
6364
- cmake
@@ -72,6 +73,7 @@ matrix:
7273
packages:
7374
- gcc-5
7475
- gfortran-5
76+
- g++-5
7577

7678
before_install:
7779
- |
@@ -151,13 +153,7 @@ script:
151153
ln -fs "$(which gcc-5)" "$HOME/bin/gcc"
152154
ln -fs "$(which g++-5)" "$HOME/bin/g++"
153155
export PATH="$PATH:$HOME/bin"
154-
yes | ./install.sh -i "$HOME/opt/opencoarrays" -j 4 -f "$HOME/bin/gfortran" -c "$HOME/bin/gcc" -C "$HOME/bin/g++" > install.log &
155-
install_sh_PID=$!
156-
echo "install.log will be displayed after success or failure"
157-
while ps -p $install_sh_PID > /dev/null; do
158-
echo "Still working on installing opencoarrays and dependencies"
159-
sleep 300 # prevent Travis-CI abort due to inactivity and excessive logging
160-
done
156+
yes | ./install.sh -i "$HOME/opt/opencoarrays" -j 4 -f "$HOME/bin/gfortran" -c "$HOME/bin/gcc" -C "$HOME/bin/g++"
161157
else
162158
mkdir cmake-build
163159
cd cmake-build
@@ -172,10 +168,6 @@ after_success:
172168
- find . -name '*.gcno' -print
173169
- gcov-5 --version
174170
- bash <(curl -s https://codecov.io/bash) -x $(which gcov-5)
175-
- cat install.log || true
176-
177-
after_failure:
178-
- cat install.log || true
179171

180172
notifications:
181173
webhooks:

install.sh

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
# (4) Parse the command line using the usage information.
8181

8282
### Start of boilerplate -- do not edit this block #######################
83-
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD}}"
83+
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD%/}}"
8484
if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then
8585
echo "Please run this script inside the top-level OpenCoarrays source directory or "
8686
echo "set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path."
@@ -149,7 +149,7 @@ info "-D (--print-downloader): ${arg_D}"
149149
info "-e (--verbose): ${arg_e}"
150150
info "-f (--with-fortran): ${arg_f}"
151151
info "-h (--help): ${arg_h}"
152-
info "-i (--install-dir): ${arg_i}"
152+
info "-i (--install-prefix): ${arg_i}"
153153
info "-I (--install-version): ${arg_I}"
154154
info "-j (--num-threads): ${arg_j}"
155155
info "-l (--list-packages): ${arg_l}"
@@ -188,21 +188,20 @@ info "-V (--print-version): ${arg_V}"
188188
this_script="$(basename "$0")"
189189
export this_script
190190

191-
export install_path="${arg_i}"
192-
info "install_path=${arg_i}"
191+
export install_path="${arg_i%/}"
192+
info "install_path=\"${install_path}\""
193193

194194
export num_threads="${arg_j}"
195-
info "num_threads=${arg_j}"
195+
info "num_threads=\"${arg_j}\""
196196

197197
export opencoarrays_src_dir="${OPENCOARRAYS_SRC_DIR}"
198198
info "opencoarrays_src_dir=${OPENCOARRAYS_SRC_DIR}"
199199

200-
export build_path=$opencoarrays_src_dir/prerequisites/builds
201-
info "build_path=$opencoarrays_src_dir/prerequisites/builds"
202-
203-
export build_script=$opencoarrays_src_dir/prerequisites/build.sh
204-
info "build_script=$opencoarrays_src_dir/prerequisites/build.sh"
200+
export build_path="${opencoarrays_src_dir}"/prerequisites/builds
201+
info "build_path=\"${opencoarrays_src_dir}\"/prerequisites/builds"
205202

203+
export build_script="${opencoarrays_src_dir}"/prerequisites/build.sh
204+
info "build_script=\"${opencoarrays_src_dir}\"/prerequisites/build.sh"
206205

207206
# ___________________ Define functions for use in the Main Body ___________________
208207

@@ -214,12 +213,16 @@ stack_new dependency_pkg
214213
stack_new dependency_exe
215214
stack_new dependency_path
216215
stack_new script_installed
216+
217217
# shellcheck source=./prerequisites/install-functions/find_or_install.sh
218218
source $opencoarrays_src_dir/prerequisites/install-functions/find_or_install.sh
219+
219220
# shellcheck source=./prerequisites/install-functions/print_header.sh
220221
source $opencoarrays_src_dir/prerequisites/install-functions/print_header.sh
222+
221223
# shellcheck source=./prerequisites/install-functions/build_opencoarrays.sh
222224
source $opencoarrays_src_dir/prerequisites/install-functions/build_opencoarrays.sh
225+
223226
# shellcheck source=./prerequisites/install-functions/report_results.sh
224227
source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh
225228

@@ -232,7 +235,7 @@ source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh
232235
if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
233236

234237
# Print script copyright if invoked with -v, -V, or --version argument
235-
cmake_project_line=$(grep project CMakeLists.txt | grep VERSION)
238+
cmake_project_line=$(grep project ${opencoarrays_src_dir}/CMakeLists.txt | grep VERSION)
236239
text_after_version_keyword="${cmake_project_line##*VERSION}"
237240
text_before_language_keyword="${text_after_version_keyword%%LANGUAGES*}"
238241
opencoarrays_version=$text_before_language_keyword
@@ -249,7 +252,7 @@ if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
249252
echo "http://www.sourceryinstitute.org/license.html"
250253
echo ""
251254
elif [[ "${arg_V}" == "opencoarrays" ]]; then
252-
echo "${opencoarrays_version}"
255+
echo "${opencoarrays_version//[[:space:]]/}"
253256
fi
254257

255258
elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__flag_present}" ]]; then
@@ -261,29 +264,48 @@ elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__fla
261264
[ ! -z "${arg_U}" ] && build_flag="-U"
262265
[ ! -z "${arg_V}" ] && build_flag="-V"
263266
[ "${arg_l}" == "${__flag_present}" ] && build_flag="-l"
264-
"${opencoarrays_src_dir}"/prerequisites/build.sh "${build_flag}" "${build_arg}"
265-
# Add lines other packages the current script builds
266-
if [[ "${arg_l}" == "${__flag_present}" ]]; then
267-
echo "opencoarrays (version $("${opencoarrays_src_dir}/install.sh" -V opencoarrays))"
268-
echo "ofp (version: ofp-sdf for OS X )"
267+
268+
if [[ "${arg_P}" == "opencoarrays" ]]; then
269+
270+
version="$("${opencoarrays_src_dir}/install.sh" -V opencoarrays)"
271+
echo "${install_path%/}/opencoarrays/${version}"
272+
273+
else
274+
275+
info "Invoking build script with the following command:"
276+
info "\"${opencoarrays_src_dir}\"/prerequisites/build.sh \"${build_flag}\" \"${build_arg}\""
277+
"${opencoarrays_src_dir}"/prerequisites/build.sh "${build_flag}" "${build_arg}"
278+
279+
# Add lines other packages the current script builds
280+
if [[ "${arg_l}" == "${__flag_present}" ]]; then
281+
echo "opencoarrays (version $("${opencoarrays_src_dir}/install.sh" -V opencoarrays))"
282+
echo "ofp (version: ofp-sdf for OS X )"
283+
fi
269284
fi
270285

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

288+
273289
cd prerequisites || exit 1
274290
installation_record=install-opencoarrays.log
275291
# shellcheck source=./prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh
276292
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh"
293+
version="$("${opencoarrays_src_dir}/install.sh" -V opencoarrays)"
294+
install_path="${install_path}/opencoarrays/${version}"
277295
set_SUDO_if_needed_to_write_to_directory "${install_path}"
278296
build_opencoarrays 2>&1 | tee ../"${installation_record}"
279297
report_results 2>&1 | tee -a ../"${installation_record}"
280298

281299
elif [[ "${arg_p:-}" == "ofp" ]]; then
282300

301+
info "Invoking Open Fortran Parser build script with the following command:"
302+
info "\"${opencoarrays_src_dir}\"/prerequisites/install-ofp.sh"
283303
"${opencoarrays_src_dir}"/prerequisites/install-ofp.sh
284304

285305
elif [[ ! -z "${arg_p:-}" ]]; then
286306

307+
info "Invoking build script with the following command:"
308+
info "\"${opencoarrays_src_dir}\"/prerequisites/build.sh ${@:-}"
287309
"${opencoarrays_src_dir}"/prerequisites/build.sh ${@:-}
288310

289311
fi

install.sh-usage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
-e --verbose Enable verbose mode, print script as it is executed.
66
-f --with-fortran [arg] Use specified Fortran compiler.
77
-h --help Print this page.
8-
-i --install-dir [arg] Install package in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/"
8+
-i --install-prefix [arg] Install package in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/"
99
-I --install-version [arg] Install package version.
1010
-j --num-threads [arg] Number of threads to use when invoking make. Default="1"
1111
-l --list-packages Print packages this script can install.
1212
-m --with-cmake [arg] Use specified CMake installation. Default="cmake"
13-
-M --with-mpi [arg] Use specified MPI installation. Default="mpif90"
13+
-M --with-mpi [arg] Use specified MPI installation.
1414
-n --no-color Disable color output.
1515
-p --package [arg] Install specified package. Default="opencoarrays"
1616
-P --print-path [arg] Print installation directory for specified package.

prerequisites/build-functions/build_and_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ build_and_install()
77

88
info "Building ${package_to_build} ${version_to_build}"
99
info "Build path: ${build_path}"
10+
info "Installation path: ${install_path}"
1011

1112
set_SUDO_if_needed_to_write_to_directory "${build_path}"
1213
set_SUDO_if_needed_to_write_to_directory "${install_path}"

prerequisites/build-functions/set_or_print_installation_path.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
set_or_print_installation_path()
55
{
66
# Verify requirements
7-
[ ! -z "${arg_P}" ] && [ ! -z "${arg_D:-${arg_p:-${arg_U:-${arg_V}}}}" ] &&
7+
[ ! -z "${arg_P}" ] && [ ! -z "${arg_p:-${arg_D:-${arg_U:-${arg_V}}}}" ] &&
88
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
99

10-
install_path="${arg_i}/${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}/${version_to_build}"
10+
install_path="${arg_i%/}/${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}/${version_to_build}"
1111

1212
# If -P is present, print ${install_path} and exit with normal status
1313
if [[ ! -z "${arg_P:-}" ]]; then

prerequisites/build-functions/set_or_print_url.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ set_or_print_url()
5858
"flex;flex-${version_to_build}.tar.bz2"
5959
"bison;bison-${version_to_build}.tar.gz"
6060
"make;make-${version_to_build}.tar.bz2"
61-
"cmake;cmake-${version_to_build}.tar.gz "
61+
"cmake;cmake-${version_to_build}.tar.gz"
6262
"subversion;subversion-${version_to_build}.tar.gz"
6363
)
6464
for package in "${package_url_tail[@]}" ; do

prerequisites/build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# (4) Parse the command line using the usage information.
3232

3333

34-
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD}/..}"
34+
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD%prerequisites*}}"
3535
export __usage=${OPENCOARRAYS_SRC_DIR}/prerequisites/build.sh-usage
3636
if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then
3737
echo "Please run this script inside the OpenCoarrays source \"prerequisites\" subdirectory"
@@ -91,13 +91,13 @@ info "LOG_LEVEL: ${LOG_LEVEL}"
9191

9292
info "-b (--branch): ${arg_b} "
9393
info "-c (--with-c): ${arg_c} "
94-
info "-C (--with-cpp): ${arg_C} "
94+
info "-C (--with-cxx): ${arg_C} "
9595
info "-d (--debug): ${arg_d} "
9696
info "-D (--print-downloader): ${arg_D} "
9797
info "-e (--verbose): ${arg_e} "
9898
info "-f (--with-fortran): ${arg_f} "
9999
info "-h (--help): ${arg_h} "
100-
info "-i (--install-dir): ${arg_i} "
100+
info "-i (--install-prefix): ${arg_i} "
101101
info "-j (--num-threads): ${arg_j} "
102102
info "-I (--install-version): ${arg_I} "
103103
info "-l (--list-packages): ${arg_l} "
@@ -112,6 +112,7 @@ info "-U (--print-url): ${arg_U} "
112112
info "-v (--version): ${arg_v} "
113113
info "-V (--print-version): ${arg_V} "
114114
}
115+
115116
# shellcheck source=./build-functions/set_or_print_default_version.sh
116117
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
117118
set_or_print_default_version "${@}"

prerequisites/build.sh-usage

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
-e --verbose Enable verbose mode, print script as it is executed.
77
-f --with-fortran [arg] Specify Fortran compiler location. Default="gfortran"
88
-h --help This page.
9-
-i --install-dir [arg] Install package in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/${package_name:-}/"
9+
-i --install-prefix [arg] Install package in specified path. Default="${OPENCOARRAYS_SRC_DIR%/}/prerequisites/installations/"
1010
-j --num-threads [arg] Number of threads to use when invoking make. Default="1"
1111
-I --install-version [arg] Package version to install. (To see default, use -V or --print-version)
1212
-l --list-packages List the packages this script can install.
1313
-L --list-branches List the repository branches this script can download.
14-
-m --with-cmake [arg] Specify CMake location. Default="'`which cmake`'"
15-
-M --with-mpi [arg] Specify MPI location. Default="'`which mpif90`'"
14+
-m --with-cmake [arg] Use the specified CMake installation. Default="cmake"
15+
-M --with-mpi [arg] Use the specified MPI installation.
1616
-n --no-color Disable color output.
1717
-p --package [arg] Package to install.
1818
-P --print-path [arg] Print installation path for package specified in argument.
19-
-t --with-tau [arg] Use the specified TAU parallel performance utilities installation. Default="'`which tauf90`'"
19+
-t --with-tau [arg] Use the specified TAU parallel performance utilities installation. Default="tauf90"
2020
-T --install-tau [arg] Install TAU in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/${package_name:-}/${version_to_build:-}/"
2121
-U --print-url [arg] Print URL for package specified in argument.
2222
-v --version Print OpenCoarrays version number.

prerequisites/install-functions/build_opencoarrays.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
build_opencoarrays()
33
{
44
print_header
5-
info "find_or_install mpich"
5+
info "Invoking find_or_install mpich"
66
find_or_install mpich
7-
info "find_or_install cmake"
7+
info "Invoking find_or_install cmake"
88
find_or_install cmake
9+
build_path="${build_path}"/opencoarrays/$("${opencoarrays_src_dir}"/install.sh -V opencoarrays)
910
mkdir -p "$build_path"
1011
pushd "$build_path"
1112
if [[ -z "${MPICC:-}" || -z "${MPIFC:-}" || -z "${CMAKE:-}" ]]; then

0 commit comments

Comments
 (0)