added common.sh

Took a lot of the common stuff out of the build scripts and put it here.