From 70fa8cd27e3addde40df682696440dc276d2fdfe Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 24 Aug 2020 13:35:29 -0700 Subject: [PATCH 01/11] Intial commit for alpine arm64 --- src/libpsl-native/alpine.arm64.toolchain.cmake | 17 +++++++++++++++++ tools/releaseBuild/images/Alpine/Dockerfile | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/libpsl-native/alpine.arm64.toolchain.cmake diff --git a/src/libpsl-native/alpine.arm64.toolchain.cmake b/src/libpsl-native/alpine.arm64.toolchain.cmake new file mode 100644 index 0000000..4dd2401 --- /dev/null +++ b/src/libpsl-native/alpine.arm64.toolchain.cmake @@ -0,0 +1,17 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR armv8) +set(CMAKE_CXX_COMPILER g++ -fstack-protector-strong -fpie -DFORTIFY_SOURCE=2 -O2) +set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now") +set(CMAKE_C_COMPILER gcc) + +add_compile_options(-g) + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/tools/releaseBuild/images/Alpine/Dockerfile b/tools/releaseBuild/images/Alpine/Dockerfile index 64279c1..80d84fd 100644 --- a/tools/releaseBuild/images/Alpine/Dockerfile +++ b/tools/releaseBuild/images/Alpine/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/powershell:6.1.0-alpine-3.8 +FROM mcr.microsoft.com/powershell:lts-alpine-3.10 RUN apk update \ && apk add build-base gcc abuild binutils git python bash cmake From 23eb8fcede352594d3827486895512935d6d097d Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 27 Aug 2021 13:51:08 -0700 Subject: [PATCH 02/11] Update alpine version --- tools/releaseBuild/images/Alpine/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/images/Alpine/Dockerfile b/tools/releaseBuild/images/Alpine/Dockerfile index 80d84fd..09f2987 100644 --- a/tools/releaseBuild/images/Alpine/Dockerfile +++ b/tools/releaseBuild/images/Alpine/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/powershell:lts-alpine-3.10 +FROM mcr.microsoft.com/powershell:alpine-3.12 RUN apk update \ && apk add build-base gcc abuild binutils git python bash cmake From dd0e15ffc865446fc0f9eef1565974a39e31fc18 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 27 Aug 2021 14:52:05 -0700 Subject: [PATCH 03/11] Changes to build alpine arm64 --- build.psm1 | 27 +++++++++++++++++++++--- tools/releaseBuild/PowershellNative.ps1 | 10 +++++++-- tools/releaseBuild/build.json | 12 +++++++++++ tools/releaseBuild/yaml/releaseBuild.yml | 2 ++ 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/build.psm1 b/build.psm1 index 3c759c8..0e4047b 100644 --- a/build.psm1 +++ b/build.psm1 @@ -393,7 +393,8 @@ cmd.exe /C cd /d "$location" "&" "$vcvarsallbatPath" "$Arch" "&" "$cmakePath" "$ function Start-BuildNativeUnixBinaries { param ( [switch] $BuildLinuxArm, - [switch] $BuildLinuxArm64 + [switch] $BuildLinuxArm64, + [switch] $BuildAlpineArm64 ) if (-not $Environment.IsLinux -and -not $Environment.IsMacOS) { @@ -405,6 +406,10 @@ function Start-BuildNativeUnixBinaries { throw "Cross compiling for linux-arm/linux-arm64 are only supported on Ubuntu environment" } + if ($BuildAlpineArm64 -and -not $Environment.IsAlpine) { + throw "Cross compiling for linux-musl-arm64 are only supported on Alpine environment" + } + # Verify we have all tools in place to do the build $precheck = $true foreach ($Dependency in 'cmake', 'make', 'g++') { @@ -464,9 +469,13 @@ function Start-BuildNativeUnixBinaries { } elseif ($IsMacOS) { Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./macos.toolchain.cmake" . } - Start-NativeExecution { make -j } + Start-NativeExecution { make -j } Start-NativeExecution { ctest --verbose } } + elseif ($BuildAlpineArm64) { + Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./alpine.arm64.toolchain.cmake" . } + Start-NativeExecution { make -j } + } else { Start-NativeExecution { cmake -DCMAKE_BUILD_TYPE=Debug . } Start-NativeExecution { make -j } @@ -527,6 +536,10 @@ function Start-BuildPowerShellNativePackage [ValidateScript({Test-Path $_ -PathType Leaf})] [string] $LinuxAlpineZipPath, + [Parameter(Mandatory = $true)] + [ValidateScript({Test-Path $_ -PathType Leaf})] + [string] $LinuxAlpineArm64ZipPath, + [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Leaf})] [string] $macOSZipPath, @@ -558,6 +571,7 @@ function Start-BuildPowerShellNativePackage $BinFolderLinuxARM = Join-Path $tempExtractionPath "LinuxARM" $BinFolderLinuxARM64 = Join-Path $tempExtractionPath "LinuxARM64" $BinFolderLinuxAlpine = Join-Path $tempExtractionPath "LinuxAlpine" + $BinFolderLinuxAlpineArm64 = Join-Path $tempExtractionPath "LinuxAlpineArm64" $BinFolderMacOS = Join-Path $tempExtractionPath "MacOS" $BinFolderPSRP = Join-Path $tempExtractionPath "PSRP" @@ -567,6 +581,7 @@ function Start-BuildPowerShellNativePackage Expand-Archive -Path $WindowsARM64ZipPath -DestinationPath $BinFolderARM64 -Force Expand-Archive -Path $LinuxZipPath -DestinationPath $BinFolderLinux -Force Expand-Archive -Path $LinuxAlpineZipPath -DestinationPath $BinFolderLinuxAlpine -Force + Expand-Archive -Path $LinuxAlpineArm64ZipPath -DestinationPath $BinFolderLinuxAlpineArm64 -Force Expand-Archive -Path $LinuxARMZipPath -DestinationPath $BinFolderLinuxARM -Force Expand-Archive -Path $LinuxARM64ZipPath -DestinationPath $BinFolderLinuxARM64 -Force Expand-Archive -Path $macOSZipPath -DestinationPath $BinFolderMacOS -Force @@ -574,7 +589,7 @@ function Start-BuildPowerShellNativePackage PlaceWindowsNativeBinaries -PackageRoot $PackageRoot -BinFolderX64 $BinFolderX64 -BinFolderX86 $BinFolderX86 -BinFolderARM $BinFolderARM -BinFolderARM64 $BinFolderARM64 - PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine + PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine -BinFolderLinuxAlpineArm64 $BinFolderLinuxAlpineArm64 $Nuspec = @' @@ -652,6 +667,10 @@ function PlaceUnixBinaries [ValidateScript({Test-Path $_ -PathType Container})] $BinFolderLinuxAlpine, + [Parameter(Mandatory = $true)] + [ValidateScript({Test-Path $_ -PathType Container})] + $BinFolderLinuxAlpineArm64, + [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Container})] $BinFolderOSX, @@ -665,12 +684,14 @@ function PlaceUnixBinaries $RuntimePathLinuxARM = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-arm/native') -Force $RuntimePathLinuxARM64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-arm64/native') -Force $RuntimePathLinuxAlpine = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-x64/native') -Force + $RuntimePathLinuxAlpineArm64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm64/native') -Force $RuntimePathOSX = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/osx/native') -Force Copy-Item "$BinFolderLinux\*" -Destination $RuntimePathLinux -Verbose Copy-Item "$BinFolderLinuxARM\*" -Destination $RuntimePathLinuxARM -Verbose Copy-Item "$BinFolderLinuxARM64\*" -Destination $RuntimePathLinuxARM64 -Verbose Copy-Item "$BinFolderLinuxAlpine\*" -Destination $RuntimePathLinuxAlpine -Verbose + Copy-Item "$BinFolderLinuxAlpineArm64\*" -Destination $RuntimePathLinuxAlpineArm64 -Verbose Copy-Item "$BinFolderOSX\*" -Destination $RuntimePathOSX -Verbose ## LinuxARM is not supported by PSRP diff --git a/tools/releaseBuild/PowershellNative.ps1 b/tools/releaseBuild/PowershellNative.ps1 index 1bb9beb..dc782d8 100644 --- a/tools/releaseBuild/PowershellNative.ps1 +++ b/tools/releaseBuild/PowershellNative.ps1 @@ -6,7 +6,7 @@ param ( [Parameter(Mandatory, ParameterSetName = 'Build')] - [ValidateSet('x64', 'x86', 'x64_arm', 'x64_arm64', 'linux-x64', 'osx', 'linux-arm', 'linux-arm64', 'linux-musl-x64')] + [ValidateSet('x64', 'x86', 'x64_arm', 'x64_arm64', 'linux-x64', 'osx', 'linux-arm', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm64')] [string] $Arch, @@ -61,6 +61,13 @@ end { $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose } + elseif ($Arch -eq 'linux-musl-arm64') { + Start-PSBootstrap -BuildAlpineArm64 + Start-BuildNativeUnixBinaries -BuildLinuxArm64 + + $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" + Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + } else { Write-Verbose "Starting Start-PSBootstrap" -Verbose Start-PSBootstrap -BuildWindowsNative @@ -76,4 +83,3 @@ end { } } } - diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index 8188770..cb96f5f 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -121,6 +121,18 @@ "DockerImageName": "ps-alpine", "BinaryBucket": "release", "EnableFeature": [ "ArtifactAsFolder" ] + }, + { + "Name": "alpine-arm64", + "RepoDestinationPath": "/PowerShellNative", + "BuildCommand": "/PowerShellNative/tools/releaseBuild/PowershellNative.ps1 -RepoRoot _RepoDestinationPath_ -TargetLocation _DockerVolume_ -Arch linux-musl-arm64 -Configuration Release", + "AdditionalContextFiles": [ + "./tools/releaseBuild/PowershellNative.ps1" + ], + "DockerFile": "./tools/releaseBuild/images/Alpine/Dockerfile", + "DockerImageName": "ps-alpine-arm64", + "BinaryBucket": "release", + "EnableFeature": [ "ArtifactAsFolder" ] } ] } diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index fa6eeed..0cec150 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -68,6 +68,8 @@ stages: LINUX_BUILDNAME: 'alpine' UbuntuArm64: LINUX_BUILDNAME: 'ubuntu.16.04-arm64' + AlpineArm64: + LINUX_BUILDNAME: 'alpine-arm64' steps: - template: linux.yml From 48a765148e34c4021ddb5199fd8ba1719bf4af8c Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 27 Aug 2021 14:54:37 -0700 Subject: [PATCH 04/11] Update python --- tools/releaseBuild/images/Alpine/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/images/Alpine/Dockerfile b/tools/releaseBuild/images/Alpine/Dockerfile index 09f2987..c1e6db1 100644 --- a/tools/releaseBuild/images/Alpine/Dockerfile +++ b/tools/releaseBuild/images/Alpine/Dockerfile @@ -1,6 +1,6 @@ FROM mcr.microsoft.com/powershell:alpine-3.12 RUN apk update \ - && apk add build-base gcc abuild binutils git python bash cmake + && apk add build-base gcc abuild binutils git python3 bash cmake ENTRYPOINT [ "pwsh" ] From b0ea41a58ea597cbe64acee612a8964f6066e658 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 27 Aug 2021 15:03:54 -0700 Subject: [PATCH 05/11] Fix build switch --- tools/releaseBuild/PowershellNative.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/releaseBuild/PowershellNative.ps1 b/tools/releaseBuild/PowershellNative.ps1 index dc782d8..bb36e59 100644 --- a/tools/releaseBuild/PowershellNative.ps1 +++ b/tools/releaseBuild/PowershellNative.ps1 @@ -62,8 +62,8 @@ end { Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose } elseif ($Arch -eq 'linux-musl-arm64') { - Start-PSBootstrap -BuildAlpineArm64 - Start-BuildNativeUnixBinaries -BuildLinuxArm64 + Start-PSBootstrap + Start-BuildNativeUnixBinaries -BuildAlpineArm64 $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose From 3fa20e9b1b99d9e8e724de869596f08d1843b2e7 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 27 Aug 2021 15:06:40 -0700 Subject: [PATCH 06/11] Fix build dependency list --- build.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 0e4047b..ffdc1f4 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2086,7 +2086,7 @@ function Start-PSBootstrap { # Install patched version of curl Start-NativeExecution { brew install curl --with-openssl --with-gssapi } -IgnoreExitcode } elseif ($Environment.IsAlpine) { - $Deps += "build-base", "gcc", "abuild", "binutils", "git", "python", "bash", "cmake" + $Deps += "build-base", "gcc", "abuild", "binutils", "git", "python3", "bash", "cmake" # Install dependencies Start-NativeExecution { apk update } From 32bca8ee92bc9efa803fd6ae9704208047c50f7b Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 30 Aug 2021 09:48:30 -0700 Subject: [PATCH 07/11] Add missing parameter --- tools/releaseBuild/yaml/nuget.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/releaseBuild/yaml/nuget.yml b/tools/releaseBuild/yaml/nuget.yml index 2e011ad..dc27391 100644 --- a/tools/releaseBuild/yaml/nuget.yml +++ b/tools/releaseBuild/yaml/nuget.yml @@ -79,10 +79,11 @@ steps: $LinuxARMZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm-symbols.zip' $LinuxARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm64-symbols.zip' $LinuxAlpineZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-x64-symbols.zip' + $LinuxAlpineArm64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm64-symbols.zip' $macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip' $psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip' - Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath) + Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -LinuxAlpineArm64ZipPath $LinuxAlpineArm64ZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath) displayName: 'Build NuGet package' From 0473248e7f1c6bdd697af22596139d73077225b4 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 1 Sep 2021 15:50:14 -0700 Subject: [PATCH 08/11] Fix typo --- build.psm1 | 24 ++++++++++++++++---- src/libpsl-native/alpine.arm.toolchain.cmake | 17 ++++++++++++++ tools/releaseBuild/PowershellNative.ps1 | 9 +++++++- tools/releaseBuild/build.json | 12 ++++++++++ tools/releaseBuild/yaml/nuget.yml | 3 ++- tools/releaseBuild/yaml/releaseBuild.yml | 2 ++ 6 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 src/libpsl-native/alpine.arm.toolchain.cmake diff --git a/build.psm1 b/build.psm1 index ffdc1f4..864401b 100644 --- a/build.psm1 +++ b/build.psm1 @@ -394,7 +394,8 @@ function Start-BuildNativeUnixBinaries { param ( [switch] $BuildLinuxArm, [switch] $BuildLinuxArm64, - [switch] $BuildAlpineArm64 + [switch] $BuildAlpineArm64, + [switch] $BuildAlpineArm ) if (-not $Environment.IsLinux -and -not $Environment.IsMacOS) { @@ -406,8 +407,8 @@ function Start-BuildNativeUnixBinaries { throw "Cross compiling for linux-arm/linux-arm64 are only supported on Ubuntu environment" } - if ($BuildAlpineArm64 -and -not $Environment.IsAlpine) { - throw "Cross compiling for linux-musl-arm64 are only supported on Alpine environment" + if ($BuildAlpineArm64 -or $BuildAlpineArm -and -not $Environment.IsAlpine) { + throw "Cross compiling for linux-musl-arm linux-musl-arm64 are only supported on Alpine environment" } # Verify we have all tools in place to do the build @@ -476,6 +477,10 @@ function Start-BuildNativeUnixBinaries { Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./alpine.arm64.toolchain.cmake" . } Start-NativeExecution { make -j } } + elseif ($BuildAlpineArm) { + Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./alpine.arm.toolchain.cmake" . } + Start-NativeExecution { make -j } + } else { Start-NativeExecution { cmake -DCMAKE_BUILD_TYPE=Debug . } Start-NativeExecution { make -j } @@ -536,6 +541,10 @@ function Start-BuildPowerShellNativePackage [ValidateScript({Test-Path $_ -PathType Leaf})] [string] $LinuxAlpineZipPath, + [Parameter(Mandatory = $true)] + [ValidateScript({Test-Path $_ -PathType Leaf})] + [string] $LinuxAlpineArmZipPath, + [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Leaf})] [string] $LinuxAlpineArm64ZipPath, @@ -581,6 +590,7 @@ function Start-BuildPowerShellNativePackage Expand-Archive -Path $WindowsARM64ZipPath -DestinationPath $BinFolderARM64 -Force Expand-Archive -Path $LinuxZipPath -DestinationPath $BinFolderLinux -Force Expand-Archive -Path $LinuxAlpineZipPath -DestinationPath $BinFolderLinuxAlpine -Force + Expand-Archive -Path $LinuxAlpineArmZipPath -DestinationPath $BinFolderLinuxAlpineArm -Force Expand-Archive -Path $LinuxAlpineArm64ZipPath -DestinationPath $BinFolderLinuxAlpineArm64 -Force Expand-Archive -Path $LinuxARMZipPath -DestinationPath $BinFolderLinuxARM -Force Expand-Archive -Path $LinuxARM64ZipPath -DestinationPath $BinFolderLinuxARM64 -Force @@ -589,7 +599,7 @@ function Start-BuildPowerShellNativePackage PlaceWindowsNativeBinaries -PackageRoot $PackageRoot -BinFolderX64 $BinFolderX64 -BinFolderX86 $BinFolderX86 -BinFolderARM $BinFolderARM -BinFolderARM64 $BinFolderARM64 - PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine -BinFolderLinuxAlpineArm64 $BinFolderLinuxAlpineArm64 + PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine -BinFolderLinuxAlpineArm64 $BinFolderLinuxAlpineArm64 -BinFolderLinuxAlpineArm $BinFolderLinuxAlpineArm $Nuspec = @' @@ -667,6 +677,10 @@ function PlaceUnixBinaries [ValidateScript({Test-Path $_ -PathType Container})] $BinFolderLinuxAlpine, + [Parameter(Mandatory = $true)] + [ValidateScript({Test-Path $_ -PathType Container})] + $BinFolderLinuxAlpineArm, + [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Container})] $BinFolderLinuxAlpineArm64, @@ -684,6 +698,7 @@ function PlaceUnixBinaries $RuntimePathLinuxARM = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-arm/native') -Force $RuntimePathLinuxARM64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-arm64/native') -Force $RuntimePathLinuxAlpine = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-x64/native') -Force + $RuntimePathLinuxAlpineArm = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm/native') -Force $RuntimePathLinuxAlpineArm64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm64/native') -Force $RuntimePathOSX = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/osx/native') -Force @@ -691,6 +706,7 @@ function PlaceUnixBinaries Copy-Item "$BinFolderLinuxARM\*" -Destination $RuntimePathLinuxARM -Verbose Copy-Item "$BinFolderLinuxARM64\*" -Destination $RuntimePathLinuxARM64 -Verbose Copy-Item "$BinFolderLinuxAlpine\*" -Destination $RuntimePathLinuxAlpine -Verbose + Copy-Item "$BinFolderLinuxAlpineArm\*" -Destination $RuntimePathLinuxAlpineArm -Verbose Copy-Item "$BinFolderLinuxAlpineArm64\*" -Destination $RuntimePathLinuxAlpineArm64 -Verbose Copy-Item "$BinFolderOSX\*" -Destination $RuntimePathOSX -Verbose diff --git a/src/libpsl-native/alpine.arm.toolchain.cmake b/src/libpsl-native/alpine.arm.toolchain.cmake new file mode 100644 index 0000000..9964b25 --- /dev/null +++ b/src/libpsl-native/alpine.arm.toolchain.cmake @@ -0,0 +1,17 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR armv71) +set(CMAKE_CXX_COMPILER g++ -fstack-protector-strong -fpie -DFORTIFY_SOURCE=2 -O2) +set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now") +set(CMAKE_C_COMPILER gcc) + +add_compile_options(-g) + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/tools/releaseBuild/PowershellNative.ps1 b/tools/releaseBuild/PowershellNative.ps1 index bb36e59..3cbe08f 100644 --- a/tools/releaseBuild/PowershellNative.ps1 +++ b/tools/releaseBuild/PowershellNative.ps1 @@ -6,7 +6,7 @@ param ( [Parameter(Mandatory, ParameterSetName = 'Build')] - [ValidateSet('x64', 'x86', 'x64_arm', 'x64_arm64', 'linux-x64', 'osx', 'linux-arm', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm64')] + [ValidateSet('x64', 'x86', 'x64_arm', 'x64_arm64', 'linux-x64', 'osx', 'linux-arm', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm64', 'linux-musl-arm')] [string] $Arch, @@ -68,6 +68,13 @@ end { $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose } + elseif ($Arch -eq 'linux-musl-arm') { + Start-PSBootstrap + Start-BuildNativeUnixBinaries -BuildAlpineArm + + $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" + Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose + } else { Write-Verbose "Starting Start-PSBootstrap" -Verbose Start-PSBootstrap -BuildWindowsNative diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index cb96f5f..e37d339 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -133,6 +133,18 @@ "DockerImageName": "ps-alpine-arm64", "BinaryBucket": "release", "EnableFeature": [ "ArtifactAsFolder" ] + }, + { + "Name": "alpine-arm", + "RepoDestinationPath": "/PowerShellNative", + "BuildCommand": "/PowerShellNative/tools/releaseBuild/PowershellNative.ps1 -RepoRoot _RepoDestinationPath_ -TargetLocation _DockerVolume_ -Arch linux-musl-arm -Configuration Release", + "AdditionalContextFiles": [ + "./tools/releaseBuild/PowershellNative.ps1" + ], + "DockerFile": "./tools/releaseBuild/images/Alpine/Dockerfile", + "DockerImageName": "ps-alpine-arm", + "BinaryBucket": "release", + "EnableFeature": [ "ArtifactAsFolder" ] } ] } diff --git a/tools/releaseBuild/yaml/nuget.yml b/tools/releaseBuild/yaml/nuget.yml index dc27391..8e7c4f3 100644 --- a/tools/releaseBuild/yaml/nuget.yml +++ b/tools/releaseBuild/yaml/nuget.yml @@ -79,11 +79,12 @@ steps: $LinuxARMZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm-symbols.zip' $LinuxARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm64-symbols.zip' $LinuxAlpineZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-x64-symbols.zip' + $LinuxAlpineArmZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm-symbols.zip' $LinuxAlpineArm64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm64-symbols.zip' $macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip' $psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip' - Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -LinuxAlpineArm64ZipPath $LinuxAlpineArm64ZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath) + Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -LinuxAlpineArm64ZipPath $LinuxAlpineArm64ZipPath -LinuxAlpineArmZipPath $LinuxAlpineArmZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath) displayName: 'Build NuGet package' diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index 0cec150..fe0e5ed 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -70,6 +70,8 @@ stages: LINUX_BUILDNAME: 'ubuntu.16.04-arm64' AlpineArm64: LINUX_BUILDNAME: 'alpine-arm64' + AlpineArm64: + LINUX_BUILDNAME: 'alpine-arm' steps: - template: linux.yml From e514d8da9bb4451e2b161f8a42555d83b85931bc Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 7 Sep 2021 12:12:33 -0700 Subject: [PATCH 09/11] Apply suggestions from code review Co-authored-by: Andrew Schwartzmeyer --- build.psm1 | 41 ++++++++++--------- src/libpsl-native/alpine.arm.toolchain.cmake | 2 +- .../alpine.arm64.toolchain.cmake | 2 +- tools/releaseBuild/PowershellNative.ps1 | 10 ++--- tools/releaseBuild/build.json | 12 +++--- tools/releaseBuild/yaml/nuget.yml | 6 +-- tools/releaseBuild/yaml/releaseBuild.yml | 4 +- 7 files changed, 39 insertions(+), 38 deletions(-) diff --git a/build.psm1 b/build.psm1 index 864401b..8f6df08 100644 --- a/build.psm1 +++ b/build.psm1 @@ -394,8 +394,8 @@ function Start-BuildNativeUnixBinaries { param ( [switch] $BuildLinuxArm, [switch] $BuildLinuxArm64, - [switch] $BuildAlpineArm64, - [switch] $BuildAlpineArm + [switch] $BuildAlpineArm, + [switch] $BuildAlpineArm64 ) if (-not $Environment.IsLinux -and -not $Environment.IsMacOS) { @@ -407,8 +407,8 @@ function Start-BuildNativeUnixBinaries { throw "Cross compiling for linux-arm/linux-arm64 are only supported on Ubuntu environment" } - if ($BuildAlpineArm64 -or $BuildAlpineArm -and -not $Environment.IsAlpine) { - throw "Cross compiling for linux-musl-arm linux-musl-arm64 are only supported on Alpine environment" + if (($BuildAlpineArm64 -or $BuildAlpineArm) -and -not $Environment.IsAlpine) { + throw "Cross compiling for linux-musl-arm/linux-musl-arm64 are only supported on Alpine environment" } # Verify we have all tools in place to do the build @@ -473,14 +473,14 @@ function Start-BuildNativeUnixBinaries { Start-NativeExecution { make -j } Start-NativeExecution { ctest --verbose } } - elseif ($BuildAlpineArm64) { - Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./alpine.arm64.toolchain.cmake" . } - Start-NativeExecution { make -j } - } elseif ($BuildAlpineArm) { Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./alpine.arm.toolchain.cmake" . } Start-NativeExecution { make -j } } + elseif ($BuildAlpineArm64) { + Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./alpine.arm64.toolchain.cmake" . } + Start-NativeExecution { make -j } + } else { Start-NativeExecution { cmake -DCMAKE_BUILD_TYPE=Debug . } Start-NativeExecution { make -j } @@ -543,11 +543,11 @@ function Start-BuildPowerShellNativePackage [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Leaf})] - [string] $LinuxAlpineArmZipPath, + [string] $LinuxAlpineARMZipPath, [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Leaf})] - [string] $LinuxAlpineArm64ZipPath, + [string] $LinuxAlpineARM64ZipPath, [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Leaf})] @@ -580,7 +580,8 @@ function Start-BuildPowerShellNativePackage $BinFolderLinuxARM = Join-Path $tempExtractionPath "LinuxARM" $BinFolderLinuxARM64 = Join-Path $tempExtractionPath "LinuxARM64" $BinFolderLinuxAlpine = Join-Path $tempExtractionPath "LinuxAlpine" - $BinFolderLinuxAlpineArm64 = Join-Path $tempExtractionPath "LinuxAlpineArm64" + $BinFolderLinuxAlpineARM = Join-Path $tempExtractionPath "LinuxAlpineARM" + $BinFolderLinuxAlpineARM64 = Join-Path $tempExtractionPath "LinuxAlpineARM64" $BinFolderMacOS = Join-Path $tempExtractionPath "MacOS" $BinFolderPSRP = Join-Path $tempExtractionPath "PSRP" @@ -590,8 +591,8 @@ function Start-BuildPowerShellNativePackage Expand-Archive -Path $WindowsARM64ZipPath -DestinationPath $BinFolderARM64 -Force Expand-Archive -Path $LinuxZipPath -DestinationPath $BinFolderLinux -Force Expand-Archive -Path $LinuxAlpineZipPath -DestinationPath $BinFolderLinuxAlpine -Force - Expand-Archive -Path $LinuxAlpineArmZipPath -DestinationPath $BinFolderLinuxAlpineArm -Force - Expand-Archive -Path $LinuxAlpineArm64ZipPath -DestinationPath $BinFolderLinuxAlpineArm64 -Force + Expand-Archive -Path $LinuxAlpineARMZipPath -DestinationPath $BinFolderLinuxAlpineARM -Force + Expand-Archive -Path $LinuxAlpineARM64ZipPath -DestinationPath $BinFolderLinuxAlpineARM64 -Force Expand-Archive -Path $LinuxARMZipPath -DestinationPath $BinFolderLinuxARM -Force Expand-Archive -Path $LinuxARM64ZipPath -DestinationPath $BinFolderLinuxARM64 -Force Expand-Archive -Path $macOSZipPath -DestinationPath $BinFolderMacOS -Force @@ -599,7 +600,7 @@ function Start-BuildPowerShellNativePackage PlaceWindowsNativeBinaries -PackageRoot $PackageRoot -BinFolderX64 $BinFolderX64 -BinFolderX86 $BinFolderX86 -BinFolderARM $BinFolderARM -BinFolderARM64 $BinFolderARM64 - PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine -BinFolderLinuxAlpineArm64 $BinFolderLinuxAlpineArm64 -BinFolderLinuxAlpineArm $BinFolderLinuxAlpineArm + PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine -BinFolderLinuxAlpineARM $BinFolderLinuxAlpineARM -BinFolderLinuxAlpineARM64 $BinFolderLinuxAlpineARM64 $Nuspec = @' @@ -679,11 +680,11 @@ function PlaceUnixBinaries [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Container})] - $BinFolderLinuxAlpineArm, + $BinFolderLinuxAlpineARM, [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Container})] - $BinFolderLinuxAlpineArm64, + $BinFolderLinuxAlpineARM64, [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Container})] @@ -698,16 +699,16 @@ function PlaceUnixBinaries $RuntimePathLinuxARM = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-arm/native') -Force $RuntimePathLinuxARM64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-arm64/native') -Force $RuntimePathLinuxAlpine = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-x64/native') -Force - $RuntimePathLinuxAlpineArm = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm/native') -Force - $RuntimePathLinuxAlpineArm64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm64/native') -Force + $RuntimePathLinuxAlpineARM = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm/native') -Force + $RuntimePathLinuxAlpineARM64 = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-musl-arm64/native') -Force $RuntimePathOSX = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/osx/native') -Force Copy-Item "$BinFolderLinux\*" -Destination $RuntimePathLinux -Verbose Copy-Item "$BinFolderLinuxARM\*" -Destination $RuntimePathLinuxARM -Verbose Copy-Item "$BinFolderLinuxARM64\*" -Destination $RuntimePathLinuxARM64 -Verbose Copy-Item "$BinFolderLinuxAlpine\*" -Destination $RuntimePathLinuxAlpine -Verbose - Copy-Item "$BinFolderLinuxAlpineArm\*" -Destination $RuntimePathLinuxAlpineArm -Verbose - Copy-Item "$BinFolderLinuxAlpineArm64\*" -Destination $RuntimePathLinuxAlpineArm64 -Verbose + Copy-Item "$BinFolderLinuxAlpineARM\*" -Destination $RuntimePathLinuxAlpineARM -Verbose + Copy-Item "$BinFolderLinuxAlpineARM64\*" -Destination $RuntimePathLinuxAlpineARM64 -Verbose Copy-Item "$BinFolderOSX\*" -Destination $RuntimePathOSX -Verbose ## LinuxARM is not supported by PSRP diff --git a/src/libpsl-native/alpine.arm.toolchain.cmake b/src/libpsl-native/alpine.arm.toolchain.cmake index 9964b25..81bdacd 100644 --- a/src/libpsl-native/alpine.arm.toolchain.cmake +++ b/src/libpsl-native/alpine.arm.toolchain.cmake @@ -7,7 +7,7 @@ set(CMAKE_C_COMPILER gcc) add_compile_options(-g) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) diff --git a/src/libpsl-native/alpine.arm64.toolchain.cmake b/src/libpsl-native/alpine.arm64.toolchain.cmake index 4dd2401..029a24a 100644 --- a/src/libpsl-native/alpine.arm64.toolchain.cmake +++ b/src/libpsl-native/alpine.arm64.toolchain.cmake @@ -7,7 +7,7 @@ set(CMAKE_C_COMPILER gcc) add_compile_options(-g) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) diff --git a/tools/releaseBuild/PowershellNative.ps1 b/tools/releaseBuild/PowershellNative.ps1 index 3cbe08f..38e0864 100644 --- a/tools/releaseBuild/PowershellNative.ps1 +++ b/tools/releaseBuild/PowershellNative.ps1 @@ -6,7 +6,7 @@ param ( [Parameter(Mandatory, ParameterSetName = 'Build')] - [ValidateSet('x64', 'x86', 'x64_arm', 'x64_arm64', 'linux-x64', 'osx', 'linux-arm', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm64', 'linux-musl-arm')] + [ValidateSet('x64', 'x86', 'x64_arm', 'x64_arm64', 'linux-x64', 'osx', 'linux-arm', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm', 'linux-musl-arm64')] [string] $Arch, @@ -61,16 +61,16 @@ end { $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose } - elseif ($Arch -eq 'linux-musl-arm64') { + elseif ($Arch -eq 'linux-musl-arm') { Start-PSBootstrap - Start-BuildNativeUnixBinaries -BuildAlpineArm64 + Start-BuildNativeUnixBinaries -BuildAlpineArm $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose } - elseif ($Arch -eq 'linux-musl-arm') { + elseif ($Arch -eq 'linux-musl-arm64') { Start-PSBootstrap - Start-BuildNativeUnixBinaries -BuildAlpineArm + Start-BuildNativeUnixBinaries -BuildAlpineArm64 $buildOutputPath = Join-Path $RepoRoot "src/powershell-unix" Compress-Archive -Path $buildOutputPath/libpsl-native.* -DestinationPath "$TargetLocation/$Arch-symbols.zip" -Verbose diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index e37d339..6c57122 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -123,26 +123,26 @@ "EnableFeature": [ "ArtifactAsFolder" ] }, { - "Name": "alpine-arm64", + "Name": "alpine-arm", "RepoDestinationPath": "/PowerShellNative", - "BuildCommand": "/PowerShellNative/tools/releaseBuild/PowershellNative.ps1 -RepoRoot _RepoDestinationPath_ -TargetLocation _DockerVolume_ -Arch linux-musl-arm64 -Configuration Release", + "BuildCommand": "/PowerShellNative/tools/releaseBuild/PowershellNative.ps1 -RepoRoot _RepoDestinationPath_ -TargetLocation _DockerVolume_ -Arch linux-musl-arm -Configuration Release", "AdditionalContextFiles": [ "./tools/releaseBuild/PowershellNative.ps1" ], "DockerFile": "./tools/releaseBuild/images/Alpine/Dockerfile", - "DockerImageName": "ps-alpine-arm64", + "DockerImageName": "ps-alpine-arm", "BinaryBucket": "release", "EnableFeature": [ "ArtifactAsFolder" ] }, { - "Name": "alpine-arm", + "Name": "alpine-arm64", "RepoDestinationPath": "/PowerShellNative", - "BuildCommand": "/PowerShellNative/tools/releaseBuild/PowershellNative.ps1 -RepoRoot _RepoDestinationPath_ -TargetLocation _DockerVolume_ -Arch linux-musl-arm -Configuration Release", + "BuildCommand": "/PowerShellNative/tools/releaseBuild/PowershellNative.ps1 -RepoRoot _RepoDestinationPath_ -TargetLocation _DockerVolume_ -Arch linux-musl-arm64 -Configuration Release", "AdditionalContextFiles": [ "./tools/releaseBuild/PowershellNative.ps1" ], "DockerFile": "./tools/releaseBuild/images/Alpine/Dockerfile", - "DockerImageName": "ps-alpine-arm", + "DockerImageName": "ps-alpine-arm64", "BinaryBucket": "release", "EnableFeature": [ "ArtifactAsFolder" ] } diff --git a/tools/releaseBuild/yaml/nuget.yml b/tools/releaseBuild/yaml/nuget.yml index 8e7c4f3..26b867c 100644 --- a/tools/releaseBuild/yaml/nuget.yml +++ b/tools/releaseBuild/yaml/nuget.yml @@ -79,12 +79,12 @@ steps: $LinuxARMZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm-symbols.zip' $LinuxARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm64-symbols.zip' $LinuxAlpineZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-x64-symbols.zip' - $LinuxAlpineArmZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm-symbols.zip' - $LinuxAlpineArm64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm64-symbols.zip' + $LinuxAlpineARMZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm-symbols.zip' + $LinuxAlpineARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm64-symbols.zip' $macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip' $psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip' - Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -LinuxAlpineArm64ZipPath $LinuxAlpineArm64ZipPath -LinuxAlpineArmZipPath $LinuxAlpineArmZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath) + Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -LinuxAlpineARMZipPath $LinuxAlpineARMZipPath -LinuxAlpineARM64ZipPath $LinuxAlpineARM64ZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath) displayName: 'Build NuGet package' diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index fe0e5ed..aeb9565 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -68,10 +68,10 @@ stages: LINUX_BUILDNAME: 'alpine' UbuntuArm64: LINUX_BUILDNAME: 'ubuntu.16.04-arm64' + AlpineArm: + LINUX_BUILDNAME: 'alpine-arm' AlpineArm64: LINUX_BUILDNAME: 'alpine-arm64' - AlpineArm64: - LINUX_BUILDNAME: 'alpine-arm' steps: - template: linux.yml From 29d1f4b29bfcb8178b945fad791c1cfb92e63b81 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 7 Sep 2021 12:23:54 -0700 Subject: [PATCH 10/11] Add Alpine ARM and Alpine ARM64 to CI and use new YAML tags --- .vsts-ci/linux.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index 886f748..a2d27f6 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -9,12 +9,11 @@ variables: resources: - repo: self clean: true -phases: -- phase: Build - queue: - name: Hosted Ubuntu 1604 - parallel: 2 +jobs: +- job: Build + vmImage: ubuntu-latest + strategy: matrix: Linux ARM Native: buildName: ubuntu.16.04-arm @@ -24,6 +23,10 @@ phases: buildName: centos.7 Linux Alpine: buildName: alpine + Linux Alpine ARM: + buildName: alpine-arm + Linux Alpine ARM64: + buildName: alpine-arm64 steps: - powershell: | From a4fedaedfbf748ab17778a669959f97132a37455 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 7 Sep 2021 12:25:01 -0700 Subject: [PATCH 11/11] Fix yaml --- .vsts-ci/linux.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index a2d27f6..476fe93 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -12,7 +12,8 @@ resources: jobs: - job: Build - vmImage: ubuntu-latest + pool: + vmImage: ubuntu-latest strategy: matrix: Linux ARM Native: