Skip to content

Add install-cmake-binary.sh #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions tribits/devtools_install/install-cmake-binary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash -e
#
# Install CMake from binary download:
#
# instal-cmake-binary <cmake-version> <install-prefix-base>
#
# For example, running:
#
# instal-cmake-binary 4.0.0-rc2 ${HOME}/install
#
# will download the install binary to:
#
# /tmp/${USER}/
#
# and then install CMake from that binary to:
#
# ${HOME}/install/cmake-4.0.0-rc2/
#
#

# Input args
cmake_version=$1
install_prefix_base=$2

# Names and locations
cmake_download_url=https://github.com/Kitware/CMake/releases/download
CMAKE_BINARY_TMP_DIR=/tmp/${USER}
cmake_install_script_name=cmake-${cmake_version}-Linux-x86_64.sh
cmake_install_script=${CMAKE_BINARY_TMP_DIR}/${cmake_install_script_name}
cmake_install_dir=${install_prefix_base}/cmake-${cmake_version}

if [[ ! -d ${CMAKE_BINARY_TMP_DIR} ]] ; then
echo
echo "Creating temp dir ${CMAKE_BINARY_TMP_DIR}"
fi

echo
echo "Downloading ${cmake_install_script_name} to ${cmake_install_script} ..."
time wget -O ${cmake_install_script} \
${cmake_download_url}/v${cmake_version}/${cmake_install_script_name}
chmod a+x ${cmake_install_script}

if [[ ! -d ${cmake_install_dir} ]] ; then
echo
echo "Create install dir ${cmake_install_dir}"
mkdir ${cmake_install_dir}
fi

echo
echo "Installing binary using ${cmake_install_script} ..."
time ${cmake_install_script} --skip-license --prefix=${cmake_install_dir} \
--exclude-subdir

echo
echo "See the binaries installed under:"
echo
echo " ${cmake_install_dir}/"
25 changes: 21 additions & 4 deletions tribits/doc/build_ref/TribitsBuildReferenceBody.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,27 @@ that once CMake is installed that it will be in the default path with the name
Installing a binary release of CMake [casual users]
---------------------------------------------------

Download and install the binary (version <MinCMakeVer> or greater is
recommended) from:
Download and install the CMake binaries (version ``<MinCMakeVer>`` or greater
is recommended) from:

http://www.cmake.org/cmake/resources/software.html
https://cmake.org/download/

Use the following script to automate the download and install (on Linux) of
any tagged version of CMake from the CMake GitHub repo::

$ cd <some-scratch-space>/
$ TRIBITS_BASE_DIR=<tribits-base-dir>/tribits
$ $TRIBITS_BASE_DIR/devtools_install/install-cmake-binary.sh \
<cmake-version> <install-base-dir>

For example, to install CMake ``4.0.0-rc4`` under ``${HOME}/install``, run::

$ $TRIBITS_BASE_DIR/devtools_install/install-cmake-binary.sh \
4.0.0-rc4 ${HOME}/install

That installs the CMake binaries under::

${HOME}/install/cmake-4.0.0-rc4/bin/


Installing CMake from source [developers and experienced users]
Expand All @@ -49,7 +66,7 @@ If you have access to the <Project> git repositories (which which includes a
snapshot of TriBITS), then install CMake with::

$ cd <some-scratch-space>/
$ TRIBITS_BASE_DIR=<project-base-dir>/cmake/tribits
$ TRIBITS_BASE_DIR=<tribits-base-dir>/tribits
$ $TRIBITS_BASE_DIR/devtools_install/install-cmake.py \
--install-dir-base=<INSTALL_BASE_DIR> --cmake-version=X.Y.Z \
--do-all
Expand Down