Add macOS x86_64 platform support

Platform detection now happens in framework/platform, sourced by both
sync.sh and the node shim. Uses shasum on macOS, sha256sum on Linux.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 11:21:41 -05:00
parent 60643409f6
commit eb12471941
6 changed files with 77 additions and 19 deletions

39
sync.sh
View File

@@ -9,6 +9,26 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=framework/versions
source "$DIR/framework/versions"
# shellcheck source=framework/platform
source "$DIR/framework/platform"
# Get platform-specific variables
nodejs_binary_var="nodejs_binary_${platform}"
nodejs_checksum_var="nodejs_checksum_${platform}"
nodejs_dirname_var="nodejs_dirname_${platform}"
nodejs_binary="${!nodejs_binary_var}"
nodejs_checksum="${!nodejs_checksum_var}"
nodejs_dirname="${!nodejs_dirname_var}"
pnpm_binary_var="pnpm_binary_${platform}"
pnpm_checksum_var="pnpm_checksum_${platform}"
pnpm_binary_url="${!pnpm_binary_var}"
pnpm_checksum="${!pnpm_checksum_var}"
# Set up paths for shims to use
nodejs_dist_dir="framework/binaries/$nodejs_dirname"
nodejs_bin_dir="$nodejs_dist_dir/bin"
# Ensure correct node version is installed
node_installed_checksum_file="$DIR/framework/binaries/.node.checksum"
node_installed_checksum=""
@@ -16,19 +36,19 @@ if [ -f "$node_installed_checksum_file" ]; then
node_installed_checksum=$(cat "$node_installed_checksum_file")
fi
if [ "$node_installed_checksum" != "$nodejs_checksum_linux_x86_64" ]; then
echo "Downloading Node.js..."
if [ "$node_installed_checksum" != "$nodejs_checksum" ]; then
echo "Downloading Node.js for $platform..."
node_archive="$DIR/framework/downloads/node.tar.xz"
curl -fsSL "$nodejs_binary_linux_x86_64" -o "$node_archive"
curl -fsSL "$nodejs_binary" -o "$node_archive"
echo "Verifying checksum..."
echo "$nodejs_checksum_linux_x86_64 $node_archive" | sha256sum -c -
echo "$nodejs_checksum $node_archive" | sha256_check
echo "Extracting Node.js..."
tar -xf "$node_archive" -C "$DIR/framework/binaries"
rm "$node_archive"
echo "$nodejs_checksum_linux_x86_64" >"$node_installed_checksum_file"
echo "$nodejs_checksum" >"$node_installed_checksum_file"
fi
# Ensure correct pnpm version is installed
@@ -39,15 +59,12 @@ if [ -f "$pnpm_installed_checksum_file" ]; then
pnpm_installed_checksum=$(cat "$pnpm_installed_checksum_file")
fi
# pnpm checksum includes "sha256:" prefix, strip it for sha256sum
pnpm_checksum="${pnpm_checksum_linux_x86_64#sha256:}"
if [ "$pnpm_installed_checksum" != "$pnpm_checksum" ]; then
echo "Downloading pnpm..."
curl -fsSL "$pnpm_binary_linux_x86_64" -o "$pnpm_binary"
echo "Downloading pnpm for $platform..."
curl -fsSL "$pnpm_binary_url" -o "$pnpm_binary"
echo "Verifying checksum..."
echo "$pnpm_checksum $pnpm_binary" | sha256sum -c -
echo "$pnpm_checksum $pnpm_binary" | sha256_check
chmod +x "$pnpm_binary"