powershell: add aarch64 support for Linux

This commit is contained in:
Adrian Lucrèce Céleste 2021-06-06 16:45:12 -04:00 committed by Jonathan Ringer
parent 2e3e591211
commit 3cbcbfc4fc
1 changed files with 9 additions and 5 deletions

View File

@ -1,11 +1,15 @@
{ stdenv, lib, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl
, darwin, makeWrapper, less, openssl_1_1, pam, lttng-ust }:
let platformString = if stdenv.isDarwin then "osx"
let archString = if stdenv.isAarch64 then "arm64"
else if stdenv.isx86_64 then "x64"
else throw "unsupported platform";
platformString = if stdenv.isDarwin then "osx"
else if stdenv.isLinux then "linux"
else throw "unsupported platform";
platformSha = if stdenv.isDarwin then "0w44ws8b6zfixf7xz93hmplqsx18279n9x8j77y4rbzs13fldvsn"
else if stdenv.isLinux then "0xm7l49zhkz2fly3d751kjd5cy3ws9zji9i0061lkd06dvkch7jy"
else if (stdenv.isLinux && stdenv.isx86_64) then "0xm7l49zhkz2fly3d751kjd5cy3ws9zji9i0061lkd06dvkch7jy"
else if (stdenv.isLinux && stdenv.isAarch64) then "1axbi4kmb1ydys7c45jhp729w1srid3c8jgivb4bdmdp56rf6h32"
else throw "unsupported platform";
platformLdLibraryPath = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH"
else if stdenv.isLinux then "LD_LIBRARY_PATH"
@ -18,7 +22,7 @@ stdenv.mkDerivation rec {
version = "7.1.3";
src = fetchzip {
url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-x64.tar.gz";
url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-${archString}.tar.gz";
sha256 = platformSha;
stripRoot = false;
};
@ -42,7 +46,7 @@ stdenv.mkDerivation rec {
chmod a+x $pslibs/pwsh
ls $pslibs
'' + lib.optionalString (!stdenv.isDarwin) ''
'' + lib.optionalString (!stdenv.isDarwin && !stdenv.isAarch64) ''
patchelf --replace-needed libcrypto${ext}.1.0.0 libcrypto${ext}.1.1 $pslibs/libmi.so
patchelf --replace-needed libssl${ext}.1.0.0 libssl${ext}.1.1 $pslibs/libmi.so
'' + ''
@ -66,7 +70,7 @@ stdenv.mkDerivation rec {
description = "Powerful cross-platform (Windows, Linux, and macOS) shell and scripting language based on .NET";
homepage = "https://github.com/PowerShell/PowerShell";
maintainers = with maintainers; [ yrashk srgom ];
platforms = [ "x86_64-darwin" "x86_64-linux" ];
platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-linux"];
license = with licenses; [ mit ];
};