Skip to content

Instantly share code, notes, and snippets.

@panekj
Created July 31, 2021 21:15
Show Gist options
  • Save panekj/97336f613bc992f728654a2f6e98d56e to your computer and use it in GitHub Desktop.
Save panekj/97336f613bc992f728654a2f6e98d56e to your computer and use it in GitHub Desktop.
Patch for PowerShell/PowerShell build module to allow cross compile to arm/arm64 Alpine
diff --git a/build.psm1 b/build.psm1
index 6028c5fdc..531116d47 100644
--- a/build.psm1
+++ b/build.psm1
@@ -298,6 +298,8 @@ function Start-PSBuild {
# We do not use ValidateScript since we want tab completion
# If this parameter is not provided it will get determined automatically.
[ValidateSet("alpine-x64",
+ "alpine-arm",
+ "alpine-arm64",
"fxdependent",
"fxdependent-win-desktop",
"linux-arm",
@@ -802,6 +804,8 @@ function New-PSOptions {
# We do not use ValidateScript since we want tab completion
[ValidateSet("",
"alpine-x64",
+ "alpine-arm",
+ "alpine-arm64",
"fxdependent",
"fxdependent-win-desktop",
"linux-arm",
@@ -1188,7 +1192,7 @@ function Start-PSPester {
# if we are building for Alpine, we must include the runtime as linux-x64
# will not build runnable test tools
if ( $environment.IsLinux -and $environment.IsAlpine ) {
- $publishArgs['runtime'] = 'alpine-x64'
+ $publishArgs['runtime'] = "alpine-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToLower)"
}
Publish-PSTestTools @publishArgs | ForEach-Object {Write-Host $_}
}
@@ -2326,6 +2330,8 @@ function Start-CrossGen {
[Parameter(Mandatory=$true)]
[ValidateSet("alpine-x64",
+ "alpine-arm",
+ "alpine-arm64",
"linux-arm",
"linux-arm64",
"linux-x64",
@@ -2353,6 +2359,8 @@ function Start-CrossGen {
[Parameter(Mandatory = $true)]
[ValidateSet("alpine-x64",
+ "alpine-arm",
+ "alpine-arm64",
"linux-arm",
"linux-arm64",
"linux-x64",
@@ -2376,6 +2384,14 @@ function Start-CrossGen {
$targetOS = 'linux'
$targetArch = 'x64'
}
+ 'alpine-arm' {
+ $targetOS = 'linux'
+ $targetArch = 'arm'
+ }
+ 'alpine-arm64' {
+ $targetOS = 'linux'
+ $targetArch = 'arm64'
+ }
'win-arm' {
$targetOS = 'windows'
$targetArch = 'arm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment