diff --git a/build.psm1 b/build.psm1 index 3d0be1a846..016e3254e0 100644 --- a/build.psm1 +++ b/build.psm1 @@ -310,6 +310,7 @@ function Start-PSBuild { [ValidateSet("alpine-x64", "fxdependent", "fxdependent-linux-x64", + "fxdependent-linux-arm64", "fxdependent-win-desktop", "linux-arm", "linux-arm64", @@ -428,6 +429,7 @@ Fix steps: PSModuleRestore=$PSModuleRestore ForMinimalSize=$ForMinimalSize } + $script:Options = New-PSOptions @OptionsArguments if ($StopDevPowerShell) { @@ -886,6 +888,7 @@ function New-PSOptions { "alpine-x64", "fxdependent", "fxdependent-linux-x64", + "fxdependent-linux-arm64", "fxdependent-win-desktop", "linux-arm", "linux-arm64", @@ -970,9 +973,14 @@ function New-PSOptions { # Build the Output path if (!$Output) { - if ($Runtime -like 'fxdependent*') { + if ($Runtime -like 'fxdependent*' -and $Runtime -like 'fxdependent*linux*') { + $outputRuntime = $Runtime -replace 'fxdependent-', '' + $Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $outputRuntime, "publish", $Executable) + } + elseif ($Runtime -like 'fxdependent*') { $Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, "publish", $Executable) - } else { + } + else { $Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime, "publish", $Executable) } } else { diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 731ab4eaeb..060519d30a 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -784,7 +784,7 @@ function New-LinuxPackage # Only build packages for PowerShell/PowerShell repository # branches, not pull requests - $packages = @(Start-PSPackage @packageParams -SkipReleaseChecks -Type deb, rpm, tar) + $packages = @(Start-PSPackage @packageParams -SkipReleaseChecks -Type deb, rpm, rpm-fxdependent-arm64, tar) foreach($package in $packages) { if (Test-Path $package) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index e3ef1e0ed4..cdb42ecccb 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -50,7 +50,7 @@ function Start-PSPackage { [string]$Name = "powershell", # Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported - [ValidateSet("msix", "deb", "osxpkg", "rpm", "rpm-fxdependent", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size")] + [ValidateSet("msix", "deb", "osxpkg", "rpm", "rpm-fxdependent", "rpm-fxdependent-arm64", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size")] [string[]]$Type, # Generate windows downlevel package @@ -111,7 +111,10 @@ function Start-PSPackage { } } elseif ($Type.Count -eq 1 -and $Type[0] -eq "rpm-fxdependent") { New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-x64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } - } else { + } elseif ($Type.Count -eq 1 -and $Type[0] -eq "rpm-fxdependent-arm64") { + New-PSOptions -Configuration "Release" -Runtime 'fxdependent-linux-arm64' -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } + } + else { New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } @@ -592,6 +595,7 @@ function Start-PSPackage { Force = $Force NoSudo = $NoSudo LTS = $LTS + HostArchitecture = "amd64" } foreach ($Distro in $Script:DebianDistributions) { $Arguments["Distribution"] = $Distro @@ -609,6 +613,7 @@ function Start-PSPackage { Force = $Force NoSudo = $NoSudo LTS = $LTS + HostArchitecture = "x86_64" } foreach ($Distro in $Script:RedhatFullDistributions) { $Arguments["Distribution"] = $Distro @@ -627,6 +632,7 @@ function Start-PSPackage { Force = $Force NoSudo = $NoSudo LTS = $LTS + HostArchitecture = "x86_64" } foreach ($Distro in $Script:RedhatFddDistributions) { $Arguments["Distribution"] = $Distro @@ -636,6 +642,26 @@ function Start-PSPackage { } } } + 'rpm-fxdependent-arm64' { + $Arguments = @{ + Type = 'rpm' + PackageSourcePath = $Source + Name = $Name + Version = $Version + Force = $Force + NoSudo = $NoSudo + LTS = $LTS + HostArchitecture = "aarch64" + } + foreach ($Distro in $Script:RedhatFddDistributions) { + $Arguments["Distribution"] = $Distro + $Arguments["HostArchitecture"] = $HostArchitecture + if ($PSCmdlet.ShouldProcess("Create RPM Package for $Distro")) { + Write-Verbose -Verbose "Creating RPM Package for $Distro" + New-UnixPackage @Arguments + } + } + } 'osxpkg' { $HostArchitecture = "x86_64" if ($MacOSRuntime -match "-arm64") { @@ -668,6 +694,7 @@ function Start-PSPackage { Force = $Force NoSudo = $NoSudo LTS = $LTS + HostArchitecture = "all" } if ($PSCmdlet.ShouldProcess("Create $_ Package")) { @@ -926,6 +953,10 @@ function New-UnixPackage { # This is a string because strings are appended to it [string]$Iteration = "1", + [string] + [ValidateSet("x86_64", "amd64", "aarch64", "native", "all", "noarch", "any")] + $HostArchitecture, + [Switch] $Force, @@ -955,9 +986,9 @@ function New-UnixPackage { $Attributes = New-Object "System.Collections.ObjectModel.Collection``1[System.Attribute]" $Attributes.Add($ParameterAttr) > $null $Attributes.Add($ValidateSetAttr) > $null - - $Parameter = New-Object "System.Management.Automation.RuntimeDefinedParameter" -ArgumentList ("Distribution", [string], $Attributes) $Dict = New-Object "System.Management.Automation.RuntimeDefinedParameterDictionary" + $Parameter = New-Object "System.Management.Automation.RuntimeDefinedParameter" -ArgumentList ("Distribution", [string], $Attributes) + $Dict.Add("Distribution", $Parameter) > $null return $Dict } elseif ($Type -eq "osxpkg") { @@ -1072,6 +1103,7 @@ function New-UnixPackage { # Destination for symlink to powershell executable $Link = Get-PwshExecutablePath -IsPreview:$IsPreview + $links = @(New-LinkInfo -LinkDestination $Link -LinkTarget "$Destination/pwsh") if($LTS) { @@ -1131,7 +1163,10 @@ function New-UnixPackage { # Setup package dependencies $Dependencies = @(Get-PackageDependencies @packageDependenciesParams) - $Arguments = Get-FpmArguments ` + $Arguments = @() + + + $Arguments += Get-FpmArguments ` -Name $Name ` -Version $packageVersion ` -Iteration $Iteration ` @@ -1147,6 +1182,7 @@ function New-UnixPackage { -LinkInfo $Links ` -AppsFolder $AppsFolder ` -Distribution $DebDistro ` + -HostArchitecture $HostArchitecture ` -ErrorAction Stop # Build package @@ -1398,7 +1434,8 @@ function Get-FpmArguments return $true })] [String]$AppsFolder, - [String]$Distribution = 'rhel.7' + [String]$Distribution = 'rhel.7', + [string]$HostArchitecture ) $Arguments = @( @@ -1410,6 +1447,7 @@ function Get-FpmArguments "--vendor", "Microsoft Corporation", "--url", "https://microsoft.com/powershell", "--description", $Description, + "--architecture", $HostArchitecture, "--category", "shells", "-t", $Type, "-s", "dir"