Backport:

https://github.com/pcbsd/freebsd-ports/commit/4c02fd3296c5f7d63564959ec702184caaa3ba18
https://github.com/pcbsd/freebsd-ports/commit/ff59b3ef7e6c55c7494590d49a29ae1936a7c80e