Skip to content

Commit efe62d4

Browse files
Damian Rousonzbeekman
authored andcommitted
Switch gcc download mechanism to ftp
"./build gcc --default" now results in the download of a 5.3.0 release tar ball from the nearest mirror, instead of the previous svn checkout of the trunk (6.0.0). Any gcc build launched by install.sh now installs release 5.3.0. When invoking "build" by other means, e.g., at the command line, a development branch can be built by specifying the branch name (e.g., "./build gcc gcc-5-branch"). Not specifying a branch is equivalent to "./build gcc trunk".
1 parent 09752c1 commit efe62d4

File tree

2 files changed

+57
-14
lines changed

2 files changed

+57
-14
lines changed

install.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,20 @@ find_or_install()
408408
stack_push dependency_pkg "bison"
409409
stack_push dependency_exe "yacc"
410410
stack_push dependency_path `./build bison --default --query-path`
411-
412411
else
413412
printf "no.\n"
414413
printf "$this_script: Using the $executable found in the PATH.\n"
415414
export FLEX=$executable
416415
stack_push acceptable_in_path $package $executable
417-
# Halt the recursion by removing flex from the dependency stack and indicating
418-
# that none of the prerequisites required to build flex are needed.
416+
# Remove $package from the dependency stack
417+
stack_pop dependency_pkg package_done
418+
stack_pop dependency_exe executable_done
419+
stack_pop dependency_path package_done_path
420+
# Put $package onto the script_installed log
421+
stack_push script_installed package_done
422+
stack_push script_installed executable_done
423+
stack_push script_installed package_done_path
424+
# Halt the recursion and signal that none of $package's prerequisites need to be built
419425
stack_push dependency_pkg "none"
420426
stack_push dependency_exe "none"
421427
stack_push dependency_path "none"

install_prerequisites/build

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,52 @@ usage()
5757
echo ""
5858
echo "[exit 10]"
5959
exit 10
60+
61+
# Private usage information
62+
#
63+
# The following arguments are intentionally not documented in the above public usage information because
64+
# they are intended for use by ../install.sh only rather than for use interactively at the command line:
65+
# Argument $2 Argument $3 Description
66+
# --default install the default version for the corresponding package
67+
# --default --query-path return the default installation location for the package
68+
# --default --query-version return the default version for the package
69+
# --default --query-url return the default download location for the package
70+
#
71+
# Example: ./build gcc --default --query-path
72+
#
73+
# With the exception of gcc, all uses of "--default" refer to the package version that would be downloaded
74+
# if no version is specified, e.g., "./build mpich". By contrast, "./build gcc" downloads the latest
75+
# pre-release, development branch (the "trunk"), whereas "./build gcc --default" downloads a released
76+
# version of gcc.
77+
#
78+
# The following argument works only with gcc and is mutually exclusive with the above private arguments
79+
# (it could be extended to work with any svn download):
80+
# Argument $2 Description
81+
# --avail list the development branches available for checkout
82+
# -a same as --avail
83+
#
84+
# Example: ./build gcc --avail
6085
}
6186

