Skip to content

Commit 65352aa

Browse files
Merge pull request #26048 from l0rd/winmake-arm64-support
Update winmake.ps1 to build arm64 artifacts
2 parents 401d170 + 7fddbd4 commit 65352aa

File tree

5 files changed

+53
-19
lines changed

5 files changed

+53
-19
lines changed

contrib/win-installer/build.ps1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if ($args.Count -lt 1 -or $args[0].Length -lt 1) {
5555
Write-Host 'Uses Env Vars: '
5656
Write-Host ' $ENV:FETCH_BASE_URL - GitHub Repo Address to locate release on'
5757
Write-Host ' $ENV:V531_SETUP_EXE_PATH - Path to v5.3.1 setup.exe used to build the patch'
58+
Write-Host ' $ENV:PODMAN_ARCH - Installer target platform (x64 or arm64)'
5859
Write-Host 'Env Settings for signing (optional)'
5960
Write-Host ' $ENV:VAULT_ID'
6061
Write-Host ' $ENV:APP_ID'
@@ -103,6 +104,16 @@ if ($ENV:INSTVER -eq "") {
103104
Exit 1
104105
}
105106

107+
$installerPlatform = ""
108+
if ($null -eq $ENV:PODMAN_ARCH -or $ENV:PODMAN_ARCH -eq "amd64") {
109+
$installerPlatform = "x64"
110+
} elseif ($ENV:PODMAN_ARCH -eq "arm64") {
111+
$installerPlatform = "arm64"
112+
} else {
113+
Write-Host "Unknown architecture $ENV:PODMAN_ARCH. Valid options are amd64 or arm64."
114+
Exit 1
115+
}
116+
106117
SignItem @("artifacts/win-sshproxy.exe",
107118
"artifacts/podman.exe")
108119
$gvExists = Test-Path "artifacts/gvproxy.exe"
@@ -123,10 +134,10 @@ if ($gvExists) {
123134
if (Test-Path ./obj) {
124135
Remove-Item ./obj -Recurse -Force -Confirm:$false
125136
}
126-
dotnet build podman.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" -o .; ExitOnError
137+
dotnet build podman.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" /property:InstallerPlatform="$installerPlatform" -o .; ExitOnError
127138
SignItem @("en-US\podman.msi")
128139

129-
dotnet build podman-setup.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" -o .; ExitOnError
140+
dotnet build podman-setup.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" /property:InstallerPlatform="$installerPlatform" -o .; ExitOnError
130141
wix burn detach podman-setup.exe -engine engine.exe; ExitOnError
131142
SignItem @("engine.exe")
132143

contrib/win-installer/podman-setup.wixproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<Project Sdk="WixToolset.Sdk/5.0.2">
22
<PropertyGroup>
3-
<InstallerPlatform>x64</InstallerPlatform>
43
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
54
<OutputType>Bundle</OutputType>
65
</PropertyGroup>

contrib/win-installer/podman.wixproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<Project Sdk="WixToolset.Sdk/5.0.2">
22
<PropertyGroup>
3-
<InstallerPlatform>x64</InstallerPlatform>
43
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
54
</PropertyGroup>
65
<ItemGroup>

contrib/win-installer/podman.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
-->
5252
<SetProperty Id="HIDE_PROVIDER_CHOICE" After="AppSearch" Value="1" Sequence="first" Condition="(SKIP_CONFIG_FILE_CREATION = 1) OR (MACHINE_PROVIDER_CONFIG_FILE_PATH) OR (MAIN_EXECUTABLE_FILE_PATH)" />
5353

54-
<CustomAction Id="OpenGuide" DllEntry="WixShellExec" Impersonate="yes" BinaryRef="Wix4UtilCA_X86" />
54+
<CustomAction Id="OpenGuide" DllEntry="WixShellExec" Impersonate="yes" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" />
5555
<util:BroadcastEnvironmentChange />
5656
<Feature Id="Complete" Level="1">
5757
<ComponentRef Id="INSTALLDIR_Component" />

winmake.ps1

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11

22
#!/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+
)
320

421
. ./contrib/cirrus/win-lib.ps1
522

@@ -12,6 +29,7 @@ function Podman-Remote{
1229
$commit = Git-Commit
1330
$commit = "-X github.com/containers/podman/v5/libpod/define.gitCommit=$commit "
1431

32+
$ENV:GOARCH = $architecture
1533
Run-Command "go build --ldflags `"$commit $buildInfo `" --tags `"$remotetags`" --o ./bin/windows/podman.exe ./cmd/podman/."
1634
}
1735

@@ -75,8 +93,14 @@ function Win-SSHProxy {
7593
$match = Select-String -Path "$PSScriptRoot\go.mod" -Pattern "github.com/containers/gvisor-tap-vsock\s+(v[\d\.]+)"
7694
$Version = $match.Matches.Groups[1].Value
7795
}
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+
}
80104
}
81105

82106
function Installer{
@@ -115,6 +139,7 @@ function Installer{
115139

116140
# Run \contrib\win-installer\build.ps1
117141
Push-Location $PSScriptRoot\contrib\win-installer
142+
$ENV:PODMAN_ARCH = $architecture # This is used by the "build.ps1" script
118143
Run-Command ".\build.ps1 $version $suffix `"$zipFileDest`""
119144
Pop-Location
120145
}
@@ -298,7 +323,7 @@ function Build-Distribution-Zip-File{
298323
);
299324
$binariesFolder = "$PSScriptRoot\bin\windows"
300325
$documentationFolder = "$PSScriptRoot\docs\build\remote\"
301-
$zipFile = "$destinationPath\podman-remote-release-windows_amd64.zip"
326+
$zipFile = "$destinationPath\podman-remote-release-windows_$architecture.zip"
302327

303328
# Create a temporary folder to store the distribution files
304329
$tempFolder = New-Item -ItemType Directory -Force -Path "$env:TEMP\podman-windows"
@@ -332,7 +357,7 @@ function Get-Podman-Version{
332357
}
333358

334359
# Init script
335-
$target = $args[0]
360+
$target = $params[0]
336361

337362
$remotetags = "remote exclude_graphdriver_btrfs containers_image_openpgp"
338363

@@ -344,30 +369,30 @@ switch ($target) {
344369
Local-Unit
345370
}
346371
'localmachine' {
347-
if ($args.Count -gt 1) {
348-
$files = $args[1]
372+
if ($params.Count -gt 1) {
373+
$files = $params[1]
349374
}
350-
Local-Machine -files $files
375+
Local-Machine -files $files
351376
}
352377
'clean' {
353378
Make-Clean
354379
}
355380
{$_ -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]
358383
}
359384
Win-SSHProxy($ref)
360385
}
361386
'installer' {
362-
if ($args.Count -gt 1) {
363-
Installer -version $args[1]
387+
if ($params.Count -gt 1) {
388+
Installer -version $params[1]
364389
} else {
365390
Installer
366391
}
367392
}
368393
'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]
371396
} else {
372397
Test-Installer
373398
}
@@ -385,7 +410,7 @@ switch ($target) {
385410
Lint
386411
}
387412
default {
388-
Write-Host "Usage: " $MyInvocation.MyCommand.Name "<target> [options]"
413+
Write-Host "Usage: " $MyInvocation.MyCommand.Name "<target> [options] [<-architecture|-arch>=<amd64|arm64>]"
389414
Write-Host
390415
Write-Host "Example: Build podman-remote "
391416
Write-Host " .\winmake podman-remote"

0 commit comments

Comments
 (0)