-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
ubuntu_install_cmake_source.sh
executable file
·40 lines (36 loc) · 1.39 KB
/
ubuntu_install_cmake_source.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
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
CMAKE_VERSION="3.30.4"
CMAKE_SHA256="c759c97274f1e7aaaafcb1f0d261f9de9bf3a5d6ecb7e2df616324a46fe704b2"
# parse argument
CMAKE_VERSION=${1:-$CMAKE_VERSION}
CMAKE_SHA256=${2:-$CMAKE_SHA256}
v=$(echo $CMAKE_VERSION | sed 's/\(.*\)\..*/\1/g')
echo "Installing cmake $CMAKE_VERSION ($v)"
wget https://cmake.org/files/v${v}/cmake-${CMAKE_VERSION}.tar.gz
echo "$CMAKE_SHA256" cmake-${CMAKE_VERSION}.tar.gz | sha256sum -c
tar xvf cmake-${CMAKE_VERSION}.tar.gz
pushd cmake-${CMAKE_VERSION}
./bootstrap
make -j$(nproc)
make install
popd
rm -rf cmake-${CMAKE_VERSION} cmake-${CMAKE_VERSION}.tar.gz