Skip to content

Commit da16252

Browse files
author
Damian Rouson
committed
Updated build script comments and variable names.
Signed-off-by: Damian Rouson <[email protected]>
1 parent 91666b0 commit da16252

File tree

2 files changed

+72
-37
lines changed

2 files changed

+72
-37
lines changed

install_prerequisites/buildgcc

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#!/bin/bash
2+
#
3+
# buildgcc
4+
#
5+
# -- This script downloads and installs the GNU Compiler Collection (GCC),
6+
# including the C, C++, and Fortran compilers (http://gcc.gnu.org).
7+
#
28
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
39
# Copyright (c) 2015, Sourcery, Inc.
410
# Copyright (c) 2015, Sourcery Institute
511
# All rights reserved.
612
#
7-
# This script downloads and installs the GNU Compiler Collection (GCC), including
8-
# the GCC C, C++, and Fortran compilers (http://gcc.gnu.org).
9-
#
1013
# All rights reserved.
1114
# Redistribution and use in source and binary forms, with or without modification,
1215
# are permitted provided that the following conditions are met:
@@ -37,14 +40,17 @@ usage()
3740
echo ""
3841
echo " $cmd - Bash script for building GCC from source"
3942
echo ""
40-
echo " Usage: $cmd <branch-name> <install-path> <number-of-threads> [options] ..."
43+
echo " Usage: "
44+
echo " $cmd <branch-name> [<install-path> <number-of-threads>] "
45+
echo " or $cmd [options] ..."
4146
echo ""
4247
echo " Options:"
4348
echo " --help, -h Show this help message"
4449
echo " --version, -v, -V Report version and copyright information"
4550
echo ""
4651
echo " Example usage:"
4752
echo ""
53+
echo " $cmd trunk "
4854
echo " $cmd trunk /opt/gnu/6.0 4"
4955
echo " $cmd gcc-5-branch /opt/gnu/5.2 4"
5056
echo " $cmd -v"
@@ -56,25 +62,32 @@ usage()
5662
exit 1
5763
}
5864

65+
# Default to 2 threads if no specified thread count:
66+
if [ -z $2 ]; then
67+
install_path=${PWD}
68+
else
69+
install_path=$2
70+
fi
71+
72+
# Default to 2 threads if no specified thread count:
73+
if [ -z $3 ]; then
74+
num_threads=2
75+
else
76+
num_threads=$3
77+
fi
78+
5979
build()
6080
{
6181
cd $1 &&
6282
./contrib/download_prerequisites &&
6383
cd .. &&
6484
mkdir -p $1-build &&
6585
cd $1\-build &&
66-
../$1/configure --prefix=$2 --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror &&
86+
../$1/configure --prefix=$install_path --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror &&
6787
make -j $num_threads bootstrap
6888
}
6989

7090

71-
# Default to 2 threads if no specified thread count:
72-
if [ -z $3 ]; then
73-
num_threads=2
74-
else
75-
num_threads=$3
76-
fi
77-
7891
if [ $# == 0 ]; then
7992
# Print usage information if script is invoked without arguments
8093
usage | less
@@ -107,7 +120,7 @@ else
107120
exit 1;
108121
else
109122
svn co svn://gcc.gnu.org/svn/gcc/$url_tail &&
110-
build $1 $2 $3
123+
build $1 $install_path $num_threads
111124
fi
112125
} >&1 | tee build.log
113126
echo "Check build.log for results. If the build was successful,"

