Skip to content

Commit 67ecc3b

Browse files
author
Damian Rouson
committed
Merge pull request #190 from sourceryinstitute/support-gcc-dev-branch-builds
Support gcc dev branch builds
2 parents 43daf10 + 1f84193 commit 67ecc3b

File tree

8 files changed

+114
-96
lines changed

8 files changed

+114
-96
lines changed

install.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,25 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
113113
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
114114

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

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

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

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

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

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

232237
# ________________________________ Start of the Main Body ___________________________________
233238

234-
235239
if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
236240

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

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

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

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

289293
cd prerequisites || exit 1
290294
installation_record=install-opencoarrays.log

install.sh-usage

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-b --branch [arg] Install the specified repository development branch.
2+
-B --list-branches [arg] List the available branches in the specified package's repository.
13
-c --with-c [arg] Use specified C compiler.
24
-C --with-cxx [arg] Use specified C++ compiler.
35
-d --debug Enable debug mode.

prerequisites/build-functions/download_if_necessary.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ download_if_necessary()
3232
else
3333
# The download mechanism is in the path.
3434
if [[ "${fetch}" == "svn" ]]; then
35-
if [[ ${version_to_build} == '--avail' || ${version_to_build} == '-a' ]]; then
35+
if [[ "${arg_B:-}" == "gcc" ]]; then
3636
args="ls"
3737
else
3838
args="checkout"
@@ -59,29 +59,29 @@ download_if_necessary()
5959
else
6060
package_source_directory="${package_name}-${version_to_build}"
6161
fi
62-
info "Downloading ${package_name} ${version_to_build} to the following location:"
62+
info "Downloading ${package_name} ${version_to_build-} to the following location:"
6363
info "${download_path}/${package_source_directory}"
6464
info "Download command: \"${fetch}\" ${args:-} ${package_url}"
6565
info "Depending on the file size and network bandwidth, this could take several minutes or longer."
6666
pushd "${download_path}"
6767
"${fetch}" ${args:-} ${package_url}
6868
popd
69-
if [[ "${version_to_build}" == '--avail' || "${version_to_build}" == '-a' ]]; then
70-
# In this case, args="ls" and the list of available versions has been printed so we can move on.
71-
exit 1
72-
fi
73-
if [[ "${fetch}" == "svn" ]]; then
74-
search_path="${download_path}/${version_to_build}"
75-
else
76-
search_path="${download_path}/${url_tail}"
77-
fi
78-
if [ -f "${search_path}" ] || [ -d "${search_path}" ]; then
79-
info "Download succeeded. The ${package_name} source is in the following location:"
80-
info "${search_path}"
69+
if [[ ! -z "${arg_B:-}" ]]; then
70+
return
8171
else
82-
info "Download failed. The ${package_name} source is not in the following, expected location:"
83-
info "${search_path}"
84-
emergency "Aborting. [exit 110]"
72+
if [[ "${fetch}" == "svn" ]]; then
73+
search_path="${download_path}/${version_to_build}"
74+
else
75+
search_path="${download_path}/${url_tail}"
76+
fi
77+
if [[ -f "${search_path}" || -d "${search_path}" ]]; then
78+
info "Download succeeded. The ${package_name} source is in the following location:"
79+
info "${search_path}"
80+
else
81+
info "Download failed. The ${package_name} source is not in the following, expected location:"
82+
info "${search_path}"
83+
emergency "Aborting. [exit 110]"
84+
fi
8585
fi
8686
fi
8787
}

prerequisites/build-functions/set_or_print_default_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ set_or_print_default_version()
5757

5858
# Exit with error status and diagnostic output if empty default_version
5959
if [[ -z "${default_version:-}" ]]; then
60-
emergency "Package ${package_name:-} not recognized. Use --l or --list-packages to list the allowable names."
60+
emergency "set_or_print_default.sh: Package ${package_name:-} not recognized. Use --l or --list-packages to list the allowable names."
6161
fi
6262
}

prerequisites/build-functions/set_or_print_downloader.sh

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
# shellcheck disable=SC2154
55
set_or_print_downloader()
66
{
7+
78
# Verify requirements
8-
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}" ] &&
9-
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
9+
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}" ] &&
10+
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
11+
12+
package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}"
1013

