@@ -48,61 +48,44 @@ usage()
4848 echo " "
4949 echo " Examples:"
5050 echo " "
51- echo " $this_script gcc "
52- echo " $this_script gcc trunk"
53- echo " $this_script gcc 5.2.0 /opt/gnu/5.2.0 4"
54- echo " $this_script wget"
51+ echo " $this_script gcc Build the default GCC release"
52+ echo " $this_script gcc trunk Build the GCC development trunk"
53+ echo " $this_script gcc --default /opt/gnu/5.3.0 4 Build the default release in the specified path using 4 threads"
54+ echo " $this_script gcc 5.2.0 /opt/gnu/5.2.0 Build the GCC 5.2.0 release"
55+ echo " $this_script wget Build the wget package"
56+ echo " $this_script mpich --default --query-version Return the default mpich version built by $this_script "
57+ echo " $this_script flex --default --query-path Return the default flex installation path"
58+ echo " $this_script mpich --default --query-url Return the default mpich version built by $this_script "
5559 echo " $this_script --help"
5660 echo " $this_script --list"
5761 echo " "
5862 echo " [exit 10]"
5963 exit 10
6064
61- # Private usage information
65+ # The following argument invocation works only with gcc but could be extended to work with any svn download:
66+ #
67+ # ./build gcc --avail list the development branches available for checkout
68+ # ./build gcc --a same as --avail
6269#
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
70+ # The --avail and -a options are not listed in the printed usage information because building
71+ # non-trunk development branches (e.g., gcc-5-branch) is currently broken. A fix could be
72+ # accomplished most elegantly by first implementing POSIX getopts argument parsing.
8573}
8674
8775# If the package name is recognized, then set the default version.
8876# Otherwise, list the allowable package names and default versions and then exit.
8977set_default_version ()
9078{
91- version_requested=$2
9279 if [[ $package_to_build == " --list" || $package_to_build == " -l" ]]; then
9380 printf " \n"
9481 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"
9982 fi
10083 # This is a bash 3 hack standing in for a bash 4 hash (bash 3 is the lowest common
10184 # denominator because, for licensing reasons, OS X only has bash 3 by default.)
10285 # See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
10386 package_version=(
10487 " cmake:3.4.0"
105- " gcc:$gcc_version "
88+ " gcc:5.3.0 "
10689 " mpich:3.1.4"
10790 " wget:1.16.3"
10891 " flex:2.6.0"
@@ -129,7 +112,6 @@ set_default_version()
129112 exit 20
130113 elif [[ $package_to_build == " $KEY " ]]; then
131114 # We recognize the package name so we set the default version:
132- verbosity=$1
133115 if [[ $2 != " --default" ]]; then
134116 printf " Using default version $VALUE \n"
135117 fi
@@ -146,7 +128,7 @@ set_default_version()
146128
147129check_prerequisites ()
148130{
149- if [[ $package_to_build == " gcc" && $version_requested == " --default " ]]; then
131+ if [[ " $package_to_build " == " gcc" && " $version_to_build " != " trunk " ]]; then
150132 gcc_fetch=" ftp"
151133 else
152134 gcc_fetch=" svn"
@@ -201,8 +183,8 @@ set_url()
201183{
202184 if [[ $package_to_build == ' cmake' ]]; then
203185 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 /"
186+ elif [[ " $package_to_build " == " gcc" && " $version_to_build " != " trunk " ]]; then
187+ gcc_url_head=" http://ftpmirror.gnu.org/gcc/gcc-$version_to_build /"
206188 else
207189 gcc_url_head=" svn://gcc.gnu.org/svn/gcc/"
208190 fi
@@ -236,8 +218,8 @@ set_url()
236218
237219 # Set differing tails for GCC trunk versus branches
238220 if [[ $package_to_build == ' gcc' ]]; then
239- if [[ $version_to_build == ' trunk ' ]]; then
240- gcc_tail=' trunk '
221+ if [[ $fetch == ' svn ' ]]; then
222+ gcc_tail=$version_to_build
241223 elif [[ $version_to_build == ' --avail' || $version_to_build == ' -a' ]]; then
242224 gcc_tail=' branches'
243225 else
0 commit comments