From 74336ae2531617626c5b283c5541dd3dbb84df2c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 19 Aug 2026 16:21:59 -0400 Subject: [PATCH] Detect Windows-on-ARM in dir_build under an emulated shell uname reports x86_64 in an emulated x64 shell, so the staged build got the wrong architecture. --- app/scripts/dir_build | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/scripts/dir_build b/app/scripts/dir_build index 4a815f2ed1..c15b026531 100755 --- a/app/scripts/dir_build +++ b/app/scripts/dir_build @@ -76,10 +76,16 @@ if [[ $platform = "m" ]]; then else # Windows / Linux: derive arch if not supplied if [[ -z $arch ]]; then - case "$(uname -m)" in - arm64|aarch64) arch="arm64" ;; - x86_64) arch="x64" ;; - esac + # On Windows on ARM, an emulated x64 shell reports x86_64 from uname, so check + # the native architecture in the registry + if [[ $platform = "w" ]] && reg.exe query 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -v PROCESSOR_ARCHITECTURE 2> /dev/null | grep -q ARM64; then + arch="arm64" + else + case "$(uname -m)" in + arm64|aarch64) arch="arm64" ;; + x86_64) arch="x64" ;; + esac + fi fi fi