|
1 | 1 | param( |
2 | | - [string]$WorkDirectory = (Join-Path $env:TEMP "vitasdk-msys-pacman-smoke") |
| 2 | + [string]$WorkDirectory = (Join-Path $env:TEMP "vitasdk-msys-pacman-smoke"), |
| 3 | + [string]$PacmanExecutable = "", |
| 4 | + [string]$RuntimeDll = "" |
3 | 5 | ) |
4 | 6 |
|
5 | 7 | $ErrorActionPreference = "Stop" |
@@ -54,21 +56,36 @@ $packagePath = Join-Path $WorkDirectory "vitasdk-msys-probe-1.0-1-any.pkg.tar.xz |
54 | 56 | (Join-Path $packageRoot "arm-vita-eabi/include") |
55 | 57 | ) | ForEach-Object { New-Item -ItemType Directory -Force -Path $_ | Out-Null } |
56 | 58 |
|
57 | | -$pacmanArchive = Join-Path $downloads "pacman.pkg.tar.zst" |
58 | | -$runtimeArchive = Join-Path $downloads "runtime.pkg.tar.zst" |
59 | | -Invoke-WebRequest -Uri $pacmanUrl -OutFile $pacmanArchive |
60 | | -Invoke-WebRequest -Uri $runtimeUrl -OutFile $runtimeArchive |
61 | | -Assert-Sha256 $pacmanArchive $pacmanSha256 |
62 | | -Assert-Sha256 $runtimeArchive $runtimeSha256 |
63 | | - |
64 | | -Invoke-Checked "tar.exe" @( |
65 | | - "-xf", $pacmanArchive, "-C", $extract, "usr/bin/pacman.exe" |
66 | | -) |
67 | | -Invoke-Checked "tar.exe" @( |
68 | | - "-xf", $runtimeArchive, "-C", $extract, "usr/bin/msys-2.0.dll" |
69 | | -) |
70 | | -Copy-Item (Join-Path $extract "usr/bin/pacman.exe") $pacmanBin |
71 | | -Copy-Item (Join-Path $extract "usr/bin/msys-2.0.dll") $pacmanBin |
| 59 | +if (($PacmanExecutable -eq "") -xor ($RuntimeDll -eq "")) { |
| 60 | + throw "PacmanExecutable and RuntimeDll must be supplied together" |
| 61 | +} |
| 62 | +if ($PacmanExecutable -ne "") { |
| 63 | + if (-not (Test-Path -PathType Leaf $PacmanExecutable)) { |
| 64 | + throw "built pacman executable is missing: ${PacmanExecutable}" |
| 65 | + } |
| 66 | + if (-not (Test-Path -PathType Leaf $RuntimeDll)) { |
| 67 | + throw "MSYS runtime DLL is missing: ${RuntimeDll}" |
| 68 | + } |
| 69 | + Copy-Item $PacmanExecutable (Join-Path $pacmanBin "pacman.exe") |
| 70 | + Copy-Item $RuntimeDll (Join-Path $pacmanBin "msys-2.0.dll") |
| 71 | +} |
| 72 | +else { |
| 73 | + $pacmanArchive = Join-Path $downloads "pacman.pkg.tar.zst" |
| 74 | + $runtimeArchive = Join-Path $downloads "runtime.pkg.tar.zst" |
| 75 | + Invoke-WebRequest -Uri $pacmanUrl -OutFile $pacmanArchive |
| 76 | + Invoke-WebRequest -Uri $runtimeUrl -OutFile $runtimeArchive |
| 77 | + Assert-Sha256 $pacmanArchive $pacmanSha256 |
| 78 | + Assert-Sha256 $runtimeArchive $runtimeSha256 |
| 79 | + |
| 80 | + Invoke-Checked "tar.exe" @( |
| 81 | + "-xf", $pacmanArchive, "-C", $extract, "usr/bin/pacman.exe" |
| 82 | + ) |
| 83 | + Invoke-Checked "tar.exe" @( |
| 84 | + "-xf", $runtimeArchive, "-C", $extract, "usr/bin/msys-2.0.dll" |
| 85 | + ) |
| 86 | + Copy-Item (Join-Path $extract "usr/bin/pacman.exe") $pacmanBin |
| 87 | + Copy-Item (Join-Path $extract "usr/bin/msys-2.0.dll") $pacmanBin |
| 88 | +} |
72 | 89 |
|
73 | 90 | $runtimeFiles = @(Get-ChildItem -File $pacmanBin) |
74 | 91 | if ($runtimeFiles.Count -ne 2) { |
|
0 commit comments