Skip to content
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

MINIFICPP-2205 fix install_cmake_from_binary on ARM64 #1647

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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