# Maintainer: Antoine Martin (ayakael) # Contributor: Antoine Martin (ayakael) pkgname=powershell pkgver=7.3.4 pkgrel=0 pkgdesc="A cross-platform automation and configuration tool/framework" arch="all !x86 !armhf !riscv64" # blocked by dotnet runtime url="https://github.com/PowerShell/PowerShell" license="MIT" depends=" dotnet7-runtime libpsl-native " makedepends=" dotnet7-sdk git " source=" $pkgname-$pkgver.tar.gz::https://github.com/PowerShell/PowerShell/archive/refs/tags/v$pkgver.tar.gz dependency-gatherer.targets fix-filesystem-test.patch update-sdk-test-ppc64le.patch " builddir="$srcdir"/PowerShell-$pkgver # mono-flavored runtime does not support crossgen2 case $CARCH in armhf|s390x|ppc64le) _use_crossgen2=false;; esac prepare() { default_prepare # build expects to be in git directory git init git config user.name "example" git config user.email "example@example.com" git add ./* git commit -m 'Initial' git tag -a "v$pkgver" -m "Initial" rm "global.json" } build() { msg "Building $pkgname" # change nuget cache export NUGET_PACKAGES="$srcdir"/nuget_cache # Restore dotnet restore src/powershell-unix dotnet restore src/ResGen dotnet restore src/TypeCatalogGen # Setup the build target to gather dependency information cp "$srcdir/dependency-gatherer.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 \ --runtime "$(dotnet --info | awk '$1=="RID:"{print $2}')" \ -p:PublishReadyToRun=$_use_crossgen2 } check() { msg "Checking $pkgname" cd "$builddir"/test/xUnit dotnet test \ -c Release \ --runtime "$(dotnet --info | awk '$1=="RID:"{print $2}')" \ -p:PublishReadyToRun=$_use_crossgen2 } package() { # directory creation install -dm 755 \ "$pkgdir"/usr/lib \ "$pkgdir"/usr/bin # libary copy cp -ar "$builddir"/src/powershell-unix/bin/Linux/*/alpine* "$pkgdir"/usr/lib/$pkgname # already provided by 'libpsl-native' aport rm -f "$pkgdir"/usr/lib/$pkgname/libpsl-native.so # does not build for linux-musl, thus points to libc.so rather than musl # see https://github.com/dotnet/runtime/issues/63187 rm -f "$pkgdir"/usr/lib/$pkgname/libSystem.IO.Ports.Native.so # binary link ln -s "/usr/lib/$pkgname/pwsh" "$pkgdir"/usr/bin/pwsh } sha512sums=" 4a8933311950edb5c40925aeff8000177c5c4d17ef60612993a60166d65ca069dd42eae092e1fc6f40b3b1673fbb5e392e57568996af95a096d672b3eeab3bc0 powershell-7.3.4.tar.gz e9c4aeebd4fead1542b2c48c70134efcdb6c573273d8d05b1f8a2ece070e26899876b30264749992beac3044059716ca8c07b3bf970a419e525057c422f843c6 dependency-gatherer.targets 0e7550d8b702eeb9ebbd42100b32cbf7a0be676c5922cd6ee03ecdd3ba11d20d42a468f73ee428c6c92c8b7b18f9b022591a368191c2a358034ba4d7e78d2b84 fix-filesystem-test.patch 1aa10d32a37da0e7fd9d587105833d0a7ed9b71701018259d3efa2be90977808eb54a7d3e2d8bf03b693eeeac469f2e9ee88aa93006b7a2c22ae4720a8f62561 update-sdk-test-ppc64le.patch "