From ffc2927189601f50df483b4c6ac892693128d28d Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 28 Mar 2025 16:51:36 -0600 Subject: [PATCH] Add install-cmake-binary.sh This only works for Linux for now, but it would not be hard to get this to also work for other systems if needed. Signed-off-by: Roscoe A. Bartlett --- .../devtools_install/install-cmake-binary.sh | 57 +++++++++++++++++++ .../build_ref/TribitsBuildReferenceBody.rst | 25 ++++++-- 2 files changed, 78 insertions(+), 4 deletions(-) create mode 100755 tribits/devtools_install/install-cmake-binary.sh diff --git a/tribits/devtools_install/install-cmake-binary.sh b/tribits/devtools_install/install-cmake-binary.sh new file mode 100755 index 000000000..ad9db3dfa --- /dev/null +++ b/tribits/devtools_install/install-cmake-binary.sh @@ -0,0 +1,57 @@ +#!/bin/bash -e +# +# Install CMake from binary download: +# +# instal-cmake-binary +# +# 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}/" diff --git a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index 948bcbbb9..b668a9456 100644 --- a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -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 or greater is -recommended) from: +Download and install the CMake binaries (version ```` 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 / + $ TRIBITS_BASE_DIR=/tribits + $ $TRIBITS_BASE_DIR/devtools_install/install-cmake-binary.sh \ + + +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] @@ -49,7 +66,7 @@ If you have access to the git repositories (which which includes a snapshot of TriBITS), then install CMake with:: $ cd / - $ TRIBITS_BASE_DIR=/cmake/tribits + $ TRIBITS_BASE_DIR=/tribits $ $TRIBITS_BASE_DIR/devtools_install/install-cmake.py \ --install-dir-base= --cmake-version=X.Y.Z \ --do-all