aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/install-mingw.ps1
blob: fc02631dccc6096a81e8df2d251b61ac8cd5cbb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function InstallMinGW
{
    Param (
        [string] $version     = $(BadParam("the version being printed to versions.txt")),
        [string] $release     = $(BadParam("release part of the file name"))
    )

    $envvar = "MINGW$version"
    $envvar = $envvar -replace '["."]'
    $targetdir = "C:\$envvar"
    $url_cache = "\\ci-files01-hki.intra.qt.io\provisioning\windows\i686-" + $version + "-" + $release + ".7z"

    $mingwPackage = "C:\Windows\Temp\MinGW-$version.zip"
    Copy-Item $url_cache $mingwPackage

    Get-ChildItem $mingwPackage | % {& "C:\Utils\sevenzip\7z.exe" "x" $_.fullname "-o$TARGETDIR"}

    echo "Adding MinGW environment variable."
    [Environment]::SetEnvironmentVariable("$envvar", "$targetdir\mingw32", [EnvironmentVariableTarget]::Machine)

    echo "Cleaning $mingwPackage.."
    Remove-Item -Recurse -Force "$mingwPackage"

    echo "MinGW = $version $release" >> ~\versions.txt

}