Skip to content

Commit 9d2dc94

Browse files
author
Damian Rouson
committed
Add ./build.sh -B to list gcc branches via svn
1 parent 43daf10 commit 9d2dc94

File tree

6 files changed

+84
-69
lines changed

6 files changed

+84
-69
lines changed

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: 11 additions & 7 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,10 +22,12 @@ 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.)

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: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ export __flag_present=1
6363
# shellcheck disable=SC2154
6464
if [[ "${arg_l}" != "${__flag_present}" && "${arg_L}" != "${__flag_present}" &&
6565
"${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."
66+
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}" ]]; then
67+
help "${__base}: Insufficient arguments. Please pass either -B, -D, -h, -l, -L, -p, -P, -U, -v, -V, or a longer equivalent."
6868
fi
6969

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
70+
# Suppress info and debug messages if -B, -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:-${arg_B}}}}}" ]] && suppress_info_debug_messages
7272

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

@@ -90,6 +90,7 @@ info "__usage: ${__usage}"
9090
info "LOG_LEVEL: ${LOG_LEVEL}"
9191

9292
info "-b (--branch): ${arg_b} "
93+
info "-B (--list-branches): ${arg_B} "
9394
info "-c (--with-c): ${arg_c} "
9495
info "-C (--with-cxx): ${arg_C} "
9596
info "-d (--debug): ${arg_d} "
@@ -113,10 +114,12 @@ info "-v (--version): ${arg_v} "
113114
info "-V (--print-version): ${arg_V} "
114115
}
115116

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}}"
117+
if [[ -z "${arg_B}" ]]; then
118+
# shellcheck source=./build-functions/set_or_print_default_version.sh
119+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
120+
set_or_print_default_version "${@}"
121+
export version_to_build="${arg_I:-${default_version}}"
122+
fi
120123

121124
# shellcheck source=./build-functions/set_or_print_downloader.sh
122125
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_downloader.sh"
@@ -128,20 +131,25 @@ set_or_print_url
128131

129132
# shellcheck source=./build-functions/set_or_print_installation_path.sh
130133
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
131-
set_or_print_installation_path
134+
135+
if [[ -z "${arg_B}" ]]; then
136+
set_or_print_installation_path
137+
fi
132138

133139
# shellcheck source=./build-functions/download_if_necessary.sh
134140
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/download_if_necessary.sh"
135141
download_if_necessary
136142

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
143+
if [[ -z "${arg_B}" ]]; then
144+
# shellcheck source=./build-functions/unpack_if_necessary.sh
145+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
146+
unpack_if_necessary
147+
148+
# shellcheck source=./build-functions/set_compilers.sh
149+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh"
150+
set_compilers
151+
152+
# shellcheck source=./build-functions/build_and_install.sh
153+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh"
154+
build_and_install
155+
fi

prerequisites/build.sh-usage

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
-b --branch [arg] Repository branch to download. Default="trunk"
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. (currently only arg=gcc is supported)
23
-c --with-c [arg] Use the specified C compiler. Default="gcc"
34
-C --with-cxx [arg] Use the specified C++ compiler. Default="g++"
45
-d --debug Enable debug mode.

0 commit comments

Comments
 (0)