Skip to content

Commit a91c535

Browse files
author
Damian Rouson
committed
Adding scripts that download and install GCC and MPICH.
1 parent 579af14 commit a91c535

File tree

3 files changed

+241
-0
lines changed

3 files changed

+241
-0
lines changed

install_prerequisites/build.log

Whitespace-only changes.

install_prerequisites/buildgcc

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/bash
2+
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
3+
# Copyright (c) 2015, Sourcery, Inc.
4+
# Copyright (c) 2015, Sourcery Institute
5+
# All rights reserved.
6+
#
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+
#
10+
# All rights reserved.
11+
# Redistribution and use in source and binary forms, with or without modification,
12+
# are permitted provided that the following conditions are met:
13+
#
14+
# 1. Redistributions of source code must retain the above copyright notice, this
15+
# list of conditions and the following disclaimer.
16+
# 2. Redistributions in binary form must reproduce the above copyright notice, this
17+
# list of conditions and the following disclaimer in the documentation and/or
18+
# other materials provided with the distribution.
19+
# 3. Neither the names of the copyright holders nor the names of their contributors
20+
# may be used to endorse or promote products derived from this software without
21+
# specific prior written permission.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26+
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28+
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
# POSSIBILITY OF SUCH DAMAGE.
33+
34+
cmd=`basename $0`
35+
usage()
36+
{
37+
echo ""
38+
echo " $cmd - Bash script for building GCC from source"
39+
echo ""
40+
echo " Usage: $cmd <branch-name> <install-path> <number-of-threads> [options] ..."
41+
echo ""
42+
echo " Options:"
43+
echo " --help, -h Show this help message"
44+
echo " --version, -v, -V Report version and copyright information"
45+
echo ""
46+
echo " Example usage:"
47+
echo ""
48+
echo " $cmd trunk /opt/gnu/6.0 4"
49+
echo " $cmd gcc-5-branch /opt/gnu/5.2 4"
50+
echo " $cmd -v"
51+
echo " $cmd --help"
52+
echo ""
53+
echo " Note: use svn ls svn://gcc.gnu.org/svn/gcc/branches"
54+
echo " to list all available branches."
55+
echo ""
56+
exit 1
57+
}
58+
59+
build()
60+
{
61+
cd $1 &&
62+
./contrib/download_prerequisites &&
63+
cd .. &&
64+
mkdir -p $1-build &&
65+
cd $1\-build &&
66+
../$1/configure --prefix=$2 --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror &&
67+
make -j $num_threads bootstrap
68+
}
69+
70+
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+
78+
if [ $# == 0 ]; then
79+
# Print usage information if script is invoked without arguments
80+
usage | less
81+
elif [[ $1 == '--help' || $1 == '-h' ]]; then
82+
# Print usage information if script is invoked with --help or -h argument
83+
usage | less
84+
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
85+
# Print script copyright if invoked with -v, -V, or --version argument
86+
echo ""
87+
echo "GCC Build Script"
88+
echo "Copyright (C) 2015 Sourcery, Inc."
89+
echo ""
90+
echo "$cmd comes with NO WARRANTY, to the extent permitted by law."
91+
echo "You may redistribute copies of $cmd under the terms of the"
92+
echo "BSD 3-Clause License. For more information about these matters, see"
93+
echo "http://www.sourceryinstitute.org/license.html"
94+
echo ""
95+
else
96+
if [[ $1 == 'trunk' ]]; then
97+
url_tail=$1
98+
else
99+
url_tail=/branches/$1
100+
fi
101+
# Build gcc
102+
time \
103+
{
104+
if ! type svn > /dev/null; then
105+
echo
106+
echo "$cmd requires 'svn'. Please install it. Aborting."
107+
exit 1;
108+
else
109+
svn co svn://gcc.gnu.org/svn/gcc/$url_tail &&
110+
build $1 $2 $3
111+
fi
112+
} >&1 | tee build.log
113+
echo "Check build.log for results. If the build was successful,"
114+
echo "type 'make install' (or 'sudo make install') to complete"
115+
echo "the installation."
116+
fi

install_prerequisites/buildmpich

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/bin/bash
2+
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
3+
# Copyright (c) 2015, Sourcery, Inc.
4+
# Copyright (c) 2015, Sourcery Institute
5+
# All rights reserved.
6+
#
7+
# This script downloads and installs the MPICH library (http://www.mpich.org).
8+
#
9+
# All rights reserved.
10+
# Redistribution and use in source and binary forms, with or without modification,
11+
# are permitted provided that the following conditions are met:
12+
#
13+
# 1. Redistributions of source code must retain the above copyright notice, this
14+
# list of conditions and the following disclaimer.
15+
# 2. Redistributions in binary form must reproduce the above copyright notice, this
16+
# list of conditions and the following disclaimer in the documentation and/or
17+
# other materials provided with the distribution.
18+
# 3. Neither the names of the copyright holders nor the names of their contributors
19+
# may be used to endorse or promote products derived from this software without
20+
# specific prior written permission.
21+
#
22+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25+
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27+
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31+
# POSSIBILITY OF SUCH DAMAGE.
32+
33+
cmd=`basename $0`
34+
usage()
35+
{
36+
echo ""
37+
echo " $cmd - Bash script for building GCC from source"
38+
echo ""
39+
echo " Usage: $cmd <branch-name> <install-path> <number-of-threads> [options] ..."
40+
echo ""
41+
echo " Options:"
42+
echo " --help, -h Show this help message"
43+
echo " --version, -v, -V Report version and copyright information"
44+
echo ""
45+
echo " Example usage:"
46+
echo ""
47+
echo " $cmd default /opt/mpich/3.1.4 4"
48+
echo " $cmd 3.1.4 /opt/mpich/3.1.4 4"
49+
echo " $cmd -v"
50+
echo " $cmd --help"
51+
echo ""
52+
echo " Note: use svn ls svn://gcc.gnu.org/svn/gcc/branches"
53+
echo " to list all available branches."
54+
echo ""
55+
exit 1
56+
}
57+
58+
# Default to compiling with the GNU compilers
59+
if [ -z "$CC" ]; then
60+
CC=gcc
61+
fi
62+
if [ -z "$FC" ]; then
63+
FC=gfortran
64+
fi
65+
if [ -z "$CXX" ]; then
66+
CXX=g++
67+
fi
68+
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+
}
76+
77+
# Default to 2 threads if no specified thread count:
78+
if [ -z $3 ]; then
79+
num_threads=2
80+
else
81+
num_threads=$3
82+
fi
83+
84+
if [ $# == 0 ]; then
85+
# Print usage information if script is invoked without arguments
86+
usage | less
87+
elif [[ $1 == '--help' || $1 == '-h' ]]; then
88+
# Print usage information if script is invoked with --help or -h argument
89+
usage | less
90+
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
91+
# Print script copyright if invoked with -v, -V, or --version argument
92+
echo ""
93+
echo "GCC Build Script"
94+
echo "Copyright (C) 2015 Sourcery, Inc."
95+
echo "Copyright (C) 2015 Sourcery Institute"
96+
echo ""
97+
echo "$cmd comes with NO WARRANTY, to the extent permitted by law."
98+
echo "You may redistribute copies of $cmd under the terms of the"
99+
echo "BSD 3-Clause License. For more information about these matters, see"
100+
echo "http://www.sourceryinstitute.org/license.html"
101+
echo ""
102+
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
110+
time \
111+
{
112+
if ! type wget > /dev/null; then
113+
echo
114+
echo "$cmd requires 'wget'. Please install it. Aborting."
115+
exit 1;
116+
else
117+
wget http://www.mpich.org/static/downloads/$version/$src.tar.gz &&
118+
tar xvzf $src.tar.gz &&
119+
build $version $2 $num_threads
120+
fi
121+
} >&1 | tee build.log
122+
echo "Check build.log for results. If the build was successful,"
123+
echo "type 'make install' (or 'sudo make install') to complete"
124+
echo "the installation."
125+
fi

0 commit comments

Comments
 (0)