Skip to content

Commit 8570065

Browse files
author
Damian Rouson
committed
Adding the install_prerequisites folder to avoid having to maintain different installation instructions on the master and branch-1.0.0 branches. (Keeping version number at 1.0.3 because the releas hasn't been tagged and posted yet.)
Signed-off-by: Damian Rouson <damian@sourceryinstitute.org>
1 parent 617ffc1 commit 8570065

File tree

4 files changed

+440
-0
lines changed

4 files changed

+440
-0
lines changed

install_prerequisites/CMakeLists.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Write the script that builds GCC from source
2+
set(exe_dir ${CMAKE_BINARY_DIR}/bin_staging)
3+
set(gcc_build_script ${exe_dir}/buildgcc)
4+
install(
5+
FILES "${gcc_build_script}"
6+
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
7+
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
8+
)
9+
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/buildgcc BUILDGCC_SCRIPT)
10+
file(WRITE "${gcc_build_script}" "${BUILDGCC_SCRIPT}\n")
11+
12+
# Write the script that builds MPICH from source
13+
set(mpich_build_script ${exe_dir}/buildmpich)
14+
install(
15+
FILES "${mpich_build_script}"
16+
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
17+
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
18+
)
19+
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/buildmpich BUILDMPICH_SCRIPT)
20+
file(WRITE "${mpich_build_script}" "${BUILDMPICH_SCRIPT}\n")
21+
22+
# Write the script that builds CMake from source
23+
set(cmake_build_script ${exe_dir}/buildcmake)
24+
install(
25+
FILES "${cmake_build_script}"
26+
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
27+
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
28+
)
29+
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/buildcmake BUILDCMAKE_SCRIPT)
30+
file(WRITE "${cmake_build_script}" "${BUILDCMAKE_SCRIPT}\n")

install_prerequisites/buildcmake

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

install_prerequisites/buildgcc

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

0 commit comments

Comments
 (0)