11-
package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}"
1214
if [[ "${package_name}" == "ofp" ]]; then
1315
${OPENCOARRAYS_SRC_DIR}/prerequisites/install-ofp.sh "${@}"
1416
exit 0
@@ -20,25 +22,27 @@ set_or_print_downloader()
2022
wget_or_curl=wget
2123
ftp_or_curl=ftp-url
2224
fi
23-
if [[ "${package_name}" == "gcc" && "${version_to_build}" != "trunk" ]]; then
24-
gcc_fetch="${ftp_or_curl}"
25-
else
26-
gcc_fetch="svn"
25+
if [[ "${package_name}" == "gcc" ]]; then
26+
if [[ -z "${arg_b:-${arg_B:-}}" ]]; then
27+
gcc_fetch="${ftp_or_curl}"
28+
else
29+
gcc_fetch="svn"
30+
fi
2731
fi
2832
# This is a bash 3 hack standing in for a bash 4 hash (bash 3 is the lowest common
2933
# denominator because, for licensing reasons, OS X only has bash 3 by default.)
3034
# See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
3135
package_fetch=(
32-
"gcc:${gcc_fetch}"
33-
"wget:${ftp_or_curl}"
34-
"cmake:${wget_or_curl}"
35-
"mpich:${wget_or_curl}"
36-
"flex:${wget_or_curl}"
37-
"bison:${ftp_or_curl}"
38-
"pkg-config:${wget_or_curl}"
39-
"make:${ftp_or_curl}"
40-
"m4:${ftp_or_curl}"
41-
"subversion:${wget_or_curl}"
36+
"gcc:${gcc_fetch-}"
37+
"wget:${ftp_or_curl-}"
38+
"cmake:${wget_or_curl-}"
39+
"mpich:${wget_or_curl-}"
40+
"flex:${wget_or_curl-}"
41+
"bison:${ftp_or_curl-}"
42+
"pkg-config:${wget_or_curl-}"
43+
"make:${ftp_or_curl-}"
44+
"m4:${ftp_or_curl-}"
45+
"subversion:${wget_or_curl-}"
4246
)
4347
for package in "${package_fetch[@]}" ; do
4448
KEY="${package%%:*}"

prerequisites/build-functions/set_or_print_url.sh

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

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

1313
if [[ "${package_to_build}" == 'cmake' ]]; then
1414
major_minor="${version_to_build%.*}"
15-
elif [[ "${package_to_build}" == "gcc" && "${version_to_build}" != "trunk" ]]; then
16-
gcc_url_head="ftp.gnu.org:/gnu/gcc/gcc-${version_to_build}/"
17-
else
18-
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
15+
elif [[ "${package_to_build}" == "gcc" ]]; then
16+
if [[ -z "${arg_b:-${arg_B}}" ]]; then
17+
gcc_url_head="ftp.gnu.org:/gnu/gcc/gcc-${version_to_build}/"
18+
else
19+
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
20+
fi
1921
fi
2022
package_url_head=(
21-
"gcc;${gcc_url_head:-}"
23+
"gcc;${gcc_url_head-}"
2224
"wget;ftp.gnu.org:/gnu/wget/"
2325
"m4;ftp.gnu.org:/gnu/m4/"
2426
"pkg-config;http://pkgconfig.freedesktop.org/releases/"
25-
"mpich;http://www.mpich.org/static/downloads/${version_to_build}/"
27+
"mpich;http://www.mpich.org/static/downloads/${version_to_build-}/"
2628
"flex;http://sourceforge.net/projects/flex/files/"
2729
"make;ftp://ftp.gnu.org/gnu/make/"
2830
"bison;ftp.gnu.org:/gnu/bison/"
@@ -32,34 +34,34 @@ set_or_print_url()
3234
for package in "${package_url_head[@]}" ; do
3335
KEY="${package%%;*}"
3436
VALUE="${package##*;}"
37+
info "KEY=${KEY} VALUE=${VALUE}"
38+
3539
if [[ "${package_to_build}" == "${KEY}" ]]; then
3640
# We recognize the package name so we set the URL head:
3741
url_head="${VALUE}"
3842
break
3943
fi
4044
done
4145

42-
# Set differing tails for GCC trunk versus branches
46+
# Set differing tails for GCC release downloads versus development branch checkouts
4347
if [[ "${package_to_build}" == 'gcc' ]]; then
4448
if [[ "${fetch}" == 'svn' ]]; then
45-
gcc_tail="${version_to_build}"
46-
elif [[ "${version_to_build}" == '--avail' || "${version_to_build}" == '-a' ]]; then
47-
gcc_tail='branches'
49+
gcc_tail=${version_to_build-branches}
4850
else
4951
gcc_tail="gcc-${version_to_build}.tar.bz2"
5052
fi
5153
fi
5254
package_url_tail=(
53-
"gcc;${gcc_tail:-}"
54-
"wget;wget-${version_to_build}.tar.gz"
55-
"m4;m4-${version_to_build}.tar.bz2"
56-
"pkg-config;pkg-config-${version_to_build}.tar.gz"
57-
"mpich;mpich-${version_to_build}.tar.gz"
58-
"flex;flex-${version_to_build}.tar.bz2"
59-
"bison;bison-${version_to_build}.tar.gz"
60-
"make;make-${version_to_build}.tar.bz2"
61-
"cmake;cmake-${version_to_build}.tar.gz"
62-
"subversion;subversion-${version_to_build}.tar.gz"
55+
"gcc;${gcc_tail-}"
56+
"wget;wget-${version_to_build-}.tar.gz"
57+
"m4;m4-${version_to_build-}.tar.bz2"
58+
"pkg-config;pkg-config-${version_to_build-}.tar.gz"
59+
"mpich;mpich-${version_to_build-}.tar.gz"
60+
"flex;flex-${version_to_build-}.tar.bz2"
61+
"bison;bison-${version_to_build-}.tar.gz"
62+
"make;make-${version_to_build-}.tar.bz2"
63+
"cmake;cmake-${version_to_build-}.tar.gz"
64+
"subversion;subversion-${version_to_build-}.tar.gz"
6365
)
6466
for package in "${package_url_tail[@]}" ; do
6567
KEY="${package%%;*}"

prerequisites/build.sh

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ fi
4646
# shellcheck source=./use-case/bootstrap.sh
4747
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
4848

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

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

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

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

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

9291
info "-b (--branch): ${arg_b} "
92+
info "-B (--list-branches): ${arg_B} "
9393
info "-c (--with-c): ${arg_c} "
9494
info "-C (--with-cxx): ${arg_C} "
9595
info "-d (--debug): ${arg_d} "
@@ -101,7 +101,6 @@ 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} "
104-
info "-L (--list-branches): ${arg_L} "
105104
info "-m (--with-cmake): ${arg_m} "
106105
info "-M (--with-mpi): ${arg_M} "
107106
info "-n (--no-color): ${arg_n} "
@@ -113,10 +112,12 @@ info "-v (--version): ${arg_v} "
113112
info "-V (--print-version): ${arg_V} "
114113
}
115114

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

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

129130
# shellcheck source=./build-functions/set_or_print_installation_path.sh
130131
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
131-
set_or_print_installation_path
132+
133+
if [[ -z "${arg_B}" ]]; then
134+
set_or_print_installation_path
135+
fi
132136

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

137-
# shellcheck source=./build-functions/unpack_if_necessary.sh
138-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
139-
unpack_if_necessary
140-
141-
# shellcheck source=./build-functions/set_compilers.sh
142-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh"
143-
set_compilers
144-
145-
# shellcheck source=./build-functions/build_and_install.sh
146-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh"
147-
build_and_install
141+
if [[ -z "${arg_B}" ]]; then
142+
# shellcheck source=./build-functions/unpack_if_necessary.sh
143+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
144+
unpack_if_necessary
145+
146+
# shellcheck source=./build-functions/set_compilers.sh
147+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh"
148+
set_compilers
149+
150+
# shellcheck source=./build-functions/build_and_install.sh
151+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh"
152+
build_and_install
153+
fi

0 commit comments

Comments
 (0)