Packages PowerShell for FreeBSD.
In this project, PowerShell is built in a Linux environment which has freebsd-arm64
and freebsd-x64
packs added to the .NET SDK.
Multiple environments are required to build the final packages.
Setup the build environment to target FreeBSD on Linux. This is not as hard as it sounds, bootstrap.ps1 should perform all the steps. Run this in as minimal environment as you can without an installed .NET SDK (eg in a docker
) but with PowerShell.
-
The PowerShell project is cloned from git.
-
Patches are applied.
-
The PowerShell
Start-PSBootstrap
is run to install a local copy of the matching .NET SDK. -
The
freebsd-arm64
andfreebsd-x64
runtime and apphost packs from sec/dotnet-core-freebsd-source-build are added to the SDK. -
The SDK configuration is updated to recognize those new packs.
Compile the application with compile.ps1 which uses freebsd-arm64
and freebsd-x64
as the targets.
FreeBSD
with the target architecture is used to build the final package.
-
Transfer the appropriate 'powershell-v7.4.5-freebsd-*.tar.gz' to the
FreeBSD
machine from theLinux
environment. -
Build the
libpsl-native.so
on the native host using compile.sh. -
Package the
FreeBSD
package file, this combines the result of the cross-compilation and the locallibpsl-native.so
.
The resulting package depends on the dotnet-runtime-8.0
package from rhubarb-geek-nz/dotnet-freebsd
The patches include the following
-
Add
freebsd-arm64
andfreebsd-x64
as valid targets to the build tools. -
Change the
powershell-unix.csproj
to not be a self-contained application. The result will use the host's.NET
runtime. -
Change
Program.cs
which hasLinux
andMacOS
mechanisms to get the application program name and path and replaces them withFreeBSD
mechanisms .
This is not a heavily tested target.
-
Interactive mode does not work well on
arm64
. -
Strongly recommend don't run as
root
. -
NamedPipeIPC_ServerListenerError
appears on the system console when using interactive mode.