Skip to content

Commit a2548d1

Browse files
author
Damian Rouson
committed
Fix #612: on Linux, install CMake binary
1 parent a412c3e commit a2548d1

File tree

2 files changed

+37
-24
lines changed

2 files changed

+37
-24
lines changed

prerequisites/build-functions/build_and_install.sh

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ build_and_install()
2323
info "pushd ${build_path}"
2424
pushd "${build_path}"
2525

26-
if [[ "${package_to_build}" != "gcc" && "${package_to_build}" != "cmake" ]]; then
26+
if [[ "${package_to_build}" != "gcc" ]]; then
2727

2828
if [[ "${package_to_build}" == "mpich" && "${version_to_build}" == "3.2" ]]; then
2929
info "Patching MPICH 3.2 on Mac OS due to segfault bug (see http://lists.mpich.org/pipermail/discuss/2016-May/004764.html)."
@@ -32,23 +32,32 @@ build_and_install()
3232
cp "${download_path}/${package_source_directory}/src/include/mpiimpl.h.patched" "${download_path}/${package_source_directory}/src/include/mpiimpl.h"
3333
fi
3434

35-
info "Configuring ${package_to_build} ${version_to_build} with the following command:"
36-
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" \"${download_path}/${package_source_directory}\"/configure --prefix=\"${install_path}\""
37-
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" "${download_path}/${package_source_directory}"/configure --prefix="${install_path}"
38-
info "Building with the following command:"
39-
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" make -j\"${num_threads}\""
40-
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" make "-j${num_threads}"
41-
info "Installing ${package_to_build} in ${install_path}"
42-
if [[ ! -z "${SUDO:-}" ]]; then
43-
info "You do not have write permissions to the installation path ${install_path}"
44-
info "If you have administrative privileges, enter your password to install ${package_to_build}"
45-
fi
46-
info "Installing with the following command: ${SUDO:-} make install"
47-
${SUDO:-} make install
35+
if [[ "${package_to_build}" == "cmake" && $(uname) == "Linux" ]]; then
36+
37+
export cmake_binary_installer="${download_path}/cmake-${version_to_build}-Linux-x86_64.sh"
38+
${SUDO:-} mkdir -p "$install_path"
39+
chmod u+x "${cmake_binary_installer}"
40+
info "Installing Cmake with the following command: "
41+
info "\"${cmake_binary_installer}\" --prefix=\"$install_path\" --exclude-subdir"
42+
"${cmake_binary_installer}" --prefix="$install_path" --exclude-subdir
43+
44+
else # build from source
45+
46+
info "Configuring ${package_to_build} ${version_to_build} with the following command:"
47+
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" \"${download_path}/${package_source_directory}\"/configure --prefix=\"${install_path}\""
48+
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" "${download_path}/${package_source_directory}"/configure --prefix="${install_path}"
49+
info "Building with the following command:"
50+
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" make -j\"${num_threads}\""
51+
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" make "-j${num_threads}"
52+
info "Installing ${package_to_build} in ${install_path}"
53+
if [[ ! -z "${SUDO:-}" ]]; then
54+
info "You do not have write permissions to the installation path ${install_path}"
55+
info "If you have administrative privileges, enter your password to install ${package_to_build}"
56+
fi
57+
info "Installing with the following command: ${SUDO:-} make install"
58+
${SUDO:-} make install
4859

49-
elif [[ ${package_to_build} == "cmake" ]]; then
50-
51-
emergency "Ready to install cmake binary in ${PWD}"
60+
fi
5261

5362
elif [[ ${package_to_build} == "gcc" ]]; then
5463

prerequisites/build-functions/unpack_if_necessary.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ unpack_if_necessary()
55
if [[ "${fetch}" == "svn" || "${fetch}" == "git" ]]; then
66
package_source_directory="${version_to_build}"
77
else
8-
info "Unpacking ${url_tail}."
9-
info "pushd ${download_path}"
10-
pushd "${download_path}"
11-
info "Unpack command: tar xf ${url_tail}"
12-
tar xf "${url_tail}"
13-
info "popd"
14-
popd
8+
if [[ ${url_tail} == "*tar.gz" || ${url_tail} == "*tar.bz2" || ${url_tail} == "*.tar.xz" ]]; then
9+
info "Unpacking ${url_tail}."
10+
info "pushd ${download_path}"
11+
pushd "${download_path}"
12+
info "Unpack command: tar xf ${url_tail}"
13+
tar xf "${url_tail}"
14+
info "popd"
15+
popd
16+
else
17+
info "Skipping unpacking because ${url_tail} is not a compressed archive (*.gz, *.bz2, or *.xz). "
18+
fi
1519
# shellcheck disable=SC2034
1620
package_source_directory="${package_name}-${version_to_build}"
1721
fi

0 commit comments

Comments
 (0)