MinGW support in Port

See individual commits for details.

I chose to go for an extra MinGW block instead of further adding to the `#ifdef` forest as this seems to be the style preferred by Walter, but most of the code is actually identical to the `linux || __APPLE__ || __FreeBSD__ || __OpenBSD__` branch (with MinGW being on the macro-heavy side, like `__OpenBSD__`.