80
80
# (4) Parse the command line using the usage information.
81
81
82
82
# ## 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%/ } } "
84
84
if [[ ! -f " ${OPENCOARRAYS_SRC_DIR} /src/libcaf.h" ]]; then
85
85
echo " Please run this script inside the top-level OpenCoarrays source directory or "
86
86
echo " set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path."
@@ -149,7 +149,7 @@ info "-D (--print-downloader): ${arg_D}"
149
149
info " -e (--verbose): ${arg_e} "
150
150
info " -f (--with-fortran): ${arg_f} "
151
151
info " -h (--help): ${arg_h} "
152
- info " -i (--install-dir): ${arg_i} "
152
+ info " -i (--install-prefix): ${arg_i} "
153
153
info " -I (--install-version): ${arg_I} "
154
154
info " -j (--num-threads): ${arg_j} "
155
155
info " -l (--list-packages): ${arg_l} "
@@ -188,21 +188,20 @@ info "-V (--print-version): ${arg_V}"
188
188
this_script=" $( basename " $0 " ) "
189
189
export this_script
190
190
191
- export install_path=" ${arg_i} "
192
- info " install_path=${arg_i} "
191
+ export install_path=" ${arg_i%/ } "
192
+ info " install_path=\" ${install_path} \" "
193
193
194
194
export num_threads=" ${arg_j} "
195
- info " num_threads=${arg_j} "
195
+ info " num_threads=\" ${arg_j} \" "
196
196
197
197
export opencoarrays_src_dir=" ${OPENCOARRAYS_SRC_DIR} "
198
198
info " opencoarrays_src_dir=${OPENCOARRAYS_SRC_DIR} "
199
199
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"
205
202
203
+ export build_script=" ${opencoarrays_src_dir} " /prerequisites/build.sh
204
+ info " build_script=\" ${opencoarrays_src_dir} \" /prerequisites/build.sh"
206
205
207
206
# ___________________ Define functions for use in the Main Body ___________________
208
207
@@ -214,12 +213,16 @@ stack_new dependency_pkg
214
213
stack_new dependency_exe
215
214
stack_new dependency_path
216
215
stack_new script_installed
216
+
217
217
# shellcheck source=./prerequisites/install-functions/find_or_install.sh
218
218
source $opencoarrays_src_dir /prerequisites/install-functions/find_or_install.sh
219
+
219
220
# shellcheck source=./prerequisites/install-functions/print_header.sh
220
221
source $opencoarrays_src_dir /prerequisites/install-functions/print_header.sh
222
+
221
223
# shellcheck source=./prerequisites/install-functions/build_opencoarrays.sh
222
224
source $opencoarrays_src_dir /prerequisites/install-functions/build_opencoarrays.sh
225
+
223
226
# shellcheck source=./prerequisites/install-functions/report_results.sh
224
227
source $opencoarrays_src_dir /prerequisites/install-functions/report_results.sh
225
228
@@ -232,7 +235,7 @@ source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh
232
235
if [[ " ${arg_v} " == " ${__flag_present} " || " ${arg_V} " == " opencoarrays" ]]; then
233
236
234
237
# 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)
236
239
text_after_version_keyword=" ${cmake_project_line##* VERSION} "
237
240
text_before_language_keyword=" ${text_after_version_keyword%% LANGUAGES* } "
238
241
opencoarrays_version=$text_before_language_keyword
@@ -249,7 +252,7 @@ if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
249
252
echo " http://www.sourceryinstitute.org/license.html"
250
253
echo " "
251
254
elif [[ " ${arg_V} " == " opencoarrays" ]]; then
252
- echo " ${opencoarrays_version} "
255
+ echo " ${opencoarrays_version// [[:space:]] / } "
253
256
fi
254
257
255
258
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
261
264
[ ! -z " ${arg_U} " ] && build_flag=" -U"
262
265
[ ! -z " ${arg_V} " ] && build_flag=" -V"
263
266
[ " ${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
269
284
fi
270
285
271
286
elif [[ " ${arg_p:- } " == " opencoarrays" ]]; then
272
287
288
+
273
289
cd prerequisites || exit 1
274
290
installation_record=install-opencoarrays.log
275
291
# shellcheck source=./prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh
276
292
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} "
277
295
set_SUDO_if_needed_to_write_to_directory " ${install_path} "
278
296
build_opencoarrays 2>&1 | tee ../" ${installation_record} "
279
297
report_results 2>&1 | tee -a ../" ${installation_record} "
280
298
281
299
elif [[ " ${arg_p:- } " == " ofp" ]]; then
282
300
301
+ info " Invoking Open Fortran Parser build script with the following command:"
302
+ info " \" ${opencoarrays_src_dir} \" /prerequisites/install-ofp.sh"
283
303
" ${opencoarrays_src_dir} " /prerequisites/install-ofp.sh
284
304
285
305
elif [[ ! -z " ${arg_p:- } " ]]; then
286
306
307
+ info " Invoking build script with the following command:"
308
+ info " \" ${opencoarrays_src_dir} \" /prerequisites/build.sh ${@:- } "
287
309
" ${opencoarrays_src_dir} " /prerequisites/build.sh ${@:- }
288
310
289
311
fi
0 commit comments