Toolchain: Make BuildCMake.sh work on macOS without brew on PATH
This commit is contained in:
parent
f3db548a3d
commit
f2011ad0dd
Notes:
sideshowbarker
2024-07-17 01:52:36 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/f2011ad0dd Pull-request: https://github.com/SerenityOS/serenity/pull/16925 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/gmta
1 changed files with 18 additions and 1 deletions
|
@ -22,6 +22,23 @@ fi
|
|||
|
||||
[ -z "$MAKEJOBS" ] && MAKEJOBS=$($NPROC)
|
||||
|
||||
check_sha() {
|
||||
if [ $# -ne 2 ]; then
|
||||
error "Usage: check_sha FILE EXPECTED_HASH"
|
||||
return 1
|
||||
fi
|
||||
|
||||
FILE="${1}"
|
||||
EXPECTED_HASH="${2}"
|
||||
|
||||
if [ "$SYSTEM_NAME" = "Darwin" ]; then
|
||||
SEEN_HASH="$(shasum -a 256 "${FILE}" | cut -d " " -f 1)"
|
||||
else
|
||||
SEEN_HASH="$(sha256sum "${FILE}" | cut -d " " -f 1)"
|
||||
fi
|
||||
test "${EXPECTED_HASH}" = "${SEEN_HASH}"
|
||||
}
|
||||
|
||||
# Note: Update this alongside Meta/CMake/cmake-version.cmake
|
||||
CMAKE_VERSION=3.25.1
|
||||
CMAKE_ARCHIVE_SHA256=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8
|
||||
|
@ -37,7 +54,7 @@ pushd "$DIR"/Tarballs
|
|||
echo "${CMAKE_ARCHIVE} already exists, not downloading archive"
|
||||
fi
|
||||
|
||||
if ! sha256sum --status -c <(echo "${CMAKE_ARCHIVE_SHA256}" "${CMAKE_ARCHIVE}"); then
|
||||
if ! check_sha "${CMAKE_ARCHIVE}" "${CMAKE_ARCHIVE_SHA256}"; then
|
||||
echo "CMake archive SHA256 sum mismatch, please run script again"
|
||||
rm -f "${CMAKE_ARCHIVE}"
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Reference in a new issue