Install a package .pkg into a custom directory
Try unpkg. It has  worked flawlessly for me for several years.
unpkg solves the problem of installing a .pkg outside its intended location. You still have to figure out how to run gcc from that location. I assume it's a matter of setting the correct environment variables or setting symbolic links in /usr/local .