How did you deal with binaries and libraries, as well as third party apps like perl modules or php/apache modules?
All of this is managed through the /etc/alternatives system. I'm honestly not sure how all of it works, but I know that on my system, all of the postgres binaries and libs are linked through /etc/alternatives.