Skip to content

Commit

Permalink
Adding the install_prerequisites folder to avoid having to maintain d…
Browse files Browse the repository at this point in the history
…ifferent 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>
  • Loading branch information
rouson committed Oct 1, 2015
1 parent 617ffc1 commit 8570065
Show file tree
Hide file tree
Showing 4 changed files with 440 additions and 0 deletions.
30 changes: 30 additions & 0 deletions install_prerequisites/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Write the script that builds GCC from source
set(exe_dir ${CMAKE_BINARY_DIR}/bin_staging)
set(gcc_build_script ${exe_dir}/buildgcc)
install(
FILES "${gcc_build_script}"
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/buildgcc BUILDGCC_SCRIPT)
file(WRITE "${gcc_build_script}" "${BUILDGCC_SCRIPT}\n")

# Write the script that builds MPICH from source
set(mpich_build_script ${exe_dir}/buildmpich)
install(
FILES "${mpich_build_script}"
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/buildmpich BUILDMPICH_SCRIPT)
file(WRITE "${mpich_build_script}" "${BUILDMPICH_SCRIPT}\n")

# Write the script that builds CMake from source
set(cmake_build_script ${exe_dir}/buildcmake)
install(
FILES "${cmake_build_script}"
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/buildcmake BUILDCMAKE_SCRIPT)
file(WRITE "${cmake_build_script}" "${BUILDCMAKE_SCRIPT}\n")
135 changes: 135 additions & 0 deletions install_prerequisites/buildcmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash
#
# buildcmake
#
# -- This script downloads and installs the CMake cross-platform Makefile generator
# (http://www.cmake.org).
#
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
# Copyright (c) 2015, Sourcery, Inc.
# Copyright (c) 2015, Sourcery Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
# 3. Neither the names of the copyright holders nor the names of their contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

cmd=`basename $0`
usage()
{
echo ""
echo " $cmd - Bash script for building CMake from source"
echo ""
echo " Usage (optional arguments in square brackets): "
echo " $cmd <version-number> [<installation-path> <number-of-threads>]"
echo " or $cmd [options] "
echo ""
echo " Options:"
echo " --help, -h Show this help message"
echo " --version, -v, -V Report version and copyright information"
echo ""
echo " Example usage:"
echo ""
echo " $cmd default"
echo " $cmd 3.3"
echo " $cmd 3.3 /opt/cmake/3.3 4"
echo " $cmd -v"
echo " $cmd --help"
echo ""
echo " Note: For a list of available CMake versions, visit"
echo " http://www.cmake.org/files/"
echo ""
exit 1
}

# Default to installing CMake 3.3 if no version specified in the first
# command-line argument
if [[ $1 == 'default' ]]; then
version=3.3
else
version=$1
fi

# Default to installing in the present working directory if no install path is specified:
if [ -z $2 ]; then
install_path=${PWD}
else
install_path=$2
fi

# Default to 2 threads if no specified thread count:
if [ -z $3 ]; then
num_threads=2
else
num_threads=$3
fi

# Make the build directory, configure, and build
build()
{
cd cmake-$version.0 &&
./bootstrap --prefix=$install_path &&
make -j $num_threads
}

if [ $# == 0 ]; then
# Print usage information if script is invoked without arguments
usage | less
elif [[ $1 == '--help' || $1 == '-h' ]]; then
# Print usage information if script is invoked with --help or -h argument
usage | less
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
# Print script copyright if invoked with -v, -V, or --version argument
echo ""
echo "CMake Build Script"
echo "Copyright (C) 2015 Sourcery, Inc."
echo "Copyright (C) 2015 Sourcery Institute"
echo ""
echo "$cmd comes with NO WARRANTY, to the extent permitted by law."
echo "You may redistribute copies of $cmd under the terms of the"
echo "BSD 3-Clause License. For more information about these matters, see"
echo "http://www.sourceryinstitute.org/license.html"
echo ""
else
# Download and build CMake
time \
{
if ! type wget > /dev/null; then
echo
echo "$cmd requires 'wget'. Please install it. Aborting."
exit 1;
else
# Download CMake
wget http://www.cmake.org/files/v$version/cmake-$version.0-1-src.tar.bz2 &&
# Unpack the downloaded tape archive
tar xvjf cmake-$version.0-1-src.tar.bz2 &&
tar xvjf cmake-$version.0.tar.bz2 &&
# Compile Cmake source
build $version $install_path $num_threads
fi
} >&1 | tee build.log
echo ""
echo "Check build.log for results. If the build was successful, type"
echo "'cd cmake-$version.0 && make install' (or 'cd cmake-$version.0 && sudo make install')"
echo "to complete the installation."
echo ""
fi
129 changes: 129 additions & 0 deletions install_prerequisites/buildgcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/bin/bash
#
# buildgcc
#
# -- This script downloads and installs the GNU Compiler Collection (GCC),
# including the C, C++, and Fortran compilers (http://gcc.gnu.org).
# Execute the script with no arguments to obtain usage information.
#
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
# Copyright (c) 2015, Sourcery, Inc.
# Copyright (c) 2015, Sourcery Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
# 3. Neither the names of the copyright holders nor the names of their contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

cmd=`basename $0`
usage()
{
echo ""
echo " $cmd - Bash script for building GCC from source"
echo ""
echo " Usage: "
echo " $cmd <branch-name> [<install-path> <number-of-threads>] "
echo " or $cmd [options] ..."
echo ""
echo " Options:"
echo " --help, -h Show this help message"
echo " --version, -v, -V Report version and copyright information"
echo ""
echo " Example usage:"
echo ""
echo " $cmd trunk "
echo " $cmd trunk /opt/gnu/6.0 4"
echo " $cmd gcc-5-branch /opt/gnu/5.2 4"
echo " $cmd -v"
echo " $cmd --help"
echo ""
echo " Note: use svn ls svn://gcc.gnu.org/svn/gcc/branches"
echo " to list all available branches."
echo ""
exit 1
}

# Default to installing in the present working directory if no install path is specified:
if [ -z $2 ]; then
install_path=${PWD}
else
install_path=$2
fi

# Default to 2 threads if no specified thread count:
if [ -z $3 ]; then
num_threads=2
else
num_threads=$3
fi

build()
{
cd $1 &&
./contrib/download_prerequisites &&
cd .. &&
mkdir -p $1-build &&
cd $1\-build &&
../$1/configure --prefix=$install_path --enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror &&
make -j $num_threads bootstrap
}


if [ $# == 0 ]; then
# Print usage information if script is invoked without arguments
usage | less
elif [[ $1 == '--help' || $1 == '-h' ]]; then
# Print usage information if script is invoked with --help or -h argument
usage | less
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
# Print script copyright if invoked with -v, -V, or --version argument
echo ""
echo "GCC Build Script"
echo "Copyright (C) 2015 Sourcery, Inc."
echo ""
echo "$cmd comes with NO WARRANTY, to the extent permitted by law."
echo "You may redistribute copies of $cmd under the terms of the"
echo "BSD 3-Clause License. For more information about these matters, see"
echo "http://www.sourceryinstitute.org/license.html"
echo ""
else
if [[ $1 == 'trunk' ]]; then
url_tail=$1
else
url_tail=/branches/$1
fi
# Build gcc
time \
{
if ! type svn > /dev/null; then
echo
echo "$cmd requires 'svn'. Please install it. Aborting."
exit 1;
else
svn co svn://gcc.gnu.org/svn/gcc/$url_tail &&
build $1 $install_path $num_threads
fi
} >&1 | tee build.log
echo "Check build.log for results. If the build was successful, type"
echo "'cd $1-build && make install' (or 'cd $1-build && sudo make install')"
echo "to complete the installation."
fi
Loading

0 comments on commit 8570065

Please sign in to comment.