Skip to content

Commit 85329f8

Browse files
CopilotMariusStorhaugCopilot
authored
🩹 [Patch]: Add support for Linux ARM64 architecture (#35)
This pull request adds support for the Linux ARM64 architecture to the PowerShell module, ensuring compatibility with a wider range of Linux systems. The changes include updates to both the build process and runtime module loading logic. **Platform support improvements:** * Added `linux-arm64` to the `$targetRuntimes` array in `PSModule/build.ps1` to ensure the ARM64 runtime is built and included. **Runtime detection and module loading:** * Updated `src/main.ps1` to detect the Linux architecture at runtime using `uname -m`, and conditionally load the appropriate native module (`PSModule.Sodium.dll`) for either ARM64 (`aarch64`) or x64 (`x86_64`). Throws a clear error for unsupported architectures. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com> Co-authored-by: Marius Storhaug <marstor@hotmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 7d1f1b9 commit 85329f8

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

PSModule/build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Remove-Item -Path "$PSScriptRoot/../src/libs" -Recurse -Force -ErrorAction Silen
22

33
$targetRuntimes = @(
44
'linux-x64'
5+
'linux-arm64'
56
'win-x64'
67
'win-x86'
78
'osx-arm64'

src/main.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
switch ($true) {
22
$IsLinux {
3-
Import-Module "$PSScriptRoot/libs/linux-x64/PSModule.Sodium.dll"
4-
$script:Supported = $true
3+
$architecture = (uname -m)
4+
if ($architecture -eq 'aarch64') {
5+
Import-Module "$PSScriptRoot/libs/linux-arm64/PSModule.Sodium.dll"
6+
$script:Supported = $true
7+
} elseif ($architecture -eq 'x86_64') {
8+
Import-Module "$PSScriptRoot/libs/linux-x64/PSModule.Sodium.dll"
9+
$script:Supported = $true
10+
} else {
11+
throw "Unsupported Linux architecture: $architecture. Please refer to the documentation for supported architectures."
12+
}
513
}
614
$IsMacOS {
715
if ("$(sysctl -n machdep.cpu.brand_string)" -Like 'Apple*') {

0 commit comments

Comments
 (0)