Skip to content

Commit 8530476

Browse files
author
Damian Rouson
committed
Add script that downlaods all prerequisites.
1 parent cf99c2e commit 8530476

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed

prerequisites/download-all.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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 "-b (--install-branch): ${arg_b} "
76+
info "-d (--debug): ${arg_d} "
77+
info "-e (--verbose): ${arg_e} "
78+
info "-h (--help): ${arg_h} "
79+
info "-l (--list-branches): ${arg_l} "
80+
}
81+
82+
download_list=( "m4" "bison" "flex" "mpich" "cmake" )
83+
84+
for package_to_download in "${download_list[@]}" ; do
85+
if [[ "${arg_l}" == "${__flag_present}" ]]; then
86+
info "${package_to_download}"
87+
else
88+
./install.sh --package ${package_to_download} --only-download
89+
fi
90+
done
91+
92+
if [[ ! -z ${install_branch:-} ]]; then
93+
./install.sh --package gcc --only-download --install-branch "${arg_b}"
94+
else # Download default version
95+
./install.sh --package gcc --only-download
96+
fi
97+
98+
pushd prerequisites/downloads/trunk
99+
100+
source ../../build-functions/set_or_print_downloader.sh
101+
set_or_print_downloader
102+
103+
source ../../build-functions/edit_GCC_download_prereqs_file_if_necessary.sh
104+
edit_GCC_download_prereqs_file_if_necessary
105+
106+
./contrib/download_prerequisites
107+
108+
popd
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-b --install-branch [arg] Checkout the specified branch.
2+
-d --debug Enable debug mode.
3+
-e --verbose Enable verbose mode, print script as it is executed.
4+
-h --help Print this page.
5+
-l --list-packages List the packages this script will download.
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)