-
Notifications
You must be signed in to change notification settings - Fork 61
/
bootstrap-cmake.sh
executable file
·43 lines (33 loc) · 1013 Bytes
/
bootstrap-cmake.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
cleanup() {
rm -rf "$1"
}
if [ -z "$1" ]
then
echo "Usage: bootstrap-cmake.sh INSTALLDIR"
exit 1
else
installdir=$(realpath $1)
fi
set -e
builddir=$(mktemp -d)
trap "cleanup ${builddir}" EXIT
pushd "${builddir}" > /dev/null
cmakebaseurl="https://github.com/Kitware/CMake/releases/download/v"
cmakeversion="3.27.4"
unames=$(uname -s | tr '[:upper:]' '[:lower:]')
unamem=$(uname -m | tr '[:upper:]' '[:lower:]')
cmaketargz="cmake-${cmakeversion}-${unames}-${unamem}.tar.gz"
cmakechecksums="cmake-${cmakeversion}-SHA-256.txt"
cmake="${cmakebaseurl}${cmakeversion}/$cmaketargz"
echo "Downloading ${cmake}"
curl -L -O -# "${cmake}"
curl -L -O -s "${cmakebaseurl}${cmakeversion}/$cmakechecksums"
grep "${unames}.*${unamem}.*\.tar\.gz" $cmakechecksums > checksum.txt
sha256sum -c checksum.txt
echo "Installing to ${installdir}"
mkdir -p "${installdir}"
tar xf "$cmaketargz" -C "$installdir" --strip-components=1
echo "Use via"
echo " export PATH=${installdir}/bin:\$PATH"
popd > /dev/null