install_prerequisites/buildmpich

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/bin/bash
2+
#
3+
# buildmpich
4+
#
5+
# -- This script ownloads and installs the MPICH library (http://www.mpich.org).
6+
#
27
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
38
# Copyright (c) 2015, Sourcery, Inc.
49
# Copyright (c) 2015, Sourcery Institute
510
# All rights reserved.
611
#
7-
# This script downloads and installs the MPICH library (http://www.mpich.org).
8-
#
912
# All rights reserved.
1013
# Redistribution and use in source and binary forms, with or without modification,
1114
# are permitted provided that the following conditions are met:
@@ -34,9 +37,11 @@ cmd=`basename $0`
3437
usage()
3538
{
3639
echo ""
37-
echo " $cmd - Bash script for building GCC from source"
40+
echo " $cmd - Bash script for building MPICH from source"
3841
echo ""
39-
echo " Usage: $cmd <branch-name> <install-path> <number-of-threads> [options] ..."
42+
echo " Usage (optional arguments in square brackets): "
43+
echo " $cmd <version-number> <install-path> <number-of-threads>"
44+
echo " or $cmd [options] "
4045
echo ""
4146
echo " Options:"
4247
echo " --help, -h Show this help message"
@@ -49,13 +54,14 @@ usage()
4954
echo " $cmd -v"
5055
echo " $cmd --help"
5156
echo ""
52-
echo " Note: use svn ls svn://gcc.gnu.org/svn/gcc/branches"
53-
echo " to list all available branches."
57+
echo " Note: For a list of available MPICH versions, visit"
58+
echo " http://www.mpich.org/static/downloads/"
5459
echo ""
5560
exit 1
5661
}
5762

58-
# Default to compiling with the GNU compilers
63+
# Default to compiling with the GNU compilers if the environment
64+
# variables CC, FC, and CXX, are empty:
5965
if [ -z "$CC" ]; then
6066
CC=gcc
6167
fi
@@ -66,21 +72,40 @@ if [ -z "$CXX" ]; then
6672
CXX=g++
6773
fi
6874

69-
build()
70-
{
71-
mkdir -p $src\-build &&
72-
cd $src\-build &&
73-
CC=$CC FC=$FC CXX=$CXX ../$src/configure --prefix=$2 &&
74-
make -j $num_threads
75-
}
75+
# Default to installing MPICH 3.1.4 if no version specified in the first
76+
# command-line argument
77+
if [[ $1 == 'default' ]]; then
78+
version=3.1.4
79+
else
80+
version=$1
81+
fi
82+
# Default to installing in the current directory if no path is provided
83+
# in the second command-line argument
84+
if [ -z $2 ]; then
85+
install_path=${PWD}
86+
else
87+
install_path=$2
88+
fi
7689

77-
# Default to 2 threads if no specified thread count:
90+
# Default to building with 2 threads if no thread count is specified
91+
# in the third command-line argument
7892
if [ -z $3 ]; then
7993
num_threads=2
8094
else
8195
num_threads=$3
8296
fi
8397

98+
src=mpich-$version
99+
100+
# Make the build directory, configure, and build
101+
build()
102+
{
103+
mkdir -p $src\-build &&
104+
cd $src\-build &&
105+
CC=$CC FC=$FC CXX=$CXX ../$src/configure --prefix=$install_path &&
106+
make -j $num_threads
107+
}
108+
84109
if [ $# == 0 ]; then
85110
# Print usage information if script is invoked without arguments
86111
usage | less
@@ -90,7 +115,7 @@ elif [[ $1 == '--help' || $1 == '-h' ]]; then
90115
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
91116
# Print script copyright if invoked with -v, -V, or --version argument
92117
echo ""
93-
echo "GCC Build Script"
118+
echo "MPICH Build Script"
94119
echo "Copyright (C) 2015 Sourcery, Inc."
95120
echo "Copyright (C) 2015 Sourcery Institute"
96121
echo ""
@@ -100,23 +125,20 @@ elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
100125
echo "http://www.sourceryinstitute.org/license.html"
101126
echo ""
102127
else
103-
if [[ $1 == 'default' ]]; then
104-
version=3.1.4
105-
else
106-
version=$1
107-
fi
108-
src=mpich-$version
109-
# Build mpich
128+
# Download and build mpich
110129
time \
111130
{
112131
if ! type wget > /dev/null; then
113132
echo
114133
echo "$cmd requires 'wget'. Please install it. Aborting."
115134
exit 1;
116135
else
136+
# Download MPICH
117137
wget http://www.mpich.org/static/downloads/$version/$src.tar.gz &&
138+
# Unpack the downloaded tape archive
118139
tar xvzf $src.tar.gz &&
119-
build $version $2 $num_threads
140+
# Compile MPICH source
141+
build $version $install_path $num_threads
120142
fi
121143
} >&1 | tee build.log
122144
echo "Check build.log for results. If the build was successful,"

0 commit comments

Comments
 (0)