diff options
| author | Luke Parker <[email protected]> | 2026-02-13 07:50:43 +1000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-13 07:50:43 +1000 |
| commit | 4018c863e3b4b9857fe9378ae54e406a5cf5ab48 (patch) | |
| tree | 21c31cadf403aba1fd6bb0af50351255be99de0a /install | |
| parent | a8f2884521e755cea9b9e4e52406267bcbda15d2 (diff) | |
| download | opencode-4018c863e3b4b9857fe9378ae54e406a5cf5ab48.tar.gz opencode-4018c863e3b4b9857fe9378ae54e406a5cf5ab48.zip | |
fix: baseline CPU detection (#13371)
Diffstat (limited to 'install')
| -rwxr-xr-x | install | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -130,7 +130,7 @@ else needs_baseline=false if [ "$arch" = "x64" ]; then if [ "$os" = "linux" ]; then - if ! grep -qi avx2 /proc/cpuinfo 2>/dev/null; then + if ! grep -qwi avx2 /proc/cpuinfo 2>/dev/null; then needs_baseline=true fi fi @@ -141,6 +141,20 @@ else needs_baseline=true fi fi + + if [ "$os" = "windows" ]; then + ps="(Add-Type -MemberDefinition \"[DllImport(\"\"kernel32.dll\"\")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);\" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)" + out="" + if command -v powershell.exe >/dev/null 2>&1; then + out=$(powershell.exe -NoProfile -NonInteractive -Command "$ps" 2>/dev/null || true) + elif command -v pwsh >/dev/null 2>&1; then + out=$(pwsh -NoProfile -NonInteractive -Command "$ps" 2>/dev/null || true) + fi + out=$(echo "$out" | tr -d '\r' | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]') + if [ "$out" != "true" ] && [ "$out" != "1" ]; then + needs_baseline=true + fi + fi fi target="$os-$arch" |
