Skip to content

Commit

Permalink
MINIFICPP-2205 fix install_cmake_from_binary on ARM64
Browse files Browse the repository at this point in the history
Signed-off-by: Ferenc Gerlits <fgerlits@gmail.com>
This closes #1647
  • Loading branch information
martinzink authored and fgerlits committed Sep 8, 2023
1 parent b53f934 commit 7d69cdf
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,24 @@ verify_gcc_enable(){

install_cmake_from_binary() {
CMAKE_VERSION="3.24.4"
CMAKE_URL="https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.tar.gz"
EXPECTED_SHA256="cac77d28fb8668c179ac02c283b058aeb846fe2133a57d40b503711281ed9f19"
arch=$(uname -m)
if [ "$arch" = "x86_64" ]; then
CMAKE_URL="https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.tar.gz"
EXPECTED_SHA256="cac77d28fb8668c179ac02c283b058aeb846fe2133a57d40b503711281ed9f19"
elif [ "$arch" = "aarch64" ]; then
CMAKE_URL="https://cmake.org/files/v3.24/cmake-3.24.4-linux-aarch64.tar.gz"
EXPECTED_SHA256="86f823f2636bf715af89da10e04daa476755a799d451baee66247846e95d7bee"
else
echo "Unknown architecture: $arch"
exit 1
fi

TMP_DIR=$(mktemp -d)

install_pkgs wget
wget -P "$TMP_DIR" "$CMAKE_URL"

ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | cut -d " " -f 1)
ACTUAL_SHA256=$(sha256sum "$TMP_DIR/cmake-$CMAKE_VERSION-linux-$arch.tar.gz" | cut -d " " -f 1)

if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then
echo "ERROR: SHA-256 verification failed. Aborting."
Expand All @@ -40,8 +49,8 @@ install_cmake_from_binary() {

echo "Installing CMake $CMAKE_VERSION to /opt/cmake-$CMAKE_VERSION..."
set -x
tar -C "$TMP_DIR" -zxf "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz"
sudo mv "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64" /opt/cmake-$CMAKE_VERSION
tar -C "$TMP_DIR" -zxf "$TMP_DIR/cmake-$CMAKE_VERSION-linux-$arch.tar.gz"
sudo mv "$TMP_DIR/cmake-$CMAKE_VERSION-linux-$arch" /opt/cmake-$CMAKE_VERSION

sudo ln -s "/opt/cmake-$CMAKE_VERSION/bin/cmake" /usr/local/bin/cmake
set +x
Expand Down

0 comments on commit 7d69cdf

Please sign in to comment.