If either of OSVERSION or UNAME_r is improperly set when building in a
jail/chroot, a number of unexpected errors can occur.
- autotools fixup may not run when needed. This could be avoided by always running it [PR 177980, 177403]
- Not having UNAME_r set will cause many unknown errors. Many ports use OSREL (derived from UNAME_r) to determine the name of files. This is usually also due to the port build itself using uname -r to derive filenames or 'built for' messages. [PR 192449, 191943]
Without having these sanity checks it is very easy for users to get into
situations where "everything worked" until they touch a certain port that
reads uname or OSVERSION. It has always been necessary to define all of the
UNAME_ vars and OSVERSION (or have a proper sys/param.h present), but many
users do not know this.
Remove the fallback on the kernel for kern.osreldate as it easily gets the
answer wrong.
I have added sanity checks to ensure OSVERSION==OSREL==UNAME_r as these are the
most critical vars to have set properly.