1
1
2
2
# !/usr/bin/env powershell
3
+ [CmdletBinding (PositionalBinding = $false )]
4
+ param (
5
+ [ValidateSet (" amd64" , " arm64" )]
6
+ [Alias (" arch" )]
7
+ [string ]$architecture = $ (
8
+ $defaultArchitecture = " amd64"
9
+ $arch = try {& go env GOARCH} catch {
10
+ Write-Warning " Failed retriving the host architecture, using default ($defaultArchitecture ). Is Go installed?"
11
+ return $defaultArchitecture
12
+ }
13
+ if ($arch -cnotin @ (" arm64" , " amd64" )) {
14
+ Write-Warning " Unsupported architecture $arch . Using default ($defaultArchitecture )."
15
+ return $defaultArchitecture
16
+ }
17
+ ),
18
+ [parameter (ValueFromRemainingArguments )][object []]$params = @ ()
19
+ )
3
20
4
21
. ./ contrib/ cirrus/ win- lib.ps1
5
22
@@ -12,6 +29,7 @@ function Podman-Remote{
12
29
$commit = Git- Commit
13
30
$commit = " -X github.com/containers/podman/v5/libpod/define.gitCommit=$commit "
14
31
32
+ $ENV: GOARCH = $architecture
15
33
Run- Command " go build --ldflags `" $commit $buildInfo `" --tags `" $remotetags `" --o ./bin/windows/podman.exe ./cmd/podman/."
16
34
}
17
35
@@ -75,8 +93,14 @@ function Win-SSHProxy {
75
93
$match = Select-String - Path " $PSScriptRoot \go.mod" - Pattern " github.com/containers/gvisor-tap-vsock\s+(v[\d\.]+)"
76
94
$Version = $match.Matches.Groups [1 ].Value
77
95
}
78
- curl.exe - sSL - o " ./bin/windows/gvproxy.exe" -- retry 5 " https://github.com/containers/gvisor-tap-vsock/releases/download/$Version /gvproxy-windowsgui.exe"
79
- curl.exe - sSL - o " ./bin/windows/win-sshproxy.exe" -- retry 5 " https://github.com/containers/gvisor-tap-vsock/releases/download/$Version /win-sshproxy.exe"
96
+ Write-Host " Downloading gvproxy version $version "
97
+ if ($architecture -eq " amd64" ) {
98
+ curl.exe - sSL - o " ./bin/windows/gvproxy.exe" -- retry 5 " https://github.com/containers/gvisor-tap-vsock/releases/download/$Version /gvproxy-windowsgui.exe"
99
+ curl.exe - sSL - o " ./bin/windows/win-sshproxy.exe" -- retry 5 " https://github.com/containers/gvisor-tap-vsock/releases/download/$Version /win-sshproxy.exe"
100
+ } else {
101
+ curl.exe - sSL - o " ./bin/windows/gvproxy.exe" -- retry 5 " https://github.com/containers/gvisor-tap-vsock/releases/download/$Version /gvproxy-windows-arm64.exe"
102
+ curl.exe - sSL - o " ./bin/windows/win-sshproxy.exe" -- retry 5 " https://github.com/containers/gvisor-tap-vsock/releases/download/$Version /win-sshproxy-arm64.exe"
103
+ }
80
104
}
81
105
82
106
function Installer {
@@ -115,6 +139,7 @@ function Installer{
115
139
116
140
# Run \contrib\win-installer\build.ps1
117
141
Push-Location $PSScriptRoot \contrib\win- installer
142
+ $ENV: PODMAN_ARCH = $architecture # This is used by the "build.ps1" script
118
143
Run- Command " .\build.ps1 $version $suffix `" $zipFileDest `" "
119
144
Pop-Location
120
145
}
@@ -298,7 +323,7 @@ function Build-Distribution-Zip-File{
298
323
);
299
324
$binariesFolder = " $PSScriptRoot \bin\windows"
300
325
$documentationFolder = " $PSScriptRoot \docs\build\remote\"
301
- $zipFile = " $destinationPath \podman-remote-release-windows_amd64 .zip"
326
+ $zipFile = " $destinationPath \podman-remote-release-windows_ $architecture .zip"
302
327
303
328
# Create a temporary folder to store the distribution files
304
329
$tempFolder = New-Item - ItemType Directory - Force - Path " $env: TEMP \podman-windows"
@@ -332,7 +357,7 @@ function Get-Podman-Version{
332
357
}
333
358
334
359
# Init script
335
- $target = $args [0 ]
360
+ $target = $params [0 ]
336
361
337
362
$remotetags = " remote exclude_graphdriver_btrfs containers_image_openpgp"
338
363
@@ -344,30 +369,30 @@ switch ($target) {
344
369
Local- Unit
345
370
}
346
371
' localmachine' {
347
- if ($args .Count -gt 1 ) {
348
- $files = $args [1 ]
372
+ if ($params .Count -gt 1 ) {
373
+ $files = $params [1 ]
349
374
}
350
- Local- Machine - files $files
375
+ Local- Machine - files $files
351
376
}
352
377
' clean' {
353
378
Make- Clean
354
379
}
355
380
{$_ -in ' win-sshproxy' , ' win-gvproxy' } {
356
- if ($args .Count -gt 1 ) {
357
- $ref = $args [1 ]
381
+ if ($params .Count -gt 1 ) {
382
+ $ref = $params [1 ]
358
383
}
359
384
Win- SSHProxy($ref )
360
385
}
361
386
' installer' {
362
- if ($args .Count -gt 1 ) {
363
- Installer - version $args [1 ]
387
+ if ($params .Count -gt 1 ) {
388
+ Installer - version $params [1 ]
364
389
} else {
365
390
Installer
366
391
}
367
392
}
368
393
' installertest' {
369
- if ($args .Count -gt 1 ) {
370
- Test-Installer - provider $args [1 ]
394
+ if ($params .Count -gt 1 ) {
395
+ Test-Installer - provider $params [1 ]
371
396
} else {
372
397
Test-Installer
373
398
}
@@ -385,7 +410,7 @@ switch ($target) {
385
410
Lint
386
411
}
387
412
default {
388
- Write-Host " Usage: " $MyInvocation.MyCommand.Name " <target> [options]"
413
+ Write-Host " Usage: " $MyInvocation.MyCommand.Name " <target> [options] [<-architecture|-arch>=<amd64|arm64>] "
389
414
Write-Host
390
415
Write-Host " Example: Build podman-remote "
391
416
Write-Host " .\winmake podman-remote"
0 commit comments