Skip to content

Commit b9ff62f

Browse files
author
Damian Rouson
committed
Merge branch 'capture-build-workflow' of https://github.com/sourceryinstitute/opencoarrays into capture-build-workflow
2 parents 91a1488 + f7c52ba commit b9ff62f

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed

prerequisites/download-all.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/usr/bin/env bash
2+
# BASH3 Boilerplate
3+
#
4+
# download-all-prerequisites.sh
5+
#
6+
# - Download all packages required for building OpenCoarrays and its prerequisites
7+
#
8+
# Usage: LOG_LEVEL=7 B3B_USE_CASE=/opt/bash3boilerplate/src/use-case ./my-script.sh -f script_input.txt
9+
#
10+
# More info:
11+
#
12+
# - https://github.com/kvz/bash3boilerplate
13+
# - http://kvz.io/blog/2013/02/26/introducing-bash3boilerplate/
14+
#
15+
# Version: 2.0.0
16+
#
17+
# Authors:
18+
#
19+
# - Kevin van Zonneveld (http://kvz.io)
20+
# - Izaak Beekman (https://izaakbeekman.com/)
21+
# - Alexander Rathai ([email protected])
22+
# - Dr. Damian Rouson (http://www.sourceryinstitute.org/) (documentation)
23+
#
24+
# Licensed under MIT
25+
# Copyright (c) 2013 Kevin van Zonneveld (http://kvz.io)
26+
27+
# The invocation of bootstrap.sh below performs the following tasks:
28+
# (1) Import several bash3boilerplate helper functions & default settings.
29+
# (2) Set several variables describing the current file and its usage page.
30+
# (3) Parse the usage information (default usage file name: current file's name with -usage appended).
31+
# (4) Parse the command line using the usage information.
32+
33+
34+
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD%prerequisites*}}"
35+
export __usage=${OPENCOARRAYS_SRC_DIR}/prerequisites/download-all.sh-usage
36+
if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then
37+
echo "Please run this script inside the OpenCoarrays source \"prerequisites\" subdirectory"
38+
echo "or set OPENCOARRAYS_SRC_DIR to the top-level OpenCoarrays source directory path."
39+
exit 1
40+
fi
41+
export B3B_USE_CASE="${B3B_USE_CASE:-${OPENCOARRAYS_SRC_DIR}/prerequisites/use-case}"
42+
if [[ ! -f "${B3B_USE_CASE:-}/bootstrap.sh" ]]; then
43+
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
44+
exit 2
45+
fi
46+
# shellcheck source=./use-case/bootstrap.sh
47+
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
48+
49+
# Set up a function to call when receiving an EXIT signal to do some cleanup. Remove if
50+
# not needed. Other signals can be trapped too, like SIGINT and SIGTERM.
51+
function cleanup_before_exit () {
52+
info "Cleaning up. Done"
53+
}
54+
trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, SIGTERM etc.
55+
56+
### Validation (decide what's required for running your script and error out)
57+
#####################################################################
58+
59+
export __flag_present=1
60+
61+
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
62+
63+
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
64+
### is at the default value (6) or above.
65+
#####################################################################
66+
# shellcheck disable=SC2154
67+
{
68+
info "__file: ${__file}"
69+
info "__dir: ${__dir}"
70+
info "__base: ${__base}"
71+
info "__os: ${__os}"
72+
info "__usage: ${__usage}"
73+
info "LOG_LEVEL: ${LOG_LEVEL}"
74+
75+
info "-d (--debug): ${arg_d} "
76+
info "-e (--verbose): ${arg_e} "
77+
info "-h (--help): ${arg_h} "
78+
}
79+
80+
download_list=( "m4" "bison" "flex" "mpich" "cmake" )
81+
82+
for package_to_download in "${download_list[@]}" ; do
83+
if [[ "${arg_l}" == "${__flag_present}" ]]; then
84+
info "${package_to_download}"
85+
else
86+
./install.sh --package ${package_to_download} --only-download
87+
fi
88+
done
89+
90+
if [[ ! -z ${arg_b:-} ]]; then
91+
./install.sh --package gcc --only-download --install-branch "${arg_b}"
92+
else # Download default version
93+
./install.sh --package gcc --only-download
94+
fi
95+
96+
pushd prerequisites/downloads/trunk
97+
98+
source ../../build-functions/set_or_print_downloader.sh
99+
set_or_print_downloader
100+
101+
source ../../build-functions/edit_GCC_download_prereqs_file_if_necessary.sh
102+
edit_GCC_download_prereqs_file_if_necessary
103+
104+
./contrib/download_prerequisites
105+
106+
popd

prerequisites/download-all.sh-usage

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-d --debug Enable debug mode.
2+
-e --verbose Enable verbose mode, print script as it is executed.
3+
-h --help Print this page.
4+
-l --list-branches (not used)
5+
-b --install-branch [arg] (not used)
6+
-y --yes-to-all (not used)
7+
-B --list-branches [arg] (not used)
8+
-c --with-c [arg] (not used)
9+
-C --with-cxx [arg] (not used)
10+
-D --print-downloader [arg] (not used)
11+
-f --with-fortran [arg] (not used)
12+
-i --install-prefix [arg] (not used)
13+
-I --install-version [arg] (not used)
14+
-j --num-threads [arg] (not used)
15+
-m --with-cmake [arg] (not used)
16+
-M --with-mpi [arg] (not used)
17+
-n --no-color (not used)
18+
-o --only-download (not used)
19+
-p --package [arg] (not used)
20+
-P --print-path [arg] (not used)
21+
-U --print-url [arg] (not used)
22+
-v --version (not used)
23+
-V --print-version [arg] (not used)

0 commit comments

Comments
 (0)