Cache some build parameters in the environment that were recalculated over

Description

Cache some build parameters in the environment that were recalculated over
and over for individual ports. This significantly reduces the time to scan
for updates if many ports with USES=compiler are present.

Based on a suggestion and code fragment provided by Tijl Coosemans.

While here commit a few changes present in my local version that should not
cause any functional change.