Illumos compatible stdenv-updates

Cherry picked from my earlier master and re-tested on stdenv-updates.

Fixes non-standard (bash) shell usage in gnupatch tests, which fixes them for ksh. Should also work on FreeBSD but untested by me.

Also updates a few packages to their latest version.