When I'm using the Makefile fields "USE_GCC=yes GCC_COMMAND=/usr/local/bin/gcc8" in my port's Makefile the resulting packages installs the specified gcc compiler package as a dependency.
However, the Porter's Handbook at https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-depend.html explicitly mentions the meaning of the "USE_GCC=" optiona as:
The port requires GCC (gcc or g++) to build. [...]
To build, it says, and adds nothing about installing it together with the compiled port package. In reality, though, this usage ends up in the gcc-$version package being installed along with the port itself. The only way to avoid this currently is to only specify gcc in BUILD_DEPENDS.
What is it? Inconsistency in the documentation? Or a bug in the ports building framework?
Technically a documentation issue. The current documentation is not incorrect, it is just not explicitly complete, mentioning also the fact that its a RUN_DEPENDS too
The ability to specify gcc as a build *only* dependency is being handled in bug 211154, with workarounds in ports in the meantime taking the form of something like ports r464059 (removing gcc from RUN_DEPENDS)
A commit references this bug:
Date: Fri Jan 4 13:55:53 UTC 2019
New revision: 52746
Note that USE_GCC is a build and a run-time dependency.
Reported by: bergerkos yahoo co uk