From 90923960bca834cd2f24d851f820940c72752f43 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 21 Apr 2026 19:01:39 +0530 Subject: [PATCH] Add support for arm64 builds --- bin/phpsdk_setshell.bat | 8 ++++---- lib/php/libsdk/SDK/Config.php | 12 ++++++++++++ phpsdk-vs16-arm64.bat | 5 +++++ phpsdk-vs17-arm64.bat | 5 +++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 phpsdk-vs16-arm64.bat create mode 100644 phpsdk-vs17-arm64.bat diff --git a/bin/phpsdk_setshell.bat b/bin/phpsdk_setshell.bat index 224c7f5..88faaf0 100755 --- a/bin/phpsdk_setshell.bat +++ b/bin/phpsdk_setshell.bat @@ -118,10 +118,10 @@ if 15 gtr %PHP_SDK_VS_NUM% ( set /a PHP_SDK_VS_RANGE=PHP_SDK_VS_NUM + 1 set PHP_SDK_VS_RANGE="[%PHP_SDK_VS_NUM%,!PHP_SDK_VS_RANGE%!)" - set APPEND=x86.x64 - if /i "%PHP_SDK_OS_ARCH%"=="arm64" ( - set APPEND=ARM64 - ) + set APPEND=x86.x64 + if /i "%PHP_SDK_ARCH%"=="arm64" ( + set APPEND=ARM64 + ) set VS_VERSION_ARGS="-latest" if "%TOOLSET%"=="" set VS_VERSION_ARGS=-version !PHP_SDK_VS_RANGE! for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo !VS_VERSION_ARGS! -requires Microsoft.VisualStudio.Component.VC.Tools.!APPEND! -property installationPath -format text') do ( diff --git a/lib/php/libsdk/SDK/Config.php b/lib/php/libsdk/SDK/Config.php index d6ccf8b..1d23bfd 100644 --- a/lib/php/libsdk/SDK/Config.php +++ b/lib/php/libsdk/SDK/Config.php @@ -326,6 +326,18 @@ public static function getCurrentBranchData() : array } } + /* Native arm64 dependency series are not always published yet. + Reuse x64 packages as a temporary fallback when possible. */ + if ((!isset($ret["arch"]) || !$ret["arch"]) && "arm64" == self::getCurrentArchName()) { + foreach ($data as $d) { + if ("x64" == $d["arch"] && self::getCurrentStabilityName() == $d["stability"]) { + $ret["arch"] = $d["arch"]; + $ret["stability"] = $d["stability"]; + break; + } + } + } + if (!isset($ret["arch"]) || !$ret["arch"]) { throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'"); } diff --git a/phpsdk-vs16-arm64.bat b/phpsdk-vs16-arm64.bat new file mode 100644 index 0000000..ea36c30 --- /dev/null +++ b/phpsdk-vs16-arm64.bat @@ -0,0 +1,5 @@ +@echo off + +call %~dp0phpsdk-starter.bat -c vs16 -a arm64 %* + +exit /b %ERRORLEVEL% diff --git a/phpsdk-vs17-arm64.bat b/phpsdk-vs17-arm64.bat new file mode 100644 index 0000000..1f0592e --- /dev/null +++ b/phpsdk-vs17-arm64.bat @@ -0,0 +1,5 @@ +@echo off + +call %~dp0phpsdk-starter.bat -c vs17 -a arm64 %* + +exit /b %ERRORLEVEL%