Skip to content

Commit fa52783

Browse files
committed
Refactor cmake build script to use ./bootstrap. Corrected typs on other build scripts.
Signed-off-by: Damian Rouson <[email protected]>
1 parent df0fe33 commit fa52783

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

install_prerequisites/buildcmake

+24-17
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# Copyright (c) 2015, Sourcery Institute
1111
# All rights reserved.
1212
#
13-
# All rights reserved.
1413
# Redistribution and use in source and binary forms, with or without modification,
1514
# are permitted provided that the following conditions are met:
1615
#
@@ -41,7 +40,7 @@ usage()
4140
echo " $cmd - Bash script for building CMake from source"
4241
echo ""
4342
echo " Usage (optional arguments in square brackets): "
44-
echo " $cmd <version-number>"
43+
echo " $cmd <version-number> [<installation-path> <number-of-threads>]"
4544
echo " or $cmd [options] "
4645
echo ""
4746
echo " Options:"
@@ -52,6 +51,7 @@ usage()
5251
echo ""
5352
echo " $cmd default"
5453
echo " $cmd 3.3"
54+
echo " $cmd 3.3 /opt/cmake/3.3 4"
5555
echo " $cmd -v"
5656
echo " $cmd --help"
5757
echo ""
@@ -61,18 +61,6 @@ usage()
6161
exit 1
6262
}
6363

64-
# Default to compiling with the GNU compilers if the environment
65-
# variables CC, FC, and CXX, are empty:
66-
if [ -z "$CC" ]; then
67-
CC=gcc
68-
fi
69-
if [ -z "$FC" ]; then
70-
FC=gfortran
71-
fi
72-
if [ -z "$CXX" ]; then
73-
CXX=g++
74-
fi
75-
7664
# Default to installing CMake 3.3 if no version specified in the first
7765
# command-line argument
7866
if [[ $1 == 'default' ]]; then
@@ -81,10 +69,26 @@ else
8169
version=$1
8270
fi
8371

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+
8486
# Make the build directory, configure, and build
8587
build()
8688
{
87-
./cmake-$version.0-1.sh all
89+
cd cmake-$version.0 &&
90+
./bootstrap --prefix=$install_path &&
91+
make -j $num_threads
8892
}
8993

9094
if [ $# == 0 ]; then
@@ -118,11 +122,14 @@ else
118122
wget http://www.cmake.org/files/v$version/cmake-$version.0-1-src.tar.bz2 &&
119123
# Unpack the downloaded tape archive
120124
tar xvjf cmake-$version.0-1-src.tar.bz2 &&
125+
tar xvjf cmake-$version.0.tar.bz2 &&
121126
# Compile Cmake source
122-
build $version
127+
build $version $install_path $num_threads
123128
fi
124129
} >&1 | tee build.log
125130
echo ""
126-
echo "Check build.log for results."
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."
127134
echo ""
128135
fi

install_prerequisites/buildgcc

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# Copyright (c) 2015, Sourcery Institute
1212
# All rights reserved.
1313
#
14-
# All rights reserved.
1514
# Redistribution and use in source and binary forms, with or without modification,
1615
# are permitted provided that the following conditions are met:
1716
#

install_prerequisites/buildmpich

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# Copyright (c) 2015, Sourcery Institute
1010
# All rights reserved.
1111
#
12-
# All rights reserved.
1312
# Redistribution and use in source and binary forms, with or without modification,
1413
# are permitted provided that the following conditions are met:
1514
#

0 commit comments

Comments
 (0)