6287
# If the package name is recognized, then set the default version.
6388
# Otherwise, list the allowable package names and default versions and then exit.
6489
set_default_version()
6590
{
91+
version_requested=$2
6692
if [[ $package_to_build == "--list" || $package_to_build == "-l" ]]; then
6793
printf "\n"
6894
printf "The '$this_script' script can build the following packages:\n"
95+
elif [[ $package_to_build == "gcc" && $version_requested == "--default" ]]; then
96+
gcc_version="5.3.0"
97+
else
98+
gcc_version="trunk"
6999
fi
70100
# This is a bash 3 hack standing in for a bash 4 hash (bash 3 is the lowest common
71101
# denominator because, for licensing reasons, OS X only has bash 3 by default.)
72102
# See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
73103
package_version=(
74104
"cmake:3.4.0"
75-
"gcc:gcc-5-branch"
105+
"gcc:$gcc_version"
76106
"mpich:3.1.4"
77107
"wget:1.16.3"
78108
"flex:2.6.0"
@@ -100,7 +130,7 @@ set_default_version()
100130
elif [[ $package_to_build == "$KEY" ]]; then
101131
# We recognize the package name so we set the default version:
102132
verbosity=$1
103-
if [[ $verbosity != "quietly" ]]; then
133+
if [[ $2 != "--default" ]]; then
104134
printf "Using default version $VALUE\n"
105135
fi
106136
default_version=$VALUE
@@ -116,11 +146,16 @@ set_default_version()
116146

117147
check_prerequisites()
118148
{
149+
if [[ $package_to_build == "gcc" && $version_requested == "--default" ]]; then
150+
gcc_fetch="ftp"
151+
else
152+
gcc_fetch="svn"
153+
fi
119154
# This is a bash 3 hack standing in for a bash 4 hash (bash 3 is the lowest common
120155
# denominator because, for licensing reasons, OS X only has bash 3 by default.)
121156
# See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
122157
package_download_mechanism=(
123-
"gcc:svn"
158+
"gcc:$gcc_fetch"
124159
"wget:ftp"
125160
"cmake:wget"
126161
"mpich:wget"
@@ -166,9 +201,13 @@ set_url()
166201
{
167202
if [[ $package_to_build == 'cmake' ]]; then
168203
major_minor="${version_to_build%.*}"
204+
elif [[ "$package_to_build" == "gcc" && "$version_to_build" == "$default_version" ]]; then
205+
gcc_url_head="http://ftpmirror.gnu.org/gcc/gcc-5.3.0/"
206+
else
207+
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
169208
fi
170209
package_url_head=(
171-
"gcc;svn://gcc.gnu.org/svn/gcc/"
210+
"gcc;$gcc_url_head"
172211
"wget;ftp.gnu.org:/gnu/wget/"
173212
"m4;ftp.gnu.org:/gnu/m4/"
174213
"pkg-config;http://pkgconfig.freedesktop.org/releases/"
@@ -202,7 +241,7 @@ set_url()
202241
elif [[ $version_to_build == '--avail' || $version_to_build == '-a' ]]; then
203242
gcc_tail='branches'
204243
else
205-
gcc_tail=/branches/$version_to_build
244+
gcc_tail="gcc-$version_to_build.tar.bz2"
206245
fi
207246
fi
208247
package_url_tail=(
@@ -299,6 +338,7 @@ download_if_necessary()
299338
printf "Downloading $package_to_build $version_to_build to the following location:\n"
300339
printf "$download_path/$package_source_directory \n"
301340
printf "Download command: $fetch $args $url\n"
341+
printf "Depending on the file size and network bandwidth, this could take several minutes or longer."
302342
$fetch $args $url
303343
if [[ $version_to_build == '--avail' || $version_to_build == '-a' ]]; then
304344
# In this case, args="ls" and the list of available versions has been printed so we can move on.
@@ -390,11 +430,8 @@ package_to_build=$1
390430

391431
# Interpret the second command-line argument, if present, as the package version.
392432
# Otherwise, set the default package version.
393-
if [[ -z $2 ]]; then
394-
set_default_version
395-
version_to_build=$default_version
396-
elif [[ $2 == "--default" ]]; then
397-
set_default_version "quietly"
433+
if [[ -z $2 || $2 == "--default" ]]; then
434+
set_default_version $*
398435
version_to_build=$default_version
399436
else
400437
version_to_build=$2
@@ -446,7 +483,7 @@ elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
446483
else
447484
# Download, unpack, and build CMake
448485
download_path=${PWD}
449-
check_prerequisites &&
486+
check_prerequisites $* &&
450487
download_if_necessary &&
451488
unpack_if_necessary &&
452489
CC=$CC CXX=$CXX build_and_install $package_to_build $version_to_build $install_path $num_threads $download_path \

0 commit comments

Comments
 (0)