-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Update winmake.ps1 to build arm64 artifacts #26048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update winmake.ps1 to build arm64 artifacts #26048
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: l0rd The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
winmake.ps1
Outdated
$defaultArchitecture = "amd64" | ||
# Property `OSArchitecture` of `System.Runtime.InteropServices.RuntimeInformation` | ||
# gets the platform architecture on which the current app is running. | ||
# Possible values are: X86, X64, Arm, Arm64, Wasm, S390x, LoongArch64, Armv6, Ppc64le, RiscV64 | ||
# https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.architecture | ||
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture | ||
if ($arch -eq "Arm64") { | ||
return "arm64" | ||
} elseif ($arch -eq "X64") { | ||
return "amd64" | ||
} else { | ||
Write-Host "Unsupported architecture $arch. Using default ($defaultArchitecture)." | ||
return $defaultArchitecture | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just run go env GOARCH
to get the default golang arch which should match the default platform and then does not need any conversation logic at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea—I haven't thought about that. It would make the parameter definition simpler. But if go is not installed, the script will fail: it won't even print the usage
or build targets that don't require go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the code to use go env GOARCH
as it finally doesn't fail if Go isn't installed but prints an error (and we can catch it and set the default arch).
5ae3b97
to
d3700c8
Compare
Nit: Can we also support using |
d3700c8
to
9d11d01
Compare
Makes sense. I have added |
9d11d01
to
c4a537d
Compare
Winmake could only build amd64 artifacts (podman-remote, gvproxy, win-sshproxy, podman.msi and podman-setup.exe). This commit makes the necessary change to winmake so that it: 1) builds arm64 artifacts when executed on arm64 2) cross-compiles to arm64/amd64 with the `-architecture` parameter It depends on containers#26023 that removes the need to build `check.c` code (that is not used anyway). Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
c4a537d
to
7fddbd4
Compare
My powershell isn't the best, but LGTM. |
/lgtm |
Winmake could only build AMD64 artifacts (podman-remote, gvproxy, win-sshproxy, podman.msi and podman-setup.exe).
This commit makes the necessary change to winmake so that it:
-architecture
(or-arch
) parameterIt depends on #26023, which removes the need to build
check.c
code (which is not used anyway).Does this PR introduce a user-facing change?