Goal: Get some #letsencrypt certificate obtained with #uacme deployed on some #Windows box

Step 1: Ok, this probably works best with #Powershell (which I don't really like ...)

Step 2: There's no #FreeBSD port ... but hey, there's now a FreeBSD port of #dotnet, let's try to "just" build Powershell using that.

Step 3: Hell why does it fail to build. Oh, System.Security.Cryptography.Native doesn't play well with #LibreSSL

Patch and retry, I guess I'll take some sleep now first. Bah!

(there's some irony in running into OpenSSL/LibreSSL issues when trying to deploy TLS certificates ...)

I guess that's progress ... some #PowerShell on #FreeBSD at least starting up. Creating a #port out of this will be a lot of work ๐Ÿ˜ž had to patch quite some code, e.g. completely disable the "login shell" functionality, the implementations only work on either #Linux or #MacOS....

And the whole build system fails completely if not built from within a #git working copy ... WTF? This will be another challenge for porting.

Ah, this messy version is probably a result of the mess in the upstream repo, a tag v7.4.1 exists, but refers to a commit that is gone.

Oh what did I expect ... ๐Ÿ˜‚

This will be though.

Well, I can certainly build #PowerShell for #FreeBSD now. I might be able to just "fake" a #git working copy for its stupid build system. This still doesn't fully solve the version issue, it insists on appending the git hash -> TODO.

The "login shell" feature can be added, an exercise left for later, the code will look pretty similar to the existing MacOS-X implementation. Maybe upstream would even accept it ๐Ÿ˜Ž

For a #port, it should probably be "published" as "#ReadyToRun" (I hope this has no negative impact), otherwise lang/dotnet would become a hard run dependency ... This works now as well, but requires changes in lang/dotnet ... requires some platform-specific #NuGet packages that don't exist on MS servers for FreeBSD. They are created during build of dotnet itself, but not installed anywhere by default ... I'll suggest an "on by default" port option to bundle these with lang/dotnet.

[โ€ฆ]

The biggest issue will probably be to find some at least somewhat sane way to download the required #NuGet packages during #port fetch phase, so they can be used "offline" during build later. Of course if ever possible with correct checksumming in distinfo.

This is always the same annoying crap with all these languages and frameworks inventing their own package management. Sucks.

For #NuGet, I tought the commandline client could maybe help with the task. Well if anyone can tell me how to even build that thing ... I guess I'll give up and look for other ideas. Should be possible to somehow automate the process to get the correct uris for package downloads? And then maybe patch the build files of #PowerShell to exclusively use a local directory as the "package source" ... we will see.

A working #FreeBSD #port of #Microsoft #PowerShell is certainly getting closer ๐Ÿ˜‰

And now, "staging" and packaging for #FreeBSD works as well ๐Ÿ˜Ž

But this is just the "base" #Powershell with no bundled modules. Next step, find out how to build and bundle some "essential" Modules, e.g. #PSResourceGet and/or #PowerShellGet (for Install-Module), and #PSReadLine (for sane commandline editing and stuff) ... any more that absolutely NEED to be bundled? ๐Ÿค”

Next "milestone", bundling #PowerShell modules with the #FreeBSD package (using the nupkg files available from powershellgallery) works! ๐Ÿฅณ

One little thing missing, some of these are auto-imported, others are not ... why? ๐Ÿค”

Edit: They are auto-imported as soon as you invoke a commandlet ... nice! ๐Ÿ˜Ž

Ok, time to commit to my local branch of #FreeBSD ports. Can't go to main yet because building still requires some patches to lang/dotnet ...

In case you want to test #PowerShell on #FreeBSD *NOW* ... here's a patch for #ports:
https://people.freebsd.org/~zirias/patches/0001-shells-powershell-Add-new-port.patch

It currently requires at least these patches applied before:
https://reviews.freebsd.org/D44560
https://reviews.freebsd.org/D44561

Note they will probably change, the maintainer of lang/dotnet is looking for better options to solve these issues.

#PowerShell for #FreeBSD, proper announcement and "call for testing" ๐Ÿ˜‰
https://lists.freebsd.org/archives/freebsd-ports/2024-April/005839.html
Porting PowerShell to FreeBSD, first working poc

Well, I wanted to test #FreeBSD #PowerShell for my usecase (which I *guess* I have, still not entirely sure), but ... I thought now that the port works, let's first rebase #ports (on main).

BAAAD idea. Not only did some change force my #poudriere to rebuild more or less *everything*, I also had fallout to fix from new #LibreSSL incompatibilities and some strange build error with #llvm-17.

Right now STILL waiting for the build of #chromium to finish.

Ok, testing PowerShell: tomorrow. ๐Ÿ™„

Testing #PowerShell on #FreeBSD can finally start!

Already found the first issue ... it seems #PSReadline needs terminfo-db from ports installed to work correctly ๐Ÿ™„ -- port will be updated!

@zirias

I wonder how much more this has to happen before some momentum gains behind an effort to switch #FreeBSD to #terminfo. (I vaguely remember that there's an open issue that has been languishing for years.)

@JdeBP @zirias #FreeBSD is using #terminfo instead of #termcap as of 2024.

@mpts @zirias

No. #FreeBSD provides only #termcap as standard right now. #terminfo is only available as a port.

It's possibly the only mainstream operating system where this is still the case. NetBSD and OpenBSD both provide terminfo. I haven't checked Illumos.

https://github.com/freebsd/freebsd-src/tree/main/share/termcap

freebsd-src/share/termcap at main ยท freebsd/freebsd-src

The FreeBSD src tree publish-only repository. Experimenting with 'simple' pull requests.... - freebsd/freebsd-src

GitHub
@JdeBP @mpts Available as a port, but used by base #curses when available, would still be acceptable IMHO, and again, AFAIK #FreeBSD is doing that since 14.x.

@zirias @mpts

That's not enough. There are plenty of things that use #termcap/#terminfo directly without using (n)curses. And as you've seen there are cases where the two aren't exactly the same.

There is a persistent very slow trickle of instances where people come along with something new, which works with terminfo (or its termcap compatibility shims) on every other operating system, and true termcap turns out to be a gotcha in some subtle way. Because no-one targets it any more.

#FreeBSD

@JdeBP @mpts "Using termcap/terminfo directly" nowadays means using curses. All the libraries needed for that are provided by curses (and nothing else).

@zirias @mpts

Wrong. There are libraries around that don't use (n)curses and access #terminfo directly. I remember this pain with NeoVIM and FreeBSD some years back. #NeoVIM used one of these non-curses libraries that provided direct access to terminfo.

(n)curses isn't the one-and-only abstraction that everyone uses.

@JdeBP @mpts It's the only that's present in #FreeBSD base. There's a libtinfo and libtcap, but those are provided by curses. I see no reason why any FreeBSD port should ever be linked against anything else for termcap/terminfo support.

@zirias @mpts

You haven't experienced nearly enough softwares. (-:

There have been alternatives to those, that are binary compatible with the #terminfo database files, but that are otherwise designed from scratch, for years now. As I said, #NeoVIM used one.

I have this vague memory that go goes its own way on this, too, but I might be mis-remembering. I've definitely seen over the years several ground-up implementations outwith C and C++ development.

#FreeBSD

@JdeBP @zirias @mpts the alternative are nothing like binary compatible https://github.com/neovim/unibilium another implementation which iirc is api compatible (not abi) with ncurses libterminfo is libtinfo from netbsd.
GitHub - neovim/unibilium: https://github.com/neovim/neovim/wiki/Deps#forks

https://github.com/neovim/neovim/wiki/Deps#forks. Contribute to neovim/unibilium development by creating an account on GitHub.

GitHub

@_bapt_ @zirias @mpts

unibilium is definitely binary compatible with the #terminfo database files, as I said, otherwise it couldn't work.

@JdeBP @zirias @mpts it can read the db but is not binary compatible with libterminfo

@_bapt_ @mpts

It's a good thing that I didn't say that it was, then. (-:

The whole point is that contrary to what @zirias said there are multiple independent libraries in different softwares and using #termcap/#terminfo directly does *not* mean using (n)curses, nor any lower-level library that it provides.

The world these days, especially the world outwith C/C++, rather works on the presumption that everyone is terminfo. #FreeBSD has brought porting up short several times.

@JdeBP @mpts @zirias well you spoke about binary compatibility hence the confusion, the terminfo db is not binary, it is bdb (ok binary) or flat text files defined at build time of ncurses. it can also be cdb (netbsd).

In freebsd the libterminfo was compiled to look for terminfo in bdb then termcap up to 13, since 14 it is terminfo flat text then termcap, base ships with 2 termcap db and there is the flat text file db in packages.

unibilium supports only flat text files iirc

@_bapt_ @mpts @zirias

I did say "with the #terminfo database files".

unibilium uses those database files. I don't remember offhand the other fairly prominent example that I encountered years ago. It was go or rust or something. There are several direct to terminfo database libraries in C#, too. Mono uses one, for starters.

Not only does the world usually expect terminfo nowadays, it even often works directly to the database files, no libterminfo or (n)curses in the picture at all.