# Maintainer: Antoine Martin (ayakael) # Contributor: Antoine Martin (ayakael) pkgname=powershell pkgver=7.2.5 pkgrel=1 pkgdesc="A cross-platform automation and configuration tool/framework" arch="x86_64" # arm / arm64 seem to require crosscompilation url="https://github.com/PowerShell/PowerShell" license="MIT" makedepends=" cmake dotnet6-sdk git icu-dev lttng-ust-dev openssl-dev>3 zlib-dev " source=" $pkgname-$pkgver.tar.gz::https://github.com/PowerShell/PowerShell/archive/refs/tags/v$pkgver.tar.gz disable-test-mode.patch Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets " builddir="$srcdir"/PowerShell-$pkgver options="!check" # fail on builders case $CARCH in x86_64) _dotnet_arch=x64;; aarch64) _dotnet_arch=arm64;; armv7|armhf) _dotnet_arch=arm;; esac prepare() { default_prepare # build expects to be in git directory git init git add * git commit -m 'Initial' git tag -a "v$pkgver" -m "Initial" rm "global.json" } build() { ## Restore dotnet restore src/powershell-unix dotnet restore src/ResGen dotnet restore src/TypeCatalogGen ## Setup the build target to gather dependency information cp "$srcdir/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets" "src/Microsoft.PowerShell.SDK/obj/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets" dotnet msbuild src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$(pwd)/src/TypeCatalogGen/powershell.inc" /nologo ## Generate 'powershell.version' echo "v$pkgver" > powershell.version ## Generate resource binding C# files cd "$builddir"/src/ResGen dotnet run ## Generate 'CorePsTypeCatalog.cs' cd "$builddir"/src/TypeCatalogGen dotnet run ../System.Management.Automation/CoreCLR/CorePsTypeCatalog.cs powershell.inc ## Build powershell core cd "$builddir" dotnet publish --configuration Linux "src/powershell-unix/" --output bin --no-self-contained --arch $_dotnet_arch } check() { cd "$builddir"/test/xUnit dotnet test -c Release } package() { # directory creation install -dm 755 \ "$pkgdir"/usr/lib/$pkgname \ "$pkgdir"/usr/bin # libary copy cp -ar "$builddir"/src/powershell-unix/bin/Linux/net6.0/linux-musl-$_dotnet_arch/* "$pkgdir"/usr/lib/$pkgname/ # clean-up non musl files rm "$pkgdir"/usr/lib/$pkgname/libSystem.IO.Ports.Native.so # binary link ln -s "/usr/lib/$pkgname/pwsh" "$pkgdir"/usr/bin/pwsh } sha512sums=" c40a059e12e1c37a9d21f72b30f7006a31db46943003776723450335fbe4864153eb427ed7b644dce3936113a0c0095569767d38172f4dc1e8a1da8b9f90e1ac powershell-7.2.5.tar.gz 14f1d5be6c390a216012a5ef48886ed398804443731836bb4dc1eb5af26f733144a2d627e5ea109a39fb02a9557003064e14dffb150c1e4752dc8b95f8d4325a disable-test-mode.patch e9c4aeebd4fead1542b2c48c70134efcdb6c573273d8d05b1f8a2ece070e26899876b30264749992beac3044059716ca8c07b3bf970a419e525057c422f843c6 Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets "