2022-07-14 19:24:26 +03:00
|
|
|
Set-StrictMode -Version 2.0
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
|
|
|
|
$repo_root = (Get-Item "$PSScriptRoot\..\..").FullName
|
|
|
|
$toolchain_version = $args[0]
|
2022-10-26 01:15:02 +03:00
|
|
|
$toolchain_url = "https://update.flipperzero.one/builds/toolchain/gcc-arm-none-eabi-10.3-x86_64-windows-flipper-$toolchain_version.zip"
|
|
|
|
$toolchain_zip = "gcc-arm-none-eabi-10.3-x86_64-windows-flipper-$toolchain_version.zip"
|
|
|
|
$toolchain_dir = "gcc-arm-none-eabi-10.3-x86_64-windows-flipper"
|
2022-07-14 19:24:26 +03:00
|
|
|
|
2022-10-26 01:15:02 +03:00
|
|
|
if (Test-Path -LiteralPath "$repo_root\toolchain\x86_64-windows") {
|
2022-07-14 19:24:26 +03:00
|
|
|
Write-Host -NoNewline "Removing old Windows toolchain.."
|
2022-10-26 01:15:02 +03:00
|
|
|
Remove-Item -LiteralPath "$repo_root\toolchain\x86_64-windows" -Force -Recurse
|
2022-07-14 19:24:26 +03:00
|
|
|
Write-Host "done!"
|
|
|
|
}
|
|
|
|
if (!(Test-Path -Path "$repo_root\$toolchain_zip" -PathType Leaf)) {
|
|
|
|
Write-Host -NoNewline "Downloading Windows toolchain.."
|
|
|
|
$wc = New-Object net.webclient
|
|
|
|
$wc.Downloadfile("$toolchain_url", "$repo_root\$toolchain_zip")
|
|
|
|
Write-Host "done!"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(Test-Path -LiteralPath "$repo_root\toolchain")) {
|
|
|
|
New-Item "$repo_root\toolchain" -ItemType Directory
|
|
|
|
}
|
|
|
|
|
2022-10-28 18:32:06 +03:00
|
|
|
Write-Host -NoNewline "Extracting Windows toolchain.."
|
2022-07-14 19:24:26 +03:00
|
|
|
Add-Type -Assembly "System.IO.Compression.Filesystem"
|
2022-10-28 18:32:06 +03:00
|
|
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("$repo_root\$toolchain_zip", "$repo_root\")
|
2022-10-26 01:15:02 +03:00
|
|
|
Move-Item -Path "$repo_root\$toolchain_dir" -Destination "$repo_root\toolchain\x86_64-windows"
|
2022-07-14 19:24:26 +03:00
|
|
|
Write-Host "done!"
|
|
|
|
|
2022-10-28 18:32:06 +03:00
|
|
|
Write-Host -NoNewline "Cleaning up temporary files.."
|
2022-07-14 19:24:26 +03:00
|
|
|
Remove-Item -LiteralPath "$repo_root\$toolchain_zip" -Force
|
|
|
|
Write-Host "done!